]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Update to iD v2.35.0
[rails.git] / vendor / assets / iD / iD.js
1 "use strict";
2 (() => {
3   var __create = Object.create;
4   var __defProp = Object.defineProperty;
5   var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6   var __getOwnPropNames = Object.getOwnPropertyNames;
7   var __getProtoOf = Object.getPrototypeOf;
8   var __hasOwnProp = Object.prototype.hasOwnProperty;
9   var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10   var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
11     get: (a4, b3) => (typeof require !== "undefined" ? require : a4)[b3]
12   }) : x2)(function(x2) {
13     if (typeof require !== "undefined") return require.apply(this, arguments);
14     throw Error('Dynamic require of "' + x2 + '" is not supported');
15   });
16   var __glob = (map2) => (path) => {
17     var fn = map2[path];
18     if (fn) return fn();
19     throw new Error("Module not found in bundle: " + path);
20   };
21   var __esm = (fn, res) => function __init() {
22     return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
23   };
24   var __commonJS = (cb, mod) => function __require2() {
25     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26   };
27   var __export = (target, all) => {
28     for (var name in all)
29       __defProp(target, name, { get: all[name], enumerable: true });
30   };
31   var __copyProps = (to, from, except, desc) => {
32     if (from && typeof from === "object" || typeof from === "function") {
33       for (let key of __getOwnPropNames(from))
34         if (!__hasOwnProp.call(to, key) && key !== except)
35           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36     }
37     return to;
38   };
39   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
40     // If the importer is in node compatibility mode or this is not an ESM
41     // file that has been converted to a CommonJS file using a Babel-
42     // compatible transform (i.e. "__esModule" has not been set), then set
43     // "default" to the CommonJS "module.exports" for node compatibility.
44     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
45     mod
46   ));
47   var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
48
49   // node_modules/whatwg-fetch/fetch.js
50   function isDataView(obj) {
51     return obj && DataView.prototype.isPrototypeOf(obj);
52   }
53   function normalizeName(name) {
54     if (typeof name !== "string") {
55       name = String(name);
56     }
57     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
58       throw new TypeError('Invalid character in header field name: "' + name + '"');
59     }
60     return name.toLowerCase();
61   }
62   function normalizeValue(value) {
63     if (typeof value !== "string") {
64       value = String(value);
65     }
66     return value;
67   }
68   function iteratorFor(items) {
69     var iterator = {
70       next: function() {
71         var value = items.shift();
72         return { done: value === void 0, value };
73       }
74     };
75     if (support.iterable) {
76       iterator[Symbol.iterator] = function() {
77         return iterator;
78       };
79     }
80     return iterator;
81   }
82   function Headers(headers) {
83     this.map = {};
84     if (headers instanceof Headers) {
85       headers.forEach(function(value, name) {
86         this.append(name, value);
87       }, this);
88     } else if (Array.isArray(headers)) {
89       headers.forEach(function(header) {
90         if (header.length != 2) {
91           throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
92         }
93         this.append(header[0], header[1]);
94       }, this);
95     } else if (headers) {
96       Object.getOwnPropertyNames(headers).forEach(function(name) {
97         this.append(name, headers[name]);
98       }, this);
99     }
100   }
101   function consumed(body) {
102     if (body._noBody) return;
103     if (body.bodyUsed) {
104       return Promise.reject(new TypeError("Already read"));
105     }
106     body.bodyUsed = true;
107   }
108   function fileReaderReady(reader) {
109     return new Promise(function(resolve, reject) {
110       reader.onload = function() {
111         resolve(reader.result);
112       };
113       reader.onerror = function() {
114         reject(reader.error);
115       };
116     });
117   }
118   function readBlobAsArrayBuffer(blob) {
119     var reader = new FileReader();
120     var promise = fileReaderReady(reader);
121     reader.readAsArrayBuffer(blob);
122     return promise;
123   }
124   function readBlobAsText(blob) {
125     var reader = new FileReader();
126     var promise = fileReaderReady(reader);
127     var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
128     var encoding = match ? match[1] : "utf-8";
129     reader.readAsText(blob, encoding);
130     return promise;
131   }
132   function readArrayBufferAsText(buf) {
133     var view = new Uint8Array(buf);
134     var chars = new Array(view.length);
135     for (var i3 = 0; i3 < view.length; i3++) {
136       chars[i3] = String.fromCharCode(view[i3]);
137     }
138     return chars.join("");
139   }
140   function bufferClone(buf) {
141     if (buf.slice) {
142       return buf.slice(0);
143     } else {
144       var view = new Uint8Array(buf.byteLength);
145       view.set(new Uint8Array(buf));
146       return view.buffer;
147     }
148   }
149   function Body() {
150     this.bodyUsed = false;
151     this._initBody = function(body) {
152       this.bodyUsed = this.bodyUsed;
153       this._bodyInit = body;
154       if (!body) {
155         this._noBody = true;
156         this._bodyText = "";
157       } else if (typeof body === "string") {
158         this._bodyText = body;
159       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
160         this._bodyBlob = body;
161       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
162         this._bodyFormData = body;
163       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
164         this._bodyText = body.toString();
165       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
166         this._bodyArrayBuffer = bufferClone(body.buffer);
167         this._bodyInit = new Blob([this._bodyArrayBuffer]);
168       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
169         this._bodyArrayBuffer = bufferClone(body);
170       } else {
171         this._bodyText = body = Object.prototype.toString.call(body);
172       }
173       if (!this.headers.get("content-type")) {
174         if (typeof body === "string") {
175           this.headers.set("content-type", "text/plain;charset=UTF-8");
176         } else if (this._bodyBlob && this._bodyBlob.type) {
177           this.headers.set("content-type", this._bodyBlob.type);
178         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
179           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
180         }
181       }
182     };
183     if (support.blob) {
184       this.blob = function() {
185         var rejected = consumed(this);
186         if (rejected) {
187           return rejected;
188         }
189         if (this._bodyBlob) {
190           return Promise.resolve(this._bodyBlob);
191         } else if (this._bodyArrayBuffer) {
192           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
193         } else if (this._bodyFormData) {
194           throw new Error("could not read FormData body as blob");
195         } else {
196           return Promise.resolve(new Blob([this._bodyText]));
197         }
198       };
199     }
200     this.arrayBuffer = function() {
201       if (this._bodyArrayBuffer) {
202         var isConsumed = consumed(this);
203         if (isConsumed) {
204           return isConsumed;
205         } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
206           return Promise.resolve(
207             this._bodyArrayBuffer.buffer.slice(
208               this._bodyArrayBuffer.byteOffset,
209               this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
210             )
211           );
212         } else {
213           return Promise.resolve(this._bodyArrayBuffer);
214         }
215       } else if (support.blob) {
216         return this.blob().then(readBlobAsArrayBuffer);
217       } else {
218         throw new Error("could not read as ArrayBuffer");
219       }
220     };
221     this.text = function() {
222       var rejected = consumed(this);
223       if (rejected) {
224         return rejected;
225       }
226       if (this._bodyBlob) {
227         return readBlobAsText(this._bodyBlob);
228       } else if (this._bodyArrayBuffer) {
229         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
230       } else if (this._bodyFormData) {
231         throw new Error("could not read FormData body as text");
232       } else {
233         return Promise.resolve(this._bodyText);
234       }
235     };
236     if (support.formData) {
237       this.formData = function() {
238         return this.text().then(decode);
239       };
240     }
241     this.json = function() {
242       return this.text().then(JSON.parse);
243     };
244     return this;
245   }
246   function normalizeMethod(method) {
247     var upcased = method.toUpperCase();
248     return methods.indexOf(upcased) > -1 ? upcased : method;
249   }
250   function Request(input, options) {
251     if (!(this instanceof Request)) {
252       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
253     }
254     options = options || {};
255     var body = options.body;
256     if (input instanceof Request) {
257       if (input.bodyUsed) {
258         throw new TypeError("Already read");
259       }
260       this.url = input.url;
261       this.credentials = input.credentials;
262       if (!options.headers) {
263         this.headers = new Headers(input.headers);
264       }
265       this.method = input.method;
266       this.mode = input.mode;
267       this.signal = input.signal;
268       if (!body && input._bodyInit != null) {
269         body = input._bodyInit;
270         input.bodyUsed = true;
271       }
272     } else {
273       this.url = String(input);
274     }
275     this.credentials = options.credentials || this.credentials || "same-origin";
276     if (options.headers || !this.headers) {
277       this.headers = new Headers(options.headers);
278     }
279     this.method = normalizeMethod(options.method || this.method || "GET");
280     this.mode = options.mode || this.mode || null;
281     this.signal = options.signal || this.signal || function() {
282       if ("AbortController" in g) {
283         var ctrl = new AbortController();
284         return ctrl.signal;
285       }
286     }();
287     this.referrer = null;
288     if ((this.method === "GET" || this.method === "HEAD") && body) {
289       throw new TypeError("Body not allowed for GET or HEAD requests");
290     }
291     this._initBody(body);
292     if (this.method === "GET" || this.method === "HEAD") {
293       if (options.cache === "no-store" || options.cache === "no-cache") {
294         var reParamSearch = /([?&])_=[^&]*/;
295         if (reParamSearch.test(this.url)) {
296           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
297         } else {
298           var reQueryString = /\?/;
299           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
300         }
301       }
302     }
303   }
304   function decode(body) {
305     var form = new FormData();
306     body.trim().split("&").forEach(function(bytes) {
307       if (bytes) {
308         var split = bytes.split("=");
309         var name = split.shift().replace(/\+/g, " ");
310         var value = split.join("=").replace(/\+/g, " ");
311         form.append(decodeURIComponent(name), decodeURIComponent(value));
312       }
313     });
314     return form;
315   }
316   function parseHeaders(rawHeaders) {
317     var headers = new Headers();
318     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
319     preProcessedHeaders.split("\r").map(function(header) {
320       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
321     }).forEach(function(line) {
322       var parts = line.split(":");
323       var key = parts.shift().trim();
324       if (key) {
325         var value = parts.join(":").trim();
326         try {
327           headers.append(key, value);
328         } catch (error) {
329           console.warn("Response " + error.message);
330         }
331       }
332     });
333     return headers;
334   }
335   function Response(bodyInit, options) {
336     if (!(this instanceof Response)) {
337       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
338     }
339     if (!options) {
340       options = {};
341     }
342     this.type = "default";
343     this.status = options.status === void 0 ? 200 : options.status;
344     if (this.status < 200 || this.status > 599) {
345       throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
346     }
347     this.ok = this.status >= 200 && this.status < 300;
348     this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
349     this.headers = new Headers(options.headers);
350     this.url = options.url || "";
351     this._initBody(bodyInit);
352   }
353   function fetch2(input, init2) {
354     return new Promise(function(resolve, reject) {
355       var request3 = new Request(input, init2);
356       if (request3.signal && request3.signal.aborted) {
357         return reject(new DOMException2("Aborted", "AbortError"));
358       }
359       var xhr = new XMLHttpRequest();
360       function abortXhr() {
361         xhr.abort();
362       }
363       xhr.onload = function() {
364         var options = {
365           statusText: xhr.statusText,
366           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
367         };
368         if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
369           options.status = 200;
370         } else {
371           options.status = xhr.status;
372         }
373         options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
374         var body = "response" in xhr ? xhr.response : xhr.responseText;
375         setTimeout(function() {
376           resolve(new Response(body, options));
377         }, 0);
378       };
379       xhr.onerror = function() {
380         setTimeout(function() {
381           reject(new TypeError("Network request failed"));
382         }, 0);
383       };
384       xhr.ontimeout = function() {
385         setTimeout(function() {
386           reject(new TypeError("Network request timed out"));
387         }, 0);
388       };
389       xhr.onabort = function() {
390         setTimeout(function() {
391           reject(new DOMException2("Aborted", "AbortError"));
392         }, 0);
393       };
394       function fixUrl(url) {
395         try {
396           return url === "" && g.location.href ? g.location.href : url;
397         } catch (e3) {
398           return url;
399         }
400       }
401       xhr.open(request3.method, fixUrl(request3.url), true);
402       if (request3.credentials === "include") {
403         xhr.withCredentials = true;
404       } else if (request3.credentials === "omit") {
405         xhr.withCredentials = false;
406       }
407       if ("responseType" in xhr) {
408         if (support.blob) {
409           xhr.responseType = "blob";
410         } else if (support.arrayBuffer) {
411           xhr.responseType = "arraybuffer";
412         }
413       }
414       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
415         var names = [];
416         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
417           names.push(normalizeName(name));
418           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
419         });
420         request3.headers.forEach(function(value, name) {
421           if (names.indexOf(name) === -1) {
422             xhr.setRequestHeader(name, value);
423           }
424         });
425       } else {
426         request3.headers.forEach(function(value, name) {
427           xhr.setRequestHeader(name, value);
428         });
429       }
430       if (request3.signal) {
431         request3.signal.addEventListener("abort", abortXhr);
432         xhr.onreadystatechange = function() {
433           if (xhr.readyState === 4) {
434             request3.signal.removeEventListener("abort", abortXhr);
435           }
436         };
437       }
438       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
439     });
440   }
441   var g, support, viewClasses, isArrayBufferView, methods, redirectStatuses, DOMException2;
442   var init_fetch = __esm({
443     "node_modules/whatwg-fetch/fetch.js"() {
444       g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
445       typeof global !== "undefined" && global || {};
446       support = {
447         searchParams: "URLSearchParams" in g,
448         iterable: "Symbol" in g && "iterator" in Symbol,
449         blob: "FileReader" in g && "Blob" in g && function() {
450           try {
451             new Blob();
452             return true;
453           } catch (e3) {
454             return false;
455           }
456         }(),
457         formData: "FormData" in g,
458         arrayBuffer: "ArrayBuffer" in g
459       };
460       if (support.arrayBuffer) {
461         viewClasses = [
462           "[object Int8Array]",
463           "[object Uint8Array]",
464           "[object Uint8ClampedArray]",
465           "[object Int16Array]",
466           "[object Uint16Array]",
467           "[object Int32Array]",
468           "[object Uint32Array]",
469           "[object Float32Array]",
470           "[object Float64Array]"
471         ];
472         isArrayBufferView = ArrayBuffer.isView || function(obj) {
473           return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
474         };
475       }
476       Headers.prototype.append = function(name, value) {
477         name = normalizeName(name);
478         value = normalizeValue(value);
479         var oldValue = this.map[name];
480         this.map[name] = oldValue ? oldValue + ", " + value : value;
481       };
482       Headers.prototype["delete"] = function(name) {
483         delete this.map[normalizeName(name)];
484       };
485       Headers.prototype.get = function(name) {
486         name = normalizeName(name);
487         return this.has(name) ? this.map[name] : null;
488       };
489       Headers.prototype.has = function(name) {
490         return this.map.hasOwnProperty(normalizeName(name));
491       };
492       Headers.prototype.set = function(name, value) {
493         this.map[normalizeName(name)] = normalizeValue(value);
494       };
495       Headers.prototype.forEach = function(callback, thisArg) {
496         for (var name in this.map) {
497           if (this.map.hasOwnProperty(name)) {
498             callback.call(thisArg, this.map[name], name, this);
499           }
500         }
501       };
502       Headers.prototype.keys = function() {
503         var items = [];
504         this.forEach(function(value, name) {
505           items.push(name);
506         });
507         return iteratorFor(items);
508       };
509       Headers.prototype.values = function() {
510         var items = [];
511         this.forEach(function(value) {
512           items.push(value);
513         });
514         return iteratorFor(items);
515       };
516       Headers.prototype.entries = function() {
517         var items = [];
518         this.forEach(function(value, name) {
519           items.push([name, value]);
520         });
521         return iteratorFor(items);
522       };
523       if (support.iterable) {
524         Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
525       }
526       methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
527       Request.prototype.clone = function() {
528         return new Request(this, { body: this._bodyInit });
529       };
530       Body.call(Request.prototype);
531       Body.call(Response.prototype);
532       Response.prototype.clone = function() {
533         return new Response(this._bodyInit, {
534           status: this.status,
535           statusText: this.statusText,
536           headers: new Headers(this.headers),
537           url: this.url
538         });
539       };
540       Response.error = function() {
541         var response = new Response(null, { status: 200, statusText: "" });
542         response.ok = false;
543         response.status = 0;
544         response.type = "error";
545         return response;
546       };
547       redirectStatuses = [301, 302, 303, 307, 308];
548       Response.redirect = function(url, status) {
549         if (redirectStatuses.indexOf(status) === -1) {
550           throw new RangeError("Invalid status code");
551         }
552         return new Response(null, { status, headers: { location: url } });
553       };
554       DOMException2 = g.DOMException;
555       try {
556         new DOMException2();
557       } catch (err) {
558         DOMException2 = function(message, name) {
559           this.message = message;
560           this.name = name;
561           var error = Error(message);
562           this.stack = error.stack;
563         };
564         DOMException2.prototype = Object.create(Error.prototype);
565         DOMException2.prototype.constructor = DOMException2;
566       }
567       fetch2.polyfill = true;
568       if (!g.fetch) {
569         g.fetch = fetch2;
570         g.Headers = Headers;
571         g.Request = Request;
572         g.Response = Response;
573       }
574     }
575   });
576
577   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
578   var init_polyfill_patch_fetch = __esm({
579     "node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js"() {
580       (function(factory) {
581         typeof define === "function" && define.amd ? define(factory) : factory();
582       })(function() {
583         "use strict";
584         function _arrayLikeToArray(r2, a4) {
585           (null == a4 || a4 > r2.length) && (a4 = r2.length);
586           for (var e3 = 0, n3 = Array(a4); e3 < a4; e3++) n3[e3] = r2[e3];
587           return n3;
588         }
589         function _assertThisInitialized(e3) {
590           if (void 0 === e3) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
591           return e3;
592         }
593         function _callSuper(t2, o2, e3) {
594           return o2 = _getPrototypeOf(o2), _possibleConstructorReturn(t2, _isNativeReflectConstruct() ? Reflect.construct(o2, e3 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e3));
595         }
596         function _classCallCheck(a4, n3) {
597           if (!(a4 instanceof n3)) throw new TypeError("Cannot call a class as a function");
598         }
599         function _defineProperties(e3, r2) {
600           for (var t2 = 0; t2 < r2.length; t2++) {
601             var o2 = r2[t2];
602             o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, _toPropertyKey(o2.key), o2);
603           }
604         }
605         function _createClass(e3, r2, t2) {
606           return r2 && _defineProperties(e3.prototype, r2), t2 && _defineProperties(e3, t2), Object.defineProperty(e3, "prototype", {
607             writable: false
608           }), e3;
609         }
610         function _createForOfIteratorHelper(r2, e3) {
611           var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
612           if (!t2) {
613             if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray(r2)) || e3 && r2 && "number" == typeof r2.length) {
614               t2 && (r2 = t2);
615               var n3 = 0, F3 = function() {
616               };
617               return {
618                 s: F3,
619                 n: function() {
620                   return n3 >= r2.length ? {
621                     done: true
622                   } : {
623                     done: false,
624                     value: r2[n3++]
625                   };
626                 },
627                 e: function(r3) {
628                   throw r3;
629                 },
630                 f: F3
631               };
632             }
633             throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
634           }
635           var o2, a4 = true, u2 = false;
636           return {
637             s: function() {
638               t2 = t2.call(r2);
639             },
640             n: function() {
641               var r3 = t2.next();
642               return a4 = r3.done, r3;
643             },
644             e: function(r3) {
645               u2 = true, o2 = r3;
646             },
647             f: function() {
648               try {
649                 a4 || null == t2.return || t2.return();
650               } finally {
651                 if (u2) throw o2;
652               }
653             }
654           };
655         }
656         function _get() {
657           return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e3, t2, r2) {
658             var p2 = _superPropBase(e3, t2);
659             if (p2) {
660               var n3 = Object.getOwnPropertyDescriptor(p2, t2);
661               return n3.get ? n3.get.call(arguments.length < 3 ? e3 : r2) : n3.value;
662             }
663           }, _get.apply(null, arguments);
664         }
665         function _getPrototypeOf(t2) {
666           return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
667             return t3.__proto__ || Object.getPrototypeOf(t3);
668           }, _getPrototypeOf(t2);
669         }
670         function _inherits(t2, e3) {
671           if ("function" != typeof e3 && null !== e3) throw new TypeError("Super expression must either be null or a function");
672           t2.prototype = Object.create(e3 && e3.prototype, {
673             constructor: {
674               value: t2,
675               writable: true,
676               configurable: true
677             }
678           }), Object.defineProperty(t2, "prototype", {
679             writable: false
680           }), e3 && _setPrototypeOf(t2, e3);
681         }
682         function _isNativeReflectConstruct() {
683           try {
684             var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
685             }));
686           } catch (t3) {
687           }
688           return (_isNativeReflectConstruct = function() {
689             return !!t2;
690           })();
691         }
692         function _possibleConstructorReturn(t2, e3) {
693           if (e3 && ("object" == typeof e3 || "function" == typeof e3)) return e3;
694           if (void 0 !== e3) throw new TypeError("Derived constructors may only return object or undefined");
695           return _assertThisInitialized(t2);
696         }
697         function _setPrototypeOf(t2, e3) {
698           return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e4) {
699             return t3.__proto__ = e4, t3;
700           }, _setPrototypeOf(t2, e3);
701         }
702         function _superPropBase(t2, o2) {
703           for (; !{}.hasOwnProperty.call(t2, o2) && null !== (t2 = _getPrototypeOf(t2)); ) ;
704           return t2;
705         }
706         function _superPropGet(t2, o2, e3, r2) {
707           var p2 = _get(_getPrototypeOf(1 & r2 ? t2.prototype : t2), o2, e3);
708           return 2 & r2 && "function" == typeof p2 ? function(t3) {
709             return p2.apply(e3, t3);
710           } : p2;
711         }
712         function _toPrimitive(t2, r2) {
713           if ("object" != typeof t2 || !t2) return t2;
714           var e3 = t2[Symbol.toPrimitive];
715           if (void 0 !== e3) {
716             var i3 = e3.call(t2, r2 || "default");
717             if ("object" != typeof i3) return i3;
718             throw new TypeError("@@toPrimitive must return a primitive value.");
719           }
720           return ("string" === r2 ? String : Number)(t2);
721         }
722         function _toPropertyKey(t2) {
723           var i3 = _toPrimitive(t2, "string");
724           return "symbol" == typeof i3 ? i3 : i3 + "";
725         }
726         function _unsupportedIterableToArray(r2, a4) {
727           if (r2) {
728             if ("string" == typeof r2) return _arrayLikeToArray(r2, a4);
729             var t2 = {}.toString.call(r2).slice(8, -1);
730             return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r2, a4) : void 0;
731           }
732         }
733         (function(self2) {
734           return {
735             NativeAbortSignal: self2.AbortSignal,
736             NativeAbortController: self2.AbortController
737           };
738         })(typeof self !== "undefined" ? self : global);
739         function createAbortEvent(reason) {
740           var event;
741           try {
742             event = new Event("abort");
743           } catch (e3) {
744             if (typeof document !== "undefined") {
745               if (!document.createEvent) {
746                 event = document.createEventObject();
747                 event.type = "abort";
748               } else {
749                 event = document.createEvent("Event");
750                 event.initEvent("abort", false, false);
751               }
752             } else {
753               event = {
754                 type: "abort",
755                 bubbles: false,
756                 cancelable: false
757               };
758             }
759           }
760           event.reason = reason;
761           return event;
762         }
763         function normalizeAbortReason(reason) {
764           if (reason === void 0) {
765             if (typeof document === "undefined") {
766               reason = new Error("This operation was aborted");
767               reason.name = "AbortError";
768             } else {
769               try {
770                 reason = new DOMException("signal is aborted without reason");
771                 Object.defineProperty(reason, "name", {
772                   value: "AbortError"
773                 });
774               } catch (err) {
775                 reason = new Error("This operation was aborted");
776                 reason.name = "AbortError";
777               }
778             }
779           }
780           return reason;
781         }
782         var Emitter = /* @__PURE__ */ function() {
783           function Emitter2() {
784             _classCallCheck(this, Emitter2);
785             Object.defineProperty(this, "listeners", {
786               value: {},
787               writable: true,
788               configurable: true
789             });
790           }
791           return _createClass(Emitter2, [{
792             key: "addEventListener",
793             value: function addEventListener(type2, callback, options) {
794               if (!(type2 in this.listeners)) {
795                 this.listeners[type2] = [];
796               }
797               this.listeners[type2].push({
798                 callback,
799                 options
800               });
801             }
802           }, {
803             key: "removeEventListener",
804             value: function removeEventListener(type2, callback) {
805               if (!(type2 in this.listeners)) {
806                 return;
807               }
808               var stack = this.listeners[type2];
809               for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
810                 if (stack[i3].callback === callback) {
811                   stack.splice(i3, 1);
812                   return;
813                 }
814               }
815             }
816           }, {
817             key: "dispatchEvent",
818             value: function dispatchEvent2(event) {
819               var _this = this;
820               if (!(event.type in this.listeners)) {
821                 return;
822               }
823               var stack = this.listeners[event.type];
824               var stackToCall = stack.slice();
825               var _loop = function _loop2() {
826                 var listener = stackToCall[i3];
827                 try {
828                   listener.callback.call(_this, event);
829                 } catch (e3) {
830                   Promise.resolve().then(function() {
831                     throw e3;
832                   });
833                 }
834                 if (listener.options && listener.options.once) {
835                   _this.removeEventListener(event.type, listener.callback);
836                 }
837               };
838               for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
839                 _loop();
840               }
841               return !event.defaultPrevented;
842             }
843           }]);
844         }();
845         var AbortSignal = /* @__PURE__ */ function(_Emitter) {
846           function AbortSignal2() {
847             var _this2;
848             _classCallCheck(this, AbortSignal2);
849             _this2 = _callSuper(this, AbortSignal2);
850             if (!_this2.listeners) {
851               Emitter.call(_this2);
852             }
853             Object.defineProperty(_this2, "aborted", {
854               value: false,
855               writable: true,
856               configurable: true
857             });
858             Object.defineProperty(_this2, "onabort", {
859               value: null,
860               writable: true,
861               configurable: true
862             });
863             Object.defineProperty(_this2, "reason", {
864               value: void 0,
865               writable: true,
866               configurable: true
867             });
868             return _this2;
869           }
870           _inherits(AbortSignal2, _Emitter);
871           return _createClass(AbortSignal2, [{
872             key: "toString",
873             value: function toString2() {
874               return "[object AbortSignal]";
875             }
876           }, {
877             key: "dispatchEvent",
878             value: function dispatchEvent2(event) {
879               if (event.type === "abort") {
880                 this.aborted = true;
881                 if (typeof this.onabort === "function") {
882                   this.onabort.call(this, event);
883                 }
884               }
885               _superPropGet(AbortSignal2, "dispatchEvent", this, 3)([event]);
886             }
887             /**
888              * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/throwIfAborted}
889              */
890           }, {
891             key: "throwIfAborted",
892             value: function throwIfAborted() {
893               var aborted = this.aborted, _this$reason = this.reason, reason = _this$reason === void 0 ? "Aborted" : _this$reason;
894               if (!aborted) return;
895               throw reason;
896             }
897             /**
898              * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/timeout_static}
899              * @param {number} time The "active" time in milliseconds before the returned {@link AbortSignal} will abort.
900              *                      The value must be within range of 0 and {@link Number.MAX_SAFE_INTEGER}.
901              * @returns {AbortSignal} The signal will abort with its {@link AbortSignal.reason} property set to a `TimeoutError` {@link DOMException} on timeout,
902              *                        or an `AbortError` {@link DOMException} if the operation was user-triggered.
903              */
904           }], [{
905             key: "timeout",
906             value: function timeout2(time) {
907               var controller = new AbortController2();
908               setTimeout(function() {
909                 return controller.abort(new DOMException("This signal is timeout in ".concat(time, "ms"), "TimeoutError"));
910               }, time);
911               return controller.signal;
912             }
913             /**
914              * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static}
915              * @param {Iterable<AbortSignal>} iterable An {@link Iterable} (such as an {@link Array}) of abort signals.
916              * @returns {AbortSignal} - **Already aborted**, if any of the abort signals given is already aborted.
917              *                          The returned {@link AbortSignal}'s reason will be already set to the `reason` of the first abort signal that was already aborted.
918              *                        - **Asynchronously aborted**, when any abort signal in `iterable` aborts.
919              *                          The `reason` will be set to the reason of the first abort signal that is aborted.
920              */
921           }, {
922             key: "any",
923             value: function any(iterable) {
924               var controller = new AbortController2();
925               function abort() {
926                 controller.abort(this.reason);
927                 clean2();
928               }
929               function clean2() {
930                 var _iterator = _createForOfIteratorHelper(iterable), _step;
931                 try {
932                   for (_iterator.s(); !(_step = _iterator.n()).done; ) {
933                     var signal2 = _step.value;
934                     signal2.removeEventListener("abort", abort);
935                   }
936                 } catch (err) {
937                   _iterator.e(err);
938                 } finally {
939                   _iterator.f();
940                 }
941               }
942               var _iterator2 = _createForOfIteratorHelper(iterable), _step2;
943               try {
944                 for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
945                   var signal = _step2.value;
946                   if (signal.aborted) {
947                     controller.abort(signal.reason);
948                     break;
949                   } else signal.addEventListener("abort", abort);
950                 }
951               } catch (err) {
952                 _iterator2.e(err);
953               } finally {
954                 _iterator2.f();
955               }
956               return controller.signal;
957             }
958           }]);
959         }(Emitter);
960         var AbortController2 = /* @__PURE__ */ function() {
961           function AbortController3() {
962             _classCallCheck(this, AbortController3);
963             Object.defineProperty(this, "signal", {
964               value: new AbortSignal(),
965               writable: true,
966               configurable: true
967             });
968           }
969           return _createClass(AbortController3, [{
970             key: "abort",
971             value: function abort(reason) {
972               var signalReason = normalizeAbortReason(reason);
973               var event = createAbortEvent(signalReason);
974               this.signal.reason = signalReason;
975               this.signal.dispatchEvent(event);
976             }
977           }, {
978             key: "toString",
979             value: function toString2() {
980               return "[object AbortController]";
981             }
982           }]);
983         }();
984         if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
985           AbortController2.prototype[Symbol.toStringTag] = "AbortController";
986           AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
987         }
988         function polyfillNeeded(self2) {
989           if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
990             console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
991             return true;
992           }
993           return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
994         }
995         function abortableFetchDecorator(patchTargets) {
996           if ("function" === typeof patchTargets) {
997             patchTargets = {
998               fetch: patchTargets
999             };
1000           }
1001           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;
1002           if (!polyfillNeeded({
1003             fetch: fetch3,
1004             Request: NativeRequest,
1005             AbortController: NativeAbortController,
1006             __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
1007           })) {
1008             return {
1009               fetch: fetch3,
1010               Request: Request2
1011             };
1012           }
1013           var Request2 = NativeRequest;
1014           if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
1015             Request2 = function Request3(input, init2) {
1016               var signal;
1017               if (init2 && init2.signal) {
1018                 signal = init2.signal;
1019                 delete init2.signal;
1020               }
1021               var request3 = new NativeRequest(input, init2);
1022               if (signal) {
1023                 Object.defineProperty(request3, "signal", {
1024                   writable: false,
1025                   enumerable: false,
1026                   configurable: true,
1027                   value: signal
1028                 });
1029               }
1030               return request3;
1031             };
1032             Request2.prototype = NativeRequest.prototype;
1033           }
1034           var realFetch = fetch3;
1035           var abortableFetch = function abortableFetch2(input, init2) {
1036             var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
1037             if (signal) {
1038               var abortError;
1039               try {
1040                 abortError = new DOMException("Aborted", "AbortError");
1041               } catch (err) {
1042                 abortError = new Error("Aborted");
1043                 abortError.name = "AbortError";
1044               }
1045               if (signal.aborted) {
1046                 return Promise.reject(abortError);
1047               }
1048               var cancellation = new Promise(function(_3, reject) {
1049                 signal.addEventListener("abort", function() {
1050                   return reject(abortError);
1051                 }, {
1052                   once: true
1053                 });
1054               });
1055               if (init2 && init2.signal) {
1056                 delete init2.signal;
1057               }
1058               return Promise.race([cancellation, realFetch(input, init2)]);
1059             }
1060             return realFetch(input, init2);
1061           };
1062           return {
1063             fetch: abortableFetch,
1064             Request: Request2
1065           };
1066         }
1067         (function(self2) {
1068           if (!polyfillNeeded(self2)) {
1069             return;
1070           }
1071           if (!self2.fetch) {
1072             console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
1073             return;
1074           }
1075           var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
1076           self2.fetch = fetch3;
1077           self2.Request = Request2;
1078           Object.defineProperty(self2, "AbortController", {
1079             writable: true,
1080             enumerable: false,
1081             configurable: true,
1082             value: AbortController2
1083           });
1084           Object.defineProperty(self2, "AbortSignal", {
1085             writable: true,
1086             enumerable: false,
1087             configurable: true,
1088             value: AbortSignal
1089           });
1090         })(typeof self !== "undefined" ? self : global);
1091       });
1092     }
1093   });
1094
1095   // modules/actions/add_entity.js
1096   var add_entity_exports = {};
1097   __export(add_entity_exports, {
1098     actionAddEntity: () => actionAddEntity
1099   });
1100   function actionAddEntity(way) {
1101     return function(graph) {
1102       return graph.replace(way);
1103     };
1104   }
1105   var init_add_entity = __esm({
1106     "modules/actions/add_entity.js"() {
1107       "use strict";
1108     }
1109   });
1110
1111   // modules/actions/reverse.js
1112   var reverse_exports = {};
1113   __export(reverse_exports, {
1114     actionReverse: () => actionReverse
1115   });
1116   function actionReverse(entityID, options) {
1117     var numeric = /^([+\-]?)(?=[\d.])/;
1118     var directionKey = /direction$/;
1119     var keyReplacements = [
1120       [/:right$/, ":left"],
1121       [/:left$/, ":right"],
1122       [/:forward$/, ":backward"],
1123       [/:backward$/, ":forward"],
1124       [/:right:/, ":left:"],
1125       [/:left:/, ":right:"],
1126       [/:forward:/, ":backward:"],
1127       [/:backward:/, ":forward:"]
1128     ];
1129     var valueReplacements = {
1130       left: "right",
1131       right: "left",
1132       up: "down",
1133       down: "up",
1134       forward: "backward",
1135       backward: "forward",
1136       forwards: "backward",
1137       backwards: "forward"
1138     };
1139     const keysToKeepUnchanged = [
1140       // https://github.com/openstreetmap/iD/issues/10736
1141       /^red_turn:(right|left):?/
1142     ];
1143     const keyValuesToKeepUnchanged = [
1144       {
1145         keyRegex: /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/,
1146         prerequisiteTags: [{}]
1147       },
1148       {
1149         // Turn lanes are left/right to key (not way) direction - #5674
1150         keyRegex: /^turn:lanes:?/,
1151         prerequisiteTags: [{}]
1152       },
1153       {
1154         // https://github.com/openstreetmap/iD/issues/10128
1155         keyRegex: /^side$/,
1156         prerequisiteTags: [{ highway: "cyclist_waiting_aid" }]
1157       }
1158     ];
1159     var roleReplacements = {
1160       forward: "backward",
1161       backward: "forward",
1162       forwards: "backward",
1163       backwards: "forward"
1164     };
1165     var onewayReplacements = {
1166       yes: "-1",
1167       "1": "-1",
1168       "-1": "yes"
1169     };
1170     var compassReplacements = {
1171       N: "S",
1172       NNE: "SSW",
1173       NE: "SW",
1174       ENE: "WSW",
1175       E: "W",
1176       ESE: "WNW",
1177       SE: "NW",
1178       SSE: "NNW",
1179       S: "N",
1180       SSW: "NNE",
1181       SW: "NE",
1182       WSW: "ENE",
1183       W: "E",
1184       WNW: "ESE",
1185       NW: "SE",
1186       NNW: "SSE"
1187     };
1188     function reverseKey(key) {
1189       if (keysToKeepUnchanged.some((keyRegex) => keyRegex.test(key))) {
1190         return key;
1191       }
1192       for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
1193         var replacement = keyReplacements[i3];
1194         if (replacement[0].test(key)) {
1195           return key.replace(replacement[0], replacement[1]);
1196         }
1197       }
1198       return key;
1199     }
1200     function reverseValue(key, value, includeAbsolute, allTags) {
1201       for (let { keyRegex, prerequisiteTags } of keyValuesToKeepUnchanged) {
1202         if (keyRegex.test(key) && prerequisiteTags.some(
1203           (expectedTags) => Object.entries(expectedTags).every(([k3, v3]) => {
1204             return allTags[k3] && (v3 === "*" || allTags[k3] === v3);
1205           })
1206         )) {
1207           return value;
1208         }
1209       }
1210       if (key === "incline" && numeric.test(value)) {
1211         return value.replace(numeric, function(_3, sign2) {
1212           return sign2 === "-" ? "" : "-";
1213         });
1214       } else if (options && options.reverseOneway && key === "oneway") {
1215         return onewayReplacements[value] || value;
1216       } else if (includeAbsolute && directionKey.test(key)) {
1217         return value.split(";").map((value2) => {
1218           if (compassReplacements[value2]) return compassReplacements[value2];
1219           var degrees3 = Number(value2);
1220           if (isFinite(degrees3)) {
1221             if (degrees3 < 180) {
1222               degrees3 += 180;
1223             } else {
1224               degrees3 -= 180;
1225             }
1226             return degrees3.toString();
1227           } else {
1228             return valueReplacements[value2] || value2;
1229           }
1230         }).join(";");
1231       }
1232       return valueReplacements[value] || value;
1233     }
1234     function reverseNodeTags(graph, nodeIDs) {
1235       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
1236         var node = graph.hasEntity(nodeIDs[i3]);
1237         if (!node || !Object.keys(node.tags).length) continue;
1238         var tags = {};
1239         for (var key in node.tags) {
1240           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID, node.tags);
1241         }
1242         graph = graph.replace(node.update({ tags }));
1243       }
1244       return graph;
1245     }
1246     function reverseWay(graph, way) {
1247       var nodes = way.nodes.slice().reverse();
1248       var tags = {};
1249       var role;
1250       for (var key in way.tags) {
1251         tags[reverseKey(key)] = reverseValue(key, way.tags[key], false, way.tags);
1252       }
1253       graph.parentRelations(way).forEach(function(relation) {
1254         relation.members.forEach(function(member, index) {
1255           if (member.id === way.id && (role = roleReplacements[member.role])) {
1256             relation = relation.updateMember({ role }, index);
1257             graph = graph.replace(relation);
1258           }
1259         });
1260       });
1261       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
1262     }
1263     var action = function(graph) {
1264       var entity = graph.entity(entityID);
1265       if (entity.type === "way") {
1266         return reverseWay(graph, entity);
1267       }
1268       return reverseNodeTags(graph, [entityID]);
1269     };
1270     action.disabled = function(graph) {
1271       var entity = graph.hasEntity(entityID);
1272       if (!entity || entity.type === "way") return false;
1273       for (var key in entity.tags) {
1274         var value = entity.tags[key];
1275         if (reverseKey(key) !== key || reverseValue(key, value, true, entity.tags) !== value) {
1276           return false;
1277         }
1278       }
1279       return "nondirectional_node";
1280     };
1281     action.entityID = function() {
1282       return entityID;
1283     };
1284     return action;
1285   }
1286   var init_reverse = __esm({
1287     "modules/actions/reverse.js"() {
1288       "use strict";
1289     }
1290   });
1291
1292   // node_modules/d3-array/src/ascending.js
1293   function ascending(a4, b3) {
1294     return a4 == null || b3 == null ? NaN : a4 < b3 ? -1 : a4 > b3 ? 1 : a4 >= b3 ? 0 : NaN;
1295   }
1296   var init_ascending = __esm({
1297     "node_modules/d3-array/src/ascending.js"() {
1298     }
1299   });
1300
1301   // node_modules/d3-array/src/descending.js
1302   function descending(a4, b3) {
1303     return a4 == null || b3 == null ? NaN : b3 < a4 ? -1 : b3 > a4 ? 1 : b3 >= a4 ? 0 : NaN;
1304   }
1305   var init_descending = __esm({
1306     "node_modules/d3-array/src/descending.js"() {
1307     }
1308   });
1309
1310   // node_modules/d3-array/src/bisector.js
1311   function bisector(f2) {
1312     let compare1, compare2, delta;
1313     if (f2.length !== 2) {
1314       compare1 = ascending;
1315       compare2 = (d2, x2) => ascending(f2(d2), x2);
1316       delta = (d2, x2) => f2(d2) - x2;
1317     } else {
1318       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
1319       compare2 = f2;
1320       delta = f2;
1321     }
1322     function left(a4, x2, lo = 0, hi = a4.length) {
1323       if (lo < hi) {
1324         if (compare1(x2, x2) !== 0) return hi;
1325         do {
1326           const mid = lo + hi >>> 1;
1327           if (compare2(a4[mid], x2) < 0) lo = mid + 1;
1328           else hi = mid;
1329         } while (lo < hi);
1330       }
1331       return lo;
1332     }
1333     function right(a4, x2, lo = 0, hi = a4.length) {
1334       if (lo < hi) {
1335         if (compare1(x2, x2) !== 0) return hi;
1336         do {
1337           const mid = lo + hi >>> 1;
1338           if (compare2(a4[mid], x2) <= 0) lo = mid + 1;
1339           else hi = mid;
1340         } while (lo < hi);
1341       }
1342       return lo;
1343     }
1344     function center(a4, x2, lo = 0, hi = a4.length) {
1345       const i3 = left(a4, x2, lo, hi - 1);
1346       return i3 > lo && delta(a4[i3 - 1], x2) > -delta(a4[i3], x2) ? i3 - 1 : i3;
1347     }
1348     return { left, center, right };
1349   }
1350   function zero() {
1351     return 0;
1352   }
1353   var init_bisector = __esm({
1354     "node_modules/d3-array/src/bisector.js"() {
1355       init_ascending();
1356       init_descending();
1357     }
1358   });
1359
1360   // node_modules/d3-array/src/number.js
1361   function number(x2) {
1362     return x2 === null ? NaN : +x2;
1363   }
1364   function* numbers(values, valueof) {
1365     if (valueof === void 0) {
1366       for (let value of values) {
1367         if (value != null && (value = +value) >= value) {
1368           yield value;
1369         }
1370       }
1371     } else {
1372       let index = -1;
1373       for (let value of values) {
1374         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
1375           yield value;
1376         }
1377       }
1378     }
1379   }
1380   var init_number = __esm({
1381     "node_modules/d3-array/src/number.js"() {
1382     }
1383   });
1384
1385   // node_modules/d3-array/src/bisect.js
1386   var ascendingBisect, bisectRight, bisectLeft, bisectCenter, bisect_default;
1387   var init_bisect = __esm({
1388     "node_modules/d3-array/src/bisect.js"() {
1389       init_ascending();
1390       init_bisector();
1391       init_number();
1392       ascendingBisect = bisector(ascending);
1393       bisectRight = ascendingBisect.right;
1394       bisectLeft = ascendingBisect.left;
1395       bisectCenter = bisector(number).center;
1396       bisect_default = bisectRight;
1397     }
1398   });
1399
1400   // node_modules/d3-array/src/fsum.js
1401   var Adder;
1402   var init_fsum = __esm({
1403     "node_modules/d3-array/src/fsum.js"() {
1404       Adder = class {
1405         constructor() {
1406           this._partials = new Float64Array(32);
1407           this._n = 0;
1408         }
1409         add(x2) {
1410           const p2 = this._partials;
1411           let i3 = 0;
1412           for (let j3 = 0; j3 < this._n && j3 < 32; j3++) {
1413             const y2 = p2[j3], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
1414             if (lo) p2[i3++] = lo;
1415             x2 = hi;
1416           }
1417           p2[i3] = x2;
1418           this._n = i3 + 1;
1419           return this;
1420         }
1421         valueOf() {
1422           const p2 = this._partials;
1423           let n3 = this._n, x2, y2, lo, hi = 0;
1424           if (n3 > 0) {
1425             hi = p2[--n3];
1426             while (n3 > 0) {
1427               x2 = hi;
1428               y2 = p2[--n3];
1429               hi = x2 + y2;
1430               lo = y2 - (hi - x2);
1431               if (lo) break;
1432             }
1433             if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
1434               y2 = lo * 2;
1435               x2 = hi + y2;
1436               if (y2 == x2 - hi) hi = x2;
1437             }
1438           }
1439           return hi;
1440         }
1441       };
1442     }
1443   });
1444
1445   // node_modules/d3-array/src/sort.js
1446   function compareDefined(compare2 = ascending) {
1447     if (compare2 === ascending) return ascendingDefined;
1448     if (typeof compare2 !== "function") throw new TypeError("compare is not a function");
1449     return (a4, b3) => {
1450       const x2 = compare2(a4, b3);
1451       if (x2 || x2 === 0) return x2;
1452       return (compare2(b3, b3) === 0) - (compare2(a4, a4) === 0);
1453     };
1454   }
1455   function ascendingDefined(a4, b3) {
1456     return (a4 == null || !(a4 >= a4)) - (b3 == null || !(b3 >= b3)) || (a4 < b3 ? -1 : a4 > b3 ? 1 : 0);
1457   }
1458   var init_sort = __esm({
1459     "node_modules/d3-array/src/sort.js"() {
1460       init_ascending();
1461     }
1462   });
1463
1464   // node_modules/d3-array/src/ticks.js
1465   function tickSpec(start2, stop, count) {
1466     const step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
1467     let i1, i22, inc;
1468     if (power < 0) {
1469       inc = Math.pow(10, -power) / factor;
1470       i1 = Math.round(start2 * inc);
1471       i22 = Math.round(stop * inc);
1472       if (i1 / inc < start2) ++i1;
1473       if (i22 / inc > stop) --i22;
1474       inc = -inc;
1475     } else {
1476       inc = Math.pow(10, power) * factor;
1477       i1 = Math.round(start2 / inc);
1478       i22 = Math.round(stop / inc);
1479       if (i1 * inc < start2) ++i1;
1480       if (i22 * inc > stop) --i22;
1481     }
1482     if (i22 < i1 && 0.5 <= count && count < 2) return tickSpec(start2, stop, count * 2);
1483     return [i1, i22, inc];
1484   }
1485   function ticks(start2, stop, count) {
1486     stop = +stop, start2 = +start2, count = +count;
1487     if (!(count > 0)) return [];
1488     if (start2 === stop) return [start2];
1489     const reverse = stop < start2, [i1, i22, inc] = reverse ? tickSpec(stop, start2, count) : tickSpec(start2, stop, count);
1490     if (!(i22 >= i1)) return [];
1491     const n3 = i22 - i1 + 1, ticks2 = new Array(n3);
1492     if (reverse) {
1493       if (inc < 0) for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i22 - i3) / -inc;
1494       else for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i22 - i3) * inc;
1495     } else {
1496       if (inc < 0) for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i1 + i3) / -inc;
1497       else for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i1 + i3) * inc;
1498     }
1499     return ticks2;
1500   }
1501   function tickIncrement(start2, stop, count) {
1502     stop = +stop, start2 = +start2, count = +count;
1503     return tickSpec(start2, stop, count)[2];
1504   }
1505   function tickStep(start2, stop, count) {
1506     stop = +stop, start2 = +start2, count = +count;
1507     const reverse = stop < start2, inc = reverse ? tickIncrement(stop, start2, count) : tickIncrement(start2, stop, count);
1508     return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
1509   }
1510   var e10, e5, e2;
1511   var init_ticks = __esm({
1512     "node_modules/d3-array/src/ticks.js"() {
1513       e10 = Math.sqrt(50);
1514       e5 = Math.sqrt(10);
1515       e2 = Math.sqrt(2);
1516     }
1517   });
1518
1519   // node_modules/d3-array/src/max.js
1520   function max(values, valueof) {
1521     let max3;
1522     if (valueof === void 0) {
1523       for (const value of values) {
1524         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
1525           max3 = value;
1526         }
1527       }
1528     } else {
1529       let index = -1;
1530       for (let value of values) {
1531         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
1532           max3 = value;
1533         }
1534       }
1535     }
1536     return max3;
1537   }
1538   var init_max = __esm({
1539     "node_modules/d3-array/src/max.js"() {
1540     }
1541   });
1542
1543   // node_modules/d3-array/src/min.js
1544   function min(values, valueof) {
1545     let min3;
1546     if (valueof === void 0) {
1547       for (const value of values) {
1548         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
1549           min3 = value;
1550         }
1551       }
1552     } else {
1553       let index = -1;
1554       for (let value of values) {
1555         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
1556           min3 = value;
1557         }
1558       }
1559     }
1560     return min3;
1561   }
1562   var init_min = __esm({
1563     "node_modules/d3-array/src/min.js"() {
1564     }
1565   });
1566
1567   // node_modules/d3-array/src/quickselect.js
1568   function quickselect(array2, k3, left = 0, right = Infinity, compare2) {
1569     k3 = Math.floor(k3);
1570     left = Math.floor(Math.max(0, left));
1571     right = Math.floor(Math.min(array2.length - 1, right));
1572     if (!(left <= k3 && k3 <= right)) return array2;
1573     compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
1574     while (right > left) {
1575       if (right - left > 600) {
1576         const n3 = right - left + 1;
1577         const m3 = k3 - left + 1;
1578         const z3 = Math.log(n3);
1579         const s2 = 0.5 * Math.exp(2 * z3 / 3);
1580         const sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
1581         const newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
1582         const newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
1583         quickselect(array2, k3, newLeft, newRight, compare2);
1584       }
1585       const t2 = array2[k3];
1586       let i3 = left;
1587       let j3 = right;
1588       swap(array2, left, k3);
1589       if (compare2(array2[right], t2) > 0) swap(array2, left, right);
1590       while (i3 < j3) {
1591         swap(array2, i3, j3), ++i3, --j3;
1592         while (compare2(array2[i3], t2) < 0) ++i3;
1593         while (compare2(array2[j3], t2) > 0) --j3;
1594       }
1595       if (compare2(array2[left], t2) === 0) swap(array2, left, j3);
1596       else ++j3, swap(array2, j3, right);
1597       if (j3 <= k3) left = j3 + 1;
1598       if (k3 <= j3) right = j3 - 1;
1599     }
1600     return array2;
1601   }
1602   function swap(array2, i3, j3) {
1603     const t2 = array2[i3];
1604     array2[i3] = array2[j3];
1605     array2[j3] = t2;
1606   }
1607   var init_quickselect = __esm({
1608     "node_modules/d3-array/src/quickselect.js"() {
1609       init_sort();
1610     }
1611   });
1612
1613   // node_modules/d3-array/src/quantile.js
1614   function quantile(values, p2, valueof) {
1615     values = Float64Array.from(numbers(values, valueof));
1616     if (!(n3 = values.length) || isNaN(p2 = +p2)) return;
1617     if (p2 <= 0 || n3 < 2) return min(values);
1618     if (p2 >= 1) return max(values);
1619     var n3, i3 = (n3 - 1) * p2, i0 = Math.floor(i3), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
1620     return value0 + (value1 - value0) * (i3 - i0);
1621   }
1622   var init_quantile = __esm({
1623     "node_modules/d3-array/src/quantile.js"() {
1624       init_max();
1625       init_min();
1626       init_quickselect();
1627       init_number();
1628     }
1629   });
1630
1631   // node_modules/d3-array/src/median.js
1632   function median(values, valueof) {
1633     return quantile(values, 0.5, valueof);
1634   }
1635   var init_median = __esm({
1636     "node_modules/d3-array/src/median.js"() {
1637       init_quantile();
1638     }
1639   });
1640
1641   // node_modules/d3-array/src/merge.js
1642   function* flatten(arrays) {
1643     for (const array2 of arrays) {
1644       yield* array2;
1645     }
1646   }
1647   function merge(arrays) {
1648     return Array.from(flatten(arrays));
1649   }
1650   var init_merge = __esm({
1651     "node_modules/d3-array/src/merge.js"() {
1652     }
1653   });
1654
1655   // node_modules/d3-array/src/pairs.js
1656   function pairs(values, pairof = pair) {
1657     const pairs2 = [];
1658     let previous;
1659     let first = false;
1660     for (const value of values) {
1661       if (first) pairs2.push(pairof(previous, value));
1662       previous = value;
1663       first = true;
1664     }
1665     return pairs2;
1666   }
1667   function pair(a4, b3) {
1668     return [a4, b3];
1669   }
1670   var init_pairs = __esm({
1671     "node_modules/d3-array/src/pairs.js"() {
1672     }
1673   });
1674
1675   // node_modules/d3-array/src/range.js
1676   function range(start2, stop, step) {
1677     start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
1678     var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
1679     while (++i3 < n3) {
1680       range3[i3] = start2 + i3 * step;
1681     }
1682     return range3;
1683   }
1684   var init_range = __esm({
1685     "node_modules/d3-array/src/range.js"() {
1686     }
1687   });
1688
1689   // node_modules/d3-array/src/index.js
1690   var init_src = __esm({
1691     "node_modules/d3-array/src/index.js"() {
1692       init_bisect();
1693       init_ascending();
1694       init_bisector();
1695       init_descending();
1696       init_fsum();
1697       init_median();
1698       init_merge();
1699       init_pairs();
1700       init_range();
1701       init_ticks();
1702     }
1703   });
1704
1705   // node_modules/d3-geo/src/math.js
1706   function acos(x2) {
1707     return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
1708   }
1709   function asin(x2) {
1710     return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
1711   }
1712   var epsilon, epsilon2, pi, halfPi, quarterPi, tau, degrees, radians, abs, atan, atan2, cos, exp, log, sin, sign, sqrt, tan;
1713   var init_math = __esm({
1714     "node_modules/d3-geo/src/math.js"() {
1715       epsilon = 1e-6;
1716       epsilon2 = 1e-12;
1717       pi = Math.PI;
1718       halfPi = pi / 2;
1719       quarterPi = pi / 4;
1720       tau = pi * 2;
1721       degrees = 180 / pi;
1722       radians = pi / 180;
1723       abs = Math.abs;
1724       atan = Math.atan;
1725       atan2 = Math.atan2;
1726       cos = Math.cos;
1727       exp = Math.exp;
1728       log = Math.log;
1729       sin = Math.sin;
1730       sign = Math.sign || function(x2) {
1731         return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
1732       };
1733       sqrt = Math.sqrt;
1734       tan = Math.tan;
1735     }
1736   });
1737
1738   // node_modules/d3-geo/src/noop.js
1739   function noop() {
1740   }
1741   var init_noop = __esm({
1742     "node_modules/d3-geo/src/noop.js"() {
1743     }
1744   });
1745
1746   // node_modules/d3-geo/src/stream.js
1747   function streamGeometry(geometry, stream) {
1748     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
1749       streamGeometryType[geometry.type](geometry, stream);
1750     }
1751   }
1752   function streamLine(coordinates, stream, closed) {
1753     var i3 = -1, n3 = coordinates.length - closed, coordinate;
1754     stream.lineStart();
1755     while (++i3 < n3) coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
1756     stream.lineEnd();
1757   }
1758   function streamPolygon(coordinates, stream) {
1759     var i3 = -1, n3 = coordinates.length;
1760     stream.polygonStart();
1761     while (++i3 < n3) streamLine(coordinates[i3], stream, 1);
1762     stream.polygonEnd();
1763   }
1764   function stream_default(object, stream) {
1765     if (object && streamObjectType.hasOwnProperty(object.type)) {
1766       streamObjectType[object.type](object, stream);
1767     } else {
1768       streamGeometry(object, stream);
1769     }
1770   }
1771   var streamObjectType, streamGeometryType;
1772   var init_stream = __esm({
1773     "node_modules/d3-geo/src/stream.js"() {
1774       streamObjectType = {
1775         Feature: function(object, stream) {
1776           streamGeometry(object.geometry, stream);
1777         },
1778         FeatureCollection: function(object, stream) {
1779           var features = object.features, i3 = -1, n3 = features.length;
1780           while (++i3 < n3) streamGeometry(features[i3].geometry, stream);
1781         }
1782       };
1783       streamGeometryType = {
1784         Sphere: function(object, stream) {
1785           stream.sphere();
1786         },
1787         Point: function(object, stream) {
1788           object = object.coordinates;
1789           stream.point(object[0], object[1], object[2]);
1790         },
1791         MultiPoint: function(object, stream) {
1792           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1793           while (++i3 < n3) object = coordinates[i3], stream.point(object[0], object[1], object[2]);
1794         },
1795         LineString: function(object, stream) {
1796           streamLine(object.coordinates, stream, 0);
1797         },
1798         MultiLineString: function(object, stream) {
1799           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1800           while (++i3 < n3) streamLine(coordinates[i3], stream, 0);
1801         },
1802         Polygon: function(object, stream) {
1803           streamPolygon(object.coordinates, stream);
1804         },
1805         MultiPolygon: function(object, stream) {
1806           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1807           while (++i3 < n3) streamPolygon(coordinates[i3], stream);
1808         },
1809         GeometryCollection: function(object, stream) {
1810           var geometries = object.geometries, i3 = -1, n3 = geometries.length;
1811           while (++i3 < n3) streamGeometry(geometries[i3], stream);
1812         }
1813       };
1814     }
1815   });
1816
1817   // node_modules/d3-geo/src/area.js
1818   function areaRingStart() {
1819     areaStream.point = areaPointFirst;
1820   }
1821   function areaRingEnd() {
1822     areaPoint(lambda00, phi00);
1823   }
1824   function areaPointFirst(lambda, phi) {
1825     areaStream.point = areaPoint;
1826     lambda00 = lambda, phi00 = phi;
1827     lambda *= radians, phi *= radians;
1828     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
1829   }
1830   function areaPoint(lambda, phi) {
1831     lambda *= radians, phi *= radians;
1832     phi = phi / 2 + quarterPi;
1833     var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k3 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k3 * cos(adLambda), v3 = k3 * sdLambda * sin(adLambda);
1834     areaRingSum.add(atan2(v3, u2));
1835     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
1836   }
1837   function area_default(object) {
1838     areaSum = new Adder();
1839     stream_default(object, areaStream);
1840     return areaSum * 2;
1841   }
1842   var areaRingSum, areaSum, lambda00, phi00, lambda0, cosPhi0, sinPhi0, areaStream;
1843   var init_area = __esm({
1844     "node_modules/d3-geo/src/area.js"() {
1845       init_src();
1846       init_math();
1847       init_noop();
1848       init_stream();
1849       areaRingSum = new Adder();
1850       areaSum = new Adder();
1851       areaStream = {
1852         point: noop,
1853         lineStart: noop,
1854         lineEnd: noop,
1855         polygonStart: function() {
1856           areaRingSum = new Adder();
1857           areaStream.lineStart = areaRingStart;
1858           areaStream.lineEnd = areaRingEnd;
1859         },
1860         polygonEnd: function() {
1861           var areaRing = +areaRingSum;
1862           areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
1863           this.lineStart = this.lineEnd = this.point = noop;
1864         },
1865         sphere: function() {
1866           areaSum.add(tau);
1867         }
1868       };
1869     }
1870   });
1871
1872   // node_modules/d3-geo/src/cartesian.js
1873   function spherical(cartesian2) {
1874     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
1875   }
1876   function cartesian(spherical2) {
1877     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
1878     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
1879   }
1880   function cartesianDot(a4, b3) {
1881     return a4[0] * b3[0] + a4[1] * b3[1] + a4[2] * b3[2];
1882   }
1883   function cartesianCross(a4, b3) {
1884     return [a4[1] * b3[2] - a4[2] * b3[1], a4[2] * b3[0] - a4[0] * b3[2], a4[0] * b3[1] - a4[1] * b3[0]];
1885   }
1886   function cartesianAddInPlace(a4, b3) {
1887     a4[0] += b3[0], a4[1] += b3[1], a4[2] += b3[2];
1888   }
1889   function cartesianScale(vector, k3) {
1890     return [vector[0] * k3, vector[1] * k3, vector[2] * k3];
1891   }
1892   function cartesianNormalizeInPlace(d2) {
1893     var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
1894     d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
1895   }
1896   var init_cartesian = __esm({
1897     "node_modules/d3-geo/src/cartesian.js"() {
1898       init_math();
1899     }
1900   });
1901
1902   // node_modules/d3-geo/src/bounds.js
1903   function boundsPoint(lambda, phi) {
1904     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
1905     if (phi < phi0) phi0 = phi;
1906     if (phi > phi1) phi1 = phi;
1907   }
1908   function linePoint(lambda, phi) {
1909     var p2 = cartesian([lambda * radians, phi * radians]);
1910     if (p0) {
1911       var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
1912       cartesianNormalizeInPlace(inflection);
1913       inflection = spherical(inflection);
1914       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
1915       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
1916         phii = inflection[1] * degrees;
1917         if (phii > phi1) phi1 = phii;
1918       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
1919         phii = -inflection[1] * degrees;
1920         if (phii < phi0) phi0 = phii;
1921       } else {
1922         if (phi < phi0) phi0 = phi;
1923         if (phi > phi1) phi1 = phi;
1924       }
1925       if (antimeridian) {
1926         if (lambda < lambda2) {
1927           if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
1928         } else {
1929           if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
1930         }
1931       } else {
1932         if (lambda1 >= lambda02) {
1933           if (lambda < lambda02) lambda02 = lambda;
1934           if (lambda > lambda1) lambda1 = lambda;
1935         } else {
1936           if (lambda > lambda2) {
1937             if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
1938           } else {
1939             if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
1940           }
1941         }
1942       }
1943     } else {
1944       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
1945     }
1946     if (phi < phi0) phi0 = phi;
1947     if (phi > phi1) phi1 = phi;
1948     p0 = p2, lambda2 = lambda;
1949   }
1950   function boundsLineStart() {
1951     boundsStream.point = linePoint;
1952   }
1953   function boundsLineEnd() {
1954     range2[0] = lambda02, range2[1] = lambda1;
1955     boundsStream.point = boundsPoint;
1956     p0 = null;
1957   }
1958   function boundsRingPoint(lambda, phi) {
1959     if (p0) {
1960       var delta = lambda - lambda2;
1961       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
1962     } else {
1963       lambda002 = lambda, phi002 = phi;
1964     }
1965     areaStream.point(lambda, phi);
1966     linePoint(lambda, phi);
1967   }
1968   function boundsRingStart() {
1969     areaStream.lineStart();
1970   }
1971   function boundsRingEnd() {
1972     boundsRingPoint(lambda002, phi002);
1973     areaStream.lineEnd();
1974     if (abs(deltaSum) > epsilon) lambda02 = -(lambda1 = 180);
1975     range2[0] = lambda02, range2[1] = lambda1;
1976     p0 = null;
1977   }
1978   function angle(lambda04, lambda12) {
1979     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
1980   }
1981   function rangeCompare(a4, b3) {
1982     return a4[0] - b3[0];
1983   }
1984   function rangeContains(range3, x2) {
1985     return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
1986   }
1987   function bounds_default(feature3) {
1988     var i3, n3, a4, b3, merged, deltaMax, delta;
1989     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
1990     ranges = [];
1991     stream_default(feature3, boundsStream);
1992     if (n3 = ranges.length) {
1993       ranges.sort(rangeCompare);
1994       for (i3 = 1, a4 = ranges[0], merged = [a4]; i3 < n3; ++i3) {
1995         b3 = ranges[i3];
1996         if (rangeContains(a4, b3[0]) || rangeContains(a4, b3[1])) {
1997           if (angle(a4[0], b3[1]) > angle(a4[0], a4[1])) a4[1] = b3[1];
1998           if (angle(b3[0], a4[1]) > angle(a4[0], a4[1])) a4[0] = b3[0];
1999         } else {
2000           merged.push(a4 = b3);
2001         }
2002       }
2003       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a4 = merged[n3]; i3 <= n3; a4 = b3, ++i3) {
2004         b3 = merged[i3];
2005         if ((delta = angle(a4[1], b3[0])) > deltaMax) deltaMax = delta, lambda02 = b3[0], lambda1 = a4[1];
2006       }
2007     }
2008     ranges = range2 = null;
2009     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
2010   }
2011   var lambda02, phi0, lambda1, phi1, lambda2, lambda002, phi002, p0, deltaSum, ranges, range2, boundsStream;
2012   var init_bounds = __esm({
2013     "node_modules/d3-geo/src/bounds.js"() {
2014       init_src();
2015       init_area();
2016       init_cartesian();
2017       init_math();
2018       init_stream();
2019       boundsStream = {
2020         point: boundsPoint,
2021         lineStart: boundsLineStart,
2022         lineEnd: boundsLineEnd,
2023         polygonStart: function() {
2024           boundsStream.point = boundsRingPoint;
2025           boundsStream.lineStart = boundsRingStart;
2026           boundsStream.lineEnd = boundsRingEnd;
2027           deltaSum = new Adder();
2028           areaStream.polygonStart();
2029         },
2030         polygonEnd: function() {
2031           areaStream.polygonEnd();
2032           boundsStream.point = boundsPoint;
2033           boundsStream.lineStart = boundsLineStart;
2034           boundsStream.lineEnd = boundsLineEnd;
2035           if (areaRingSum < 0) lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
2036           else if (deltaSum > epsilon) phi1 = 90;
2037           else if (deltaSum < -epsilon) phi0 = -90;
2038           range2[0] = lambda02, range2[1] = lambda1;
2039         },
2040         sphere: function() {
2041           lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
2042         }
2043       };
2044     }
2045   });
2046
2047   // node_modules/d3-geo/src/compose.js
2048   function compose_default(a4, b3) {
2049     function compose(x2, y2) {
2050       return x2 = a4(x2, y2), b3(x2[0], x2[1]);
2051     }
2052     if (a4.invert && b3.invert) compose.invert = function(x2, y2) {
2053       return x2 = b3.invert(x2, y2), x2 && a4.invert(x2[0], x2[1]);
2054     };
2055     return compose;
2056   }
2057   var init_compose = __esm({
2058     "node_modules/d3-geo/src/compose.js"() {
2059     }
2060   });
2061
2062   // node_modules/d3-geo/src/rotation.js
2063   function rotationIdentity(lambda, phi) {
2064     if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
2065     return [lambda, phi];
2066   }
2067   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
2068     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
2069   }
2070   function forwardRotationLambda(deltaLambda) {
2071     return function(lambda, phi) {
2072       lambda += deltaLambda;
2073       if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
2074       return [lambda, phi];
2075     };
2076   }
2077   function rotationLambda(deltaLambda) {
2078     var rotation = forwardRotationLambda(deltaLambda);
2079     rotation.invert = forwardRotationLambda(-deltaLambda);
2080     return rotation;
2081   }
2082   function rotationPhiGamma(deltaPhi, deltaGamma) {
2083     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
2084     function rotation(lambda, phi) {
2085       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z3 = sin(phi), k3 = z3 * cosDeltaPhi + x2 * sinDeltaPhi;
2086       return [
2087         atan2(y2 * cosDeltaGamma - k3 * sinDeltaGamma, x2 * cosDeltaPhi - z3 * sinDeltaPhi),
2088         asin(k3 * cosDeltaGamma + y2 * sinDeltaGamma)
2089       ];
2090     }
2091     rotation.invert = function(lambda, phi) {
2092       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z3 = sin(phi), k3 = z3 * cosDeltaGamma - y2 * sinDeltaGamma;
2093       return [
2094         atan2(y2 * cosDeltaGamma + z3 * sinDeltaGamma, x2 * cosDeltaPhi + k3 * sinDeltaPhi),
2095         asin(k3 * cosDeltaPhi - x2 * sinDeltaPhi)
2096       ];
2097     };
2098     return rotation;
2099   }
2100   function rotation_default(rotate) {
2101     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
2102     function forward(coordinates) {
2103       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
2104       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
2105     }
2106     forward.invert = function(coordinates) {
2107       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
2108       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
2109     };
2110     return forward;
2111   }
2112   var init_rotation = __esm({
2113     "node_modules/d3-geo/src/rotation.js"() {
2114       init_compose();
2115       init_math();
2116       rotationIdentity.invert = rotationIdentity;
2117     }
2118   });
2119
2120   // node_modules/d3-geo/src/circle.js
2121   function circleStream(stream, radius, delta, direction, t02, t12) {
2122     if (!delta) return;
2123     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
2124     if (t02 == null) {
2125       t02 = radius + direction * tau;
2126       t12 = radius - step / 2;
2127     } else {
2128       t02 = circleRadius(cosRadius, t02);
2129       t12 = circleRadius(cosRadius, t12);
2130       if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau;
2131     }
2132     for (var point, t2 = t02; direction > 0 ? t2 > t12 : t2 < t12; t2 -= step) {
2133       point = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
2134       stream.point(point[0], point[1]);
2135     }
2136   }
2137   function circleRadius(cosRadius, point) {
2138     point = cartesian(point), point[0] -= cosRadius;
2139     cartesianNormalizeInPlace(point);
2140     var radius = acos(-point[1]);
2141     return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
2142   }
2143   var init_circle = __esm({
2144     "node_modules/d3-geo/src/circle.js"() {
2145       init_cartesian();
2146       init_math();
2147     }
2148   });
2149
2150   // node_modules/d3-geo/src/clip/buffer.js
2151   function buffer_default() {
2152     var lines = [], line;
2153     return {
2154       point: function(x2, y2, m3) {
2155         line.push([x2, y2, m3]);
2156       },
2157       lineStart: function() {
2158         lines.push(line = []);
2159       },
2160       lineEnd: noop,
2161       rejoin: function() {
2162         if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
2163       },
2164       result: function() {
2165         var result = lines;
2166         lines = [];
2167         line = null;
2168         return result;
2169       }
2170     };
2171   }
2172   var init_buffer = __esm({
2173     "node_modules/d3-geo/src/clip/buffer.js"() {
2174       init_noop();
2175     }
2176   });
2177
2178   // node_modules/d3-geo/src/pointEqual.js
2179   function pointEqual_default(a4, b3) {
2180     return abs(a4[0] - b3[0]) < epsilon && abs(a4[1] - b3[1]) < epsilon;
2181   }
2182   var init_pointEqual = __esm({
2183     "node_modules/d3-geo/src/pointEqual.js"() {
2184       init_math();
2185     }
2186   });
2187
2188   // node_modules/d3-geo/src/clip/rejoin.js
2189   function Intersection(point, points, other, entry) {
2190     this.x = point;
2191     this.z = points;
2192     this.o = other;
2193     this.e = entry;
2194     this.v = false;
2195     this.n = this.p = null;
2196   }
2197   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
2198     var subject = [], clip = [], i3, n3;
2199     segments.forEach(function(segment) {
2200       if ((n4 = segment.length - 1) <= 0) return;
2201       var n4, p02 = segment[0], p1 = segment[n4], x2;
2202       if (pointEqual_default(p02, p1)) {
2203         if (!p02[2] && !p1[2]) {
2204           stream.lineStart();
2205           for (i3 = 0; i3 < n4; ++i3) stream.point((p02 = segment[i3])[0], p02[1]);
2206           stream.lineEnd();
2207           return;
2208         }
2209         p1[0] += 2 * epsilon;
2210       }
2211       subject.push(x2 = new Intersection(p02, segment, null, true));
2212       clip.push(x2.o = new Intersection(p02, null, x2, false));
2213       subject.push(x2 = new Intersection(p1, segment, null, false));
2214       clip.push(x2.o = new Intersection(p1, null, x2, true));
2215     });
2216     if (!subject.length) return;
2217     clip.sort(compareIntersection2);
2218     link(subject);
2219     link(clip);
2220     for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
2221       clip[i3].e = startInside = !startInside;
2222     }
2223     var start2 = subject[0], points, point;
2224     while (1) {
2225       var current = start2, isSubject = true;
2226       while (current.v) if ((current = current.n) === start2) return;
2227       points = current.z;
2228       stream.lineStart();
2229       do {
2230         current.v = current.o.v = true;
2231         if (current.e) {
2232           if (isSubject) {
2233             for (i3 = 0, n3 = points.length; i3 < n3; ++i3) stream.point((point = points[i3])[0], point[1]);
2234           } else {
2235             interpolate(current.x, current.n.x, 1, stream);
2236           }
2237           current = current.n;
2238         } else {
2239           if (isSubject) {
2240             points = current.p.z;
2241             for (i3 = points.length - 1; i3 >= 0; --i3) stream.point((point = points[i3])[0], point[1]);
2242           } else {
2243             interpolate(current.x, current.p.x, -1, stream);
2244           }
2245           current = current.p;
2246         }
2247         current = current.o;
2248         points = current.z;
2249         isSubject = !isSubject;
2250       } while (!current.v);
2251       stream.lineEnd();
2252     }
2253   }
2254   function link(array2) {
2255     if (!(n3 = array2.length)) return;
2256     var n3, i3 = 0, a4 = array2[0], b3;
2257     while (++i3 < n3) {
2258       a4.n = b3 = array2[i3];
2259       b3.p = a4;
2260       a4 = b3;
2261     }
2262     a4.n = b3 = array2[0];
2263     b3.p = a4;
2264   }
2265   var init_rejoin = __esm({
2266     "node_modules/d3-geo/src/clip/rejoin.js"() {
2267       init_pointEqual();
2268       init_math();
2269     }
2270   });
2271
2272   // node_modules/d3-geo/src/polygonContains.js
2273   function longitude(point) {
2274     return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
2275   }
2276   function polygonContains_default(polygon2, point) {
2277     var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
2278     var sum = new Adder();
2279     if (sinPhi === 1) phi = halfPi + epsilon;
2280     else if (sinPhi === -1) phi = -halfPi - epsilon;
2281     for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
2282       if (!(m3 = (ring = polygon2[i3]).length)) continue;
2283       var ring, m3, point0 = ring[m3 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
2284       for (var j3 = 0; j3 < m3; ++j3, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
2285         var point1 = ring[j3], 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, k3 = sinPhi03 * sinPhi1;
2286         sum.add(atan2(k3 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k3 * cos(absDelta)));
2287         angle2 += antimeridian ? delta + sign2 * tau : delta;
2288         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
2289           var arc = cartesianCross(cartesian(point0), cartesian(point1));
2290           cartesianNormalizeInPlace(arc);
2291           var intersection2 = cartesianCross(normal, arc);
2292           cartesianNormalizeInPlace(intersection2);
2293           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection2[2]);
2294           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
2295             winding += antimeridian ^ delta >= 0 ? 1 : -1;
2296           }
2297         }
2298       }
2299     }
2300     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
2301   }
2302   var init_polygonContains = __esm({
2303     "node_modules/d3-geo/src/polygonContains.js"() {
2304       init_src();
2305       init_cartesian();
2306       init_math();
2307     }
2308   });
2309
2310   // node_modules/d3-geo/src/clip/index.js
2311   function clip_default(pointVisible, clipLine, interpolate, start2) {
2312     return function(sink) {
2313       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
2314       var clip = {
2315         point,
2316         lineStart,
2317         lineEnd,
2318         polygonStart: function() {
2319           clip.point = pointRing;
2320           clip.lineStart = ringStart;
2321           clip.lineEnd = ringEnd;
2322           segments = [];
2323           polygon2 = [];
2324         },
2325         polygonEnd: function() {
2326           clip.point = point;
2327           clip.lineStart = lineStart;
2328           clip.lineEnd = lineEnd;
2329           segments = merge(segments);
2330           var startInside = polygonContains_default(polygon2, start2);
2331           if (segments.length) {
2332             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2333             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
2334           } else if (startInside) {
2335             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2336             sink.lineStart();
2337             interpolate(null, null, 1, sink);
2338             sink.lineEnd();
2339           }
2340           if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
2341           segments = polygon2 = null;
2342         },
2343         sphere: function() {
2344           sink.polygonStart();
2345           sink.lineStart();
2346           interpolate(null, null, 1, sink);
2347           sink.lineEnd();
2348           sink.polygonEnd();
2349         }
2350       };
2351       function point(lambda, phi) {
2352         if (pointVisible(lambda, phi)) sink.point(lambda, phi);
2353       }
2354       function pointLine(lambda, phi) {
2355         line.point(lambda, phi);
2356       }
2357       function lineStart() {
2358         clip.point = pointLine;
2359         line.lineStart();
2360       }
2361       function lineEnd() {
2362         clip.point = point;
2363         line.lineEnd();
2364       }
2365       function pointRing(lambda, phi) {
2366         ring.push([lambda, phi]);
2367         ringSink.point(lambda, phi);
2368       }
2369       function ringStart() {
2370         ringSink.lineStart();
2371         ring = [];
2372       }
2373       function ringEnd() {
2374         pointRing(ring[0][0], ring[0][1]);
2375         ringSink.lineEnd();
2376         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m3, segment, point2;
2377         ring.pop();
2378         polygon2.push(ring);
2379         ring = null;
2380         if (!n3) return;
2381         if (clean2 & 1) {
2382           segment = ringSegments[0];
2383           if ((m3 = segment.length - 1) > 0) {
2384             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2385             sink.lineStart();
2386             for (i3 = 0; i3 < m3; ++i3) sink.point((point2 = segment[i3])[0], point2[1]);
2387             sink.lineEnd();
2388           }
2389           return;
2390         }
2391         if (n3 > 1 && clean2 & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
2392         segments.push(ringSegments.filter(validSegment));
2393       }
2394       return clip;
2395     };
2396   }
2397   function validSegment(segment) {
2398     return segment.length > 1;
2399   }
2400   function compareIntersection(a4, b3) {
2401     return ((a4 = a4.x)[0] < 0 ? a4[1] - halfPi - epsilon : halfPi - a4[1]) - ((b3 = b3.x)[0] < 0 ? b3[1] - halfPi - epsilon : halfPi - b3[1]);
2402   }
2403   var init_clip = __esm({
2404     "node_modules/d3-geo/src/clip/index.js"() {
2405       init_buffer();
2406       init_rejoin();
2407       init_math();
2408       init_polygonContains();
2409       init_src();
2410     }
2411   });
2412
2413   // node_modules/d3-geo/src/clip/antimeridian.js
2414   function clipAntimeridianLine(stream) {
2415     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
2416     return {
2417       lineStart: function() {
2418         stream.lineStart();
2419         clean2 = 1;
2420       },
2421       point: function(lambda12, phi12) {
2422         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
2423         if (abs(delta - pi) < epsilon) {
2424           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
2425           stream.point(sign0, phi02);
2426           stream.lineEnd();
2427           stream.lineStart();
2428           stream.point(sign1, phi02);
2429           stream.point(lambda12, phi02);
2430           clean2 = 0;
2431         } else if (sign0 !== sign1 && delta >= pi) {
2432           if (abs(lambda04 - sign0) < epsilon) lambda04 -= sign0 * epsilon;
2433           if (abs(lambda12 - sign1) < epsilon) lambda12 -= sign1 * epsilon;
2434           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
2435           stream.point(sign0, phi02);
2436           stream.lineEnd();
2437           stream.lineStart();
2438           stream.point(sign1, phi02);
2439           clean2 = 0;
2440         }
2441         stream.point(lambda04 = lambda12, phi02 = phi12);
2442         sign0 = sign1;
2443       },
2444       lineEnd: function() {
2445         stream.lineEnd();
2446         lambda04 = phi02 = NaN;
2447       },
2448       clean: function() {
2449         return 2 - clean2;
2450       }
2451     };
2452   }
2453   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
2454     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
2455     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;
2456   }
2457   function clipAntimeridianInterpolate(from, to, direction, stream) {
2458     var phi;
2459     if (from == null) {
2460       phi = direction * halfPi;
2461       stream.point(-pi, phi);
2462       stream.point(0, phi);
2463       stream.point(pi, phi);
2464       stream.point(pi, 0);
2465       stream.point(pi, -phi);
2466       stream.point(0, -phi);
2467       stream.point(-pi, -phi);
2468       stream.point(-pi, 0);
2469       stream.point(-pi, phi);
2470     } else if (abs(from[0] - to[0]) > epsilon) {
2471       var lambda = from[0] < to[0] ? pi : -pi;
2472       phi = direction * lambda / 2;
2473       stream.point(-lambda, phi);
2474       stream.point(0, phi);
2475       stream.point(lambda, phi);
2476     } else {
2477       stream.point(to[0], to[1]);
2478     }
2479   }
2480   var antimeridian_default;
2481   var init_antimeridian = __esm({
2482     "node_modules/d3-geo/src/clip/antimeridian.js"() {
2483       init_clip();
2484       init_math();
2485       antimeridian_default = clip_default(
2486         function() {
2487           return true;
2488         },
2489         clipAntimeridianLine,
2490         clipAntimeridianInterpolate,
2491         [-pi, -halfPi]
2492       );
2493     }
2494   });
2495
2496   // node_modules/d3-geo/src/clip/circle.js
2497   function circle_default(radius) {
2498     var cr = cos(radius), delta = 2 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
2499     function interpolate(from, to, direction, stream) {
2500       circleStream(stream, radius, delta, direction, from, to);
2501     }
2502     function visible(lambda, phi) {
2503       return cos(lambda) * cos(phi) > cr;
2504     }
2505     function clipLine(stream) {
2506       var point0, c0, v0, v00, clean2;
2507       return {
2508         lineStart: function() {
2509           v00 = v0 = false;
2510           clean2 = 1;
2511         },
2512         point: function(lambda, phi) {
2513           var point1 = [lambda, phi], point2, v3 = visible(lambda, phi), c2 = smallRadius ? v3 ? 0 : code(lambda, phi) : v3 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
2514           if (!point0 && (v00 = v0 = v3)) stream.lineStart();
2515           if (v3 !== v0) {
2516             point2 = intersect2(point0, point1);
2517             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
2518               point1[2] = 1;
2519           }
2520           if (v3 !== v0) {
2521             clean2 = 0;
2522             if (v3) {
2523               stream.lineStart();
2524               point2 = intersect2(point1, point0);
2525               stream.point(point2[0], point2[1]);
2526             } else {
2527               point2 = intersect2(point0, point1);
2528               stream.point(point2[0], point2[1], 2);
2529               stream.lineEnd();
2530             }
2531             point0 = point2;
2532           } else if (notHemisphere && point0 && smallRadius ^ v3) {
2533             var t2;
2534             if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
2535               clean2 = 0;
2536               if (smallRadius) {
2537                 stream.lineStart();
2538                 stream.point(t2[0][0], t2[0][1]);
2539                 stream.point(t2[1][0], t2[1][1]);
2540                 stream.lineEnd();
2541               } else {
2542                 stream.point(t2[1][0], t2[1][1]);
2543                 stream.lineEnd();
2544                 stream.lineStart();
2545                 stream.point(t2[0][0], t2[0][1], 3);
2546               }
2547             }
2548           }
2549           if (v3 && (!point0 || !pointEqual_default(point0, point1))) {
2550             stream.point(point1[0], point1[1]);
2551           }
2552           point0 = point1, v0 = v3, c0 = c2;
2553         },
2554         lineEnd: function() {
2555           if (v0) stream.lineEnd();
2556           point0 = null;
2557         },
2558         // Rejoin first and last segments if there were intersections and the first
2559         // and last points were visible.
2560         clean: function() {
2561           return clean2 | (v00 && v0) << 1;
2562         }
2563       };
2564     }
2565     function intersect2(a4, b3, two) {
2566       var pa = cartesian(a4), pb = cartesian(b3);
2567       var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
2568       if (!determinant) return !two && a4;
2569       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A3 = cartesianScale(n1, c1), B3 = cartesianScale(n22, c2);
2570       cartesianAddInPlace(A3, B3);
2571       var u2 = n1xn2, w3 = cartesianDot(A3, u2), uu = cartesianDot(u2, u2), t2 = w3 * w3 - uu * (cartesianDot(A3, A3) - 1);
2572       if (t2 < 0) return;
2573       var t3 = sqrt(t2), q3 = cartesianScale(u2, (-w3 - t3) / uu);
2574       cartesianAddInPlace(q3, A3);
2575       q3 = spherical(q3);
2576       if (!two) return q3;
2577       var lambda04 = a4[0], lambda12 = b3[0], phi02 = a4[1], phi12 = b3[1], z3;
2578       if (lambda12 < lambda04) z3 = lambda04, lambda04 = lambda12, lambda12 = z3;
2579       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
2580       if (!polar && phi12 < phi02) z3 = phi02, phi02 = phi12, phi12 = z3;
2581       if (meridian ? polar ? phi02 + phi12 > 0 ^ q3[1] < (abs(q3[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q3[1] && q3[1] <= phi12 : delta2 > pi ^ (lambda04 <= q3[0] && q3[0] <= lambda12)) {
2582         var q1 = cartesianScale(u2, (-w3 + t3) / uu);
2583         cartesianAddInPlace(q1, A3);
2584         return [q3, spherical(q1)];
2585       }
2586     }
2587     function code(lambda, phi) {
2588       var r2 = smallRadius ? radius : pi - radius, code2 = 0;
2589       if (lambda < -r2) code2 |= 1;
2590       else if (lambda > r2) code2 |= 2;
2591       if (phi < -r2) code2 |= 4;
2592       else if (phi > r2) code2 |= 8;
2593       return code2;
2594     }
2595     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
2596   }
2597   var init_circle2 = __esm({
2598     "node_modules/d3-geo/src/clip/circle.js"() {
2599       init_cartesian();
2600       init_circle();
2601       init_math();
2602       init_pointEqual();
2603       init_clip();
2604     }
2605   });
2606
2607   // node_modules/d3-geo/src/clip/line.js
2608   function line_default(a4, b3, x05, y05, x12, y12) {
2609     var ax = a4[0], ay = a4[1], bx = b3[0], by = b3[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r2;
2610     r2 = x05 - ax;
2611     if (!dx && r2 > 0) return;
2612     r2 /= dx;
2613     if (dx < 0) {
2614       if (r2 < t02) return;
2615       if (r2 < t12) t12 = r2;
2616     } else if (dx > 0) {
2617       if (r2 > t12) return;
2618       if (r2 > t02) t02 = r2;
2619     }
2620     r2 = x12 - ax;
2621     if (!dx && r2 < 0) return;
2622     r2 /= dx;
2623     if (dx < 0) {
2624       if (r2 > t12) return;
2625       if (r2 > t02) t02 = r2;
2626     } else if (dx > 0) {
2627       if (r2 < t02) return;
2628       if (r2 < t12) t12 = r2;
2629     }
2630     r2 = y05 - ay;
2631     if (!dy && r2 > 0) return;
2632     r2 /= dy;
2633     if (dy < 0) {
2634       if (r2 < t02) return;
2635       if (r2 < t12) t12 = r2;
2636     } else if (dy > 0) {
2637       if (r2 > t12) return;
2638       if (r2 > t02) t02 = r2;
2639     }
2640     r2 = y12 - ay;
2641     if (!dy && r2 < 0) return;
2642     r2 /= dy;
2643     if (dy < 0) {
2644       if (r2 > t12) return;
2645       if (r2 > t02) t02 = r2;
2646     } else if (dy > 0) {
2647       if (r2 < t02) return;
2648       if (r2 < t12) t12 = r2;
2649     }
2650     if (t02 > 0) a4[0] = ax + t02 * dx, a4[1] = ay + t02 * dy;
2651     if (t12 < 1) b3[0] = ax + t12 * dx, b3[1] = ay + t12 * dy;
2652     return true;
2653   }
2654   var init_line = __esm({
2655     "node_modules/d3-geo/src/clip/line.js"() {
2656     }
2657   });
2658
2659   // node_modules/d3-geo/src/clip/rectangle.js
2660   function clipRectangle(x05, y05, x12, y12) {
2661     function visible(x2, y2) {
2662       return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
2663     }
2664     function interpolate(from, to, direction, stream) {
2665       var a4 = 0, a1 = 0;
2666       if (from == null || (a4 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
2667         do
2668           stream.point(a4 === 0 || a4 === 3 ? x05 : x12, a4 > 1 ? y12 : y05);
2669         while ((a4 = (a4 + direction + 4) % 4) !== a1);
2670       } else {
2671         stream.point(to[0], to[1]);
2672       }
2673     }
2674     function corner(p2, direction) {
2675       return abs(p2[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p2[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p2[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
2676     }
2677     function compareIntersection2(a4, b3) {
2678       return comparePoint(a4.x, b3.x);
2679     }
2680     function comparePoint(a4, b3) {
2681       var ca = corner(a4, 1), cb = corner(b3, 1);
2682       return ca !== cb ? ca - cb : ca === 0 ? b3[1] - a4[1] : ca === 1 ? a4[0] - b3[0] : ca === 2 ? a4[1] - b3[1] : b3[0] - a4[0];
2683     }
2684     return function(stream) {
2685       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
2686       var clipStream = {
2687         point,
2688         lineStart,
2689         lineEnd,
2690         polygonStart,
2691         polygonEnd
2692       };
2693       function point(x2, y2) {
2694         if (visible(x2, y2)) activeStream.point(x2, y2);
2695       }
2696       function polygonInside() {
2697         var winding = 0;
2698         for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
2699           for (var ring2 = polygon2[i3], j3 = 1, m3 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j3 < m3; ++j3) {
2700             a0 = b0, a1 = b1, point2 = ring2[j3], b0 = point2[0], b1 = point2[1];
2701             if (a1 <= y12) {
2702               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0)) ++winding;
2703             } else {
2704               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0)) --winding;
2705             }
2706           }
2707         }
2708         return winding;
2709       }
2710       function polygonStart() {
2711         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
2712       }
2713       function polygonEnd() {
2714         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
2715         if (cleanInside || visible2) {
2716           stream.polygonStart();
2717           if (cleanInside) {
2718             stream.lineStart();
2719             interpolate(null, null, 1, stream);
2720             stream.lineEnd();
2721           }
2722           if (visible2) {
2723             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
2724           }
2725           stream.polygonEnd();
2726         }
2727         activeStream = stream, segments = polygon2 = ring = null;
2728       }
2729       function lineStart() {
2730         clipStream.point = linePoint2;
2731         if (polygon2) polygon2.push(ring = []);
2732         first = true;
2733         v_ = false;
2734         x_ = y_ = NaN;
2735       }
2736       function lineEnd() {
2737         if (segments) {
2738           linePoint2(x__, y__);
2739           if (v__ && v_) bufferStream.rejoin();
2740           segments.push(bufferStream.result());
2741         }
2742         clipStream.point = point;
2743         if (v_) activeStream.lineEnd();
2744       }
2745       function linePoint2(x2, y2) {
2746         var v3 = visible(x2, y2);
2747         if (polygon2) ring.push([x2, y2]);
2748         if (first) {
2749           x__ = x2, y__ = y2, v__ = v3;
2750           first = false;
2751           if (v3) {
2752             activeStream.lineStart();
2753             activeStream.point(x2, y2);
2754           }
2755         } else {
2756           if (v3 && v_) activeStream.point(x2, y2);
2757           else {
2758             var a4 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b3 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
2759             if (line_default(a4, b3, x05, y05, x12, y12)) {
2760               if (!v_) {
2761                 activeStream.lineStart();
2762                 activeStream.point(a4[0], a4[1]);
2763               }
2764               activeStream.point(b3[0], b3[1]);
2765               if (!v3) activeStream.lineEnd();
2766               clean2 = false;
2767             } else if (v3) {
2768               activeStream.lineStart();
2769               activeStream.point(x2, y2);
2770               clean2 = false;
2771             }
2772           }
2773         }
2774         x_ = x2, y_ = y2, v_ = v3;
2775       }
2776       return clipStream;
2777     };
2778   }
2779   var clipMax, clipMin;
2780   var init_rectangle = __esm({
2781     "node_modules/d3-geo/src/clip/rectangle.js"() {
2782       init_math();
2783       init_buffer();
2784       init_line();
2785       init_rejoin();
2786       init_src();
2787       clipMax = 1e9;
2788       clipMin = -clipMax;
2789     }
2790   });
2791
2792   // node_modules/d3-geo/src/length.js
2793   function lengthLineStart() {
2794     lengthStream.point = lengthPointFirst;
2795     lengthStream.lineEnd = lengthLineEnd;
2796   }
2797   function lengthLineEnd() {
2798     lengthStream.point = lengthStream.lineEnd = noop;
2799   }
2800   function lengthPointFirst(lambda, phi) {
2801     lambda *= radians, phi *= radians;
2802     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
2803     lengthStream.point = lengthPoint;
2804   }
2805   function lengthPoint(lambda, phi) {
2806     lambda *= radians, phi *= radians;
2807     var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x2 = cosPhi * sinDelta, y2 = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z3 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
2808     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z3));
2809     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
2810   }
2811   function length_default(object) {
2812     lengthSum = new Adder();
2813     stream_default(object, lengthStream);
2814     return +lengthSum;
2815   }
2816   var lengthSum, lambda03, sinPhi02, cosPhi02, lengthStream;
2817   var init_length = __esm({
2818     "node_modules/d3-geo/src/length.js"() {
2819       init_src();
2820       init_math();
2821       init_noop();
2822       init_stream();
2823       lengthStream = {
2824         sphere: noop,
2825         point: noop,
2826         lineStart: lengthLineStart,
2827         lineEnd: noop,
2828         polygonStart: noop,
2829         polygonEnd: noop
2830       };
2831     }
2832   });
2833
2834   // node_modules/d3-geo/src/identity.js
2835   var identity_default;
2836   var init_identity = __esm({
2837     "node_modules/d3-geo/src/identity.js"() {
2838       identity_default = (x2) => x2;
2839     }
2840   });
2841
2842   // node_modules/d3-geo/src/path/area.js
2843   function areaRingStart2() {
2844     areaStream2.point = areaPointFirst2;
2845   }
2846   function areaPointFirst2(x2, y2) {
2847     areaStream2.point = areaPoint2;
2848     x00 = x0 = x2, y00 = y0 = y2;
2849   }
2850   function areaPoint2(x2, y2) {
2851     areaRingSum2.add(y0 * x2 - x0 * y2);
2852     x0 = x2, y0 = y2;
2853   }
2854   function areaRingEnd2() {
2855     areaPoint2(x00, y00);
2856   }
2857   var areaSum2, areaRingSum2, x00, y00, x0, y0, areaStream2, area_default2;
2858   var init_area2 = __esm({
2859     "node_modules/d3-geo/src/path/area.js"() {
2860       init_src();
2861       init_math();
2862       init_noop();
2863       areaSum2 = new Adder();
2864       areaRingSum2 = new Adder();
2865       areaStream2 = {
2866         point: noop,
2867         lineStart: noop,
2868         lineEnd: noop,
2869         polygonStart: function() {
2870           areaStream2.lineStart = areaRingStart2;
2871           areaStream2.lineEnd = areaRingEnd2;
2872         },
2873         polygonEnd: function() {
2874           areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
2875           areaSum2.add(abs(areaRingSum2));
2876           areaRingSum2 = new Adder();
2877         },
2878         result: function() {
2879           var area = areaSum2 / 2;
2880           areaSum2 = new Adder();
2881           return area;
2882         }
2883       };
2884       area_default2 = areaStream2;
2885     }
2886   });
2887
2888   // node_modules/d3-geo/src/path/bounds.js
2889   function boundsPoint2(x2, y2) {
2890     if (x2 < x02) x02 = x2;
2891     if (x2 > x1) x1 = x2;
2892     if (y2 < y02) y02 = y2;
2893     if (y2 > y1) y1 = y2;
2894   }
2895   var x02, y02, x1, y1, boundsStream2, bounds_default2;
2896   var init_bounds2 = __esm({
2897     "node_modules/d3-geo/src/path/bounds.js"() {
2898       init_noop();
2899       x02 = Infinity;
2900       y02 = x02;
2901       x1 = -x02;
2902       y1 = x1;
2903       boundsStream2 = {
2904         point: boundsPoint2,
2905         lineStart: noop,
2906         lineEnd: noop,
2907         polygonStart: noop,
2908         polygonEnd: noop,
2909         result: function() {
2910           var bounds = [[x02, y02], [x1, y1]];
2911           x1 = y1 = -(y02 = x02 = Infinity);
2912           return bounds;
2913         }
2914       };
2915       bounds_default2 = boundsStream2;
2916     }
2917   });
2918
2919   // node_modules/d3-geo/src/path/centroid.js
2920   function centroidPoint(x2, y2) {
2921     X0 += x2;
2922     Y0 += y2;
2923     ++Z0;
2924   }
2925   function centroidLineStart() {
2926     centroidStream.point = centroidPointFirstLine;
2927   }
2928   function centroidPointFirstLine(x2, y2) {
2929     centroidStream.point = centroidPointLine;
2930     centroidPoint(x03 = x2, y03 = y2);
2931   }
2932   function centroidPointLine(x2, y2) {
2933     var dx = x2 - x03, dy = y2 - y03, z3 = sqrt(dx * dx + dy * dy);
2934     X1 += z3 * (x03 + x2) / 2;
2935     Y1 += z3 * (y03 + y2) / 2;
2936     Z1 += z3;
2937     centroidPoint(x03 = x2, y03 = y2);
2938   }
2939   function centroidLineEnd() {
2940     centroidStream.point = centroidPoint;
2941   }
2942   function centroidRingStart() {
2943     centroidStream.point = centroidPointFirstRing;
2944   }
2945   function centroidRingEnd() {
2946     centroidPointRing(x002, y002);
2947   }
2948   function centroidPointFirstRing(x2, y2) {
2949     centroidStream.point = centroidPointRing;
2950     centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
2951   }
2952   function centroidPointRing(x2, y2) {
2953     var dx = x2 - x03, dy = y2 - y03, z3 = sqrt(dx * dx + dy * dy);
2954     X1 += z3 * (x03 + x2) / 2;
2955     Y1 += z3 * (y03 + y2) / 2;
2956     Z1 += z3;
2957     z3 = y03 * x2 - x03 * y2;
2958     X2 += z3 * (x03 + x2);
2959     Y2 += z3 * (y03 + y2);
2960     Z2 += z3 * 3;
2961     centroidPoint(x03 = x2, y03 = y2);
2962   }
2963   var X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, x002, y002, x03, y03, centroidStream, centroid_default;
2964   var init_centroid = __esm({
2965     "node_modules/d3-geo/src/path/centroid.js"() {
2966       init_math();
2967       X0 = 0;
2968       Y0 = 0;
2969       Z0 = 0;
2970       X1 = 0;
2971       Y1 = 0;
2972       Z1 = 0;
2973       X2 = 0;
2974       Y2 = 0;
2975       Z2 = 0;
2976       centroidStream = {
2977         point: centroidPoint,
2978         lineStart: centroidLineStart,
2979         lineEnd: centroidLineEnd,
2980         polygonStart: function() {
2981           centroidStream.lineStart = centroidRingStart;
2982           centroidStream.lineEnd = centroidRingEnd;
2983         },
2984         polygonEnd: function() {
2985           centroidStream.point = centroidPoint;
2986           centroidStream.lineStart = centroidLineStart;
2987           centroidStream.lineEnd = centroidLineEnd;
2988         },
2989         result: function() {
2990           var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
2991           X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
2992           return centroid;
2993         }
2994       };
2995       centroid_default = centroidStream;
2996     }
2997   });
2998
2999   // node_modules/d3-geo/src/path/context.js
3000   function PathContext(context) {
3001     this._context = context;
3002   }
3003   var init_context = __esm({
3004     "node_modules/d3-geo/src/path/context.js"() {
3005       init_math();
3006       init_noop();
3007       PathContext.prototype = {
3008         _radius: 4.5,
3009         pointRadius: function(_3) {
3010           return this._radius = _3, this;
3011         },
3012         polygonStart: function() {
3013           this._line = 0;
3014         },
3015         polygonEnd: function() {
3016           this._line = NaN;
3017         },
3018         lineStart: function() {
3019           this._point = 0;
3020         },
3021         lineEnd: function() {
3022           if (this._line === 0) this._context.closePath();
3023           this._point = NaN;
3024         },
3025         point: function(x2, y2) {
3026           switch (this._point) {
3027             case 0: {
3028               this._context.moveTo(x2, y2);
3029               this._point = 1;
3030               break;
3031             }
3032             case 1: {
3033               this._context.lineTo(x2, y2);
3034               break;
3035             }
3036             default: {
3037               this._context.moveTo(x2 + this._radius, y2);
3038               this._context.arc(x2, y2, this._radius, 0, tau);
3039               break;
3040             }
3041           }
3042         },
3043         result: noop
3044       };
3045     }
3046   });
3047
3048   // node_modules/d3-geo/src/path/measure.js
3049   function lengthPointFirst2(x2, y2) {
3050     lengthStream2.point = lengthPoint2;
3051     x003 = x04 = x2, y003 = y04 = y2;
3052   }
3053   function lengthPoint2(x2, y2) {
3054     x04 -= x2, y04 -= y2;
3055     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
3056     x04 = x2, y04 = y2;
3057   }
3058   var lengthSum2, lengthRing, x003, y003, x04, y04, lengthStream2, measure_default;
3059   var init_measure = __esm({
3060     "node_modules/d3-geo/src/path/measure.js"() {
3061       init_src();
3062       init_math();
3063       init_noop();
3064       lengthSum2 = new Adder();
3065       lengthStream2 = {
3066         point: noop,
3067         lineStart: function() {
3068           lengthStream2.point = lengthPointFirst2;
3069         },
3070         lineEnd: function() {
3071           if (lengthRing) lengthPoint2(x003, y003);
3072           lengthStream2.point = noop;
3073         },
3074         polygonStart: function() {
3075           lengthRing = true;
3076         },
3077         polygonEnd: function() {
3078           lengthRing = null;
3079         },
3080         result: function() {
3081           var length2 = +lengthSum2;
3082           lengthSum2 = new Adder();
3083           return length2;
3084         }
3085       };
3086       measure_default = lengthStream2;
3087     }
3088   });
3089
3090   // node_modules/d3-geo/src/path/string.js
3091   function append(strings) {
3092     let i3 = 1;
3093     this._ += strings[0];
3094     for (const j3 = strings.length; i3 < j3; ++i3) {
3095       this._ += arguments[i3] + strings[i3];
3096     }
3097   }
3098   function appendRound(digits) {
3099     const d2 = Math.floor(digits);
3100     if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${digits}`);
3101     if (d2 > 15) return append;
3102     if (d2 !== cacheDigits) {
3103       const k3 = 10 ** d2;
3104       cacheDigits = d2;
3105       cacheAppend = function append2(strings) {
3106         let i3 = 1;
3107         this._ += strings[0];
3108         for (const j3 = strings.length; i3 < j3; ++i3) {
3109           this._ += Math.round(arguments[i3] * k3) / k3 + strings[i3];
3110         }
3111       };
3112     }
3113     return cacheAppend;
3114   }
3115   var cacheDigits, cacheAppend, cacheRadius, cacheCircle, PathString;
3116   var init_string = __esm({
3117     "node_modules/d3-geo/src/path/string.js"() {
3118       PathString = class {
3119         constructor(digits) {
3120           this._append = digits == null ? append : appendRound(digits);
3121           this._radius = 4.5;
3122           this._ = "";
3123         }
3124         pointRadius(_3) {
3125           this._radius = +_3;
3126           return this;
3127         }
3128         polygonStart() {
3129           this._line = 0;
3130         }
3131         polygonEnd() {
3132           this._line = NaN;
3133         }
3134         lineStart() {
3135           this._point = 0;
3136         }
3137         lineEnd() {
3138           if (this._line === 0) this._ += "Z";
3139           this._point = NaN;
3140         }
3141         point(x2, y2) {
3142           switch (this._point) {
3143             case 0: {
3144               this._append`M${x2},${y2}`;
3145               this._point = 1;
3146               break;
3147             }
3148             case 1: {
3149               this._append`L${x2},${y2}`;
3150               break;
3151             }
3152             default: {
3153               this._append`M${x2},${y2}`;
3154               if (this._radius !== cacheRadius || this._append !== cacheAppend) {
3155                 const r2 = this._radius;
3156                 const s2 = this._;
3157                 this._ = "";
3158                 this._append`m0,${r2}a${r2},${r2} 0 1,1 0,${-2 * r2}a${r2},${r2} 0 1,1 0,${2 * r2}z`;
3159                 cacheRadius = r2;
3160                 cacheAppend = this._append;
3161                 cacheCircle = this._;
3162                 this._ = s2;
3163               }
3164               this._ += cacheCircle;
3165               break;
3166             }
3167           }
3168         }
3169         result() {
3170           const result = this._;
3171           this._ = "";
3172           return result.length ? result : null;
3173         }
3174       };
3175     }
3176   });
3177
3178   // node_modules/d3-geo/src/path/index.js
3179   function path_default(projection2, context) {
3180     let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
3181     function path(object) {
3182       if (object) {
3183         if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
3184         stream_default(object, projectionStream(contextStream));
3185       }
3186       return contextStream.result();
3187     }
3188     path.area = function(object) {
3189       stream_default(object, projectionStream(area_default2));
3190       return area_default2.result();
3191     };
3192     path.measure = function(object) {
3193       stream_default(object, projectionStream(measure_default));
3194       return measure_default.result();
3195     };
3196     path.bounds = function(object) {
3197       stream_default(object, projectionStream(bounds_default2));
3198       return bounds_default2.result();
3199     };
3200     path.centroid = function(object) {
3201       stream_default(object, projectionStream(centroid_default));
3202       return centroid_default.result();
3203     };
3204     path.projection = function(_3) {
3205       if (!arguments.length) return projection2;
3206       projectionStream = _3 == null ? (projection2 = null, identity_default) : (projection2 = _3).stream;
3207       return path;
3208     };
3209     path.context = function(_3) {
3210       if (!arguments.length) return context;
3211       contextStream = _3 == null ? (context = null, new PathString(digits)) : new PathContext(context = _3);
3212       if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
3213       return path;
3214     };
3215     path.pointRadius = function(_3) {
3216       if (!arguments.length) return pointRadius;
3217       pointRadius = typeof _3 === "function" ? _3 : (contextStream.pointRadius(+_3), +_3);
3218       return path;
3219     };
3220     path.digits = function(_3) {
3221       if (!arguments.length) return digits;
3222       if (_3 == null) digits = null;
3223       else {
3224         const d2 = Math.floor(_3);
3225         if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_3}`);
3226         digits = d2;
3227       }
3228       if (context === null) contextStream = new PathString(digits);
3229       return path;
3230     };
3231     return path.projection(projection2).digits(digits).context(context);
3232   }
3233   var init_path = __esm({
3234     "node_modules/d3-geo/src/path/index.js"() {
3235       init_identity();
3236       init_stream();
3237       init_area2();
3238       init_bounds2();
3239       init_centroid();
3240       init_context();
3241       init_measure();
3242       init_string();
3243     }
3244   });
3245
3246   // node_modules/d3-geo/src/transform.js
3247   function transform_default(methods2) {
3248     return {
3249       stream: transformer(methods2)
3250     };
3251   }
3252   function transformer(methods2) {
3253     return function(stream) {
3254       var s2 = new TransformStream();
3255       for (var key in methods2) s2[key] = methods2[key];
3256       s2.stream = stream;
3257       return s2;
3258     };
3259   }
3260   function TransformStream() {
3261   }
3262   var init_transform = __esm({
3263     "node_modules/d3-geo/src/transform.js"() {
3264       TransformStream.prototype = {
3265         constructor: TransformStream,
3266         point: function(x2, y2) {
3267           this.stream.point(x2, y2);
3268         },
3269         sphere: function() {
3270           this.stream.sphere();
3271         },
3272         lineStart: function() {
3273           this.stream.lineStart();
3274         },
3275         lineEnd: function() {
3276           this.stream.lineEnd();
3277         },
3278         polygonStart: function() {
3279           this.stream.polygonStart();
3280         },
3281         polygonEnd: function() {
3282           this.stream.polygonEnd();
3283         }
3284       };
3285     }
3286   });
3287
3288   // node_modules/d3-geo/src/projection/fit.js
3289   function fit(projection2, fitBounds, object) {
3290     var clip = projection2.clipExtent && projection2.clipExtent();
3291     projection2.scale(150).translate([0, 0]);
3292     if (clip != null) projection2.clipExtent(null);
3293     stream_default(object, projection2.stream(bounds_default2));
3294     fitBounds(bounds_default2.result());
3295     if (clip != null) projection2.clipExtent(clip);
3296     return projection2;
3297   }
3298   function fitExtent(projection2, extent, object) {
3299     return fit(projection2, function(b3) {
3300       var w3 = extent[1][0] - extent[0][0], h3 = extent[1][1] - extent[0][1], k3 = Math.min(w3 / (b3[1][0] - b3[0][0]), h3 / (b3[1][1] - b3[0][1])), x2 = +extent[0][0] + (w3 - k3 * (b3[1][0] + b3[0][0])) / 2, y2 = +extent[0][1] + (h3 - k3 * (b3[1][1] + b3[0][1])) / 2;
3301       projection2.scale(150 * k3).translate([x2, y2]);
3302     }, object);
3303   }
3304   function fitSize(projection2, size, object) {
3305     return fitExtent(projection2, [[0, 0], size], object);
3306   }
3307   function fitWidth(projection2, width, object) {
3308     return fit(projection2, function(b3) {
3309       var w3 = +width, k3 = w3 / (b3[1][0] - b3[0][0]), x2 = (w3 - k3 * (b3[1][0] + b3[0][0])) / 2, y2 = -k3 * b3[0][1];
3310       projection2.scale(150 * k3).translate([x2, y2]);
3311     }, object);
3312   }
3313   function fitHeight(projection2, height, object) {
3314     return fit(projection2, function(b3) {
3315       var h3 = +height, k3 = h3 / (b3[1][1] - b3[0][1]), x2 = -k3 * b3[0][0], y2 = (h3 - k3 * (b3[1][1] + b3[0][1])) / 2;
3316       projection2.scale(150 * k3).translate([x2, y2]);
3317     }, object);
3318   }
3319   var init_fit = __esm({
3320     "node_modules/d3-geo/src/projection/fit.js"() {
3321       init_stream();
3322       init_bounds2();
3323     }
3324   });
3325
3326   // node_modules/d3-geo/src/projection/resample.js
3327   function resample_default(project, delta2) {
3328     return +delta2 ? resample(project, delta2) : resampleNone(project);
3329   }
3330   function resampleNone(project) {
3331     return transformer({
3332       point: function(x2, y2) {
3333         x2 = project(x2, y2);
3334         this.stream.point(x2[0], x2[1]);
3335       }
3336     });
3337   }
3338   function resample(project, delta2) {
3339     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
3340       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
3341       if (d2 > 4 * delta2 && depth--) {
3342         var a4 = a0 + a1, b3 = b0 + b1, c2 = c0 + c1, m3 = sqrt(a4 * a4 + b3 * b3 + c2 * c2), phi2 = asin(c2 /= m3), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b3, a4), p2 = project(lambda22, phi2), x2 = p2[0], y2 = p2[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
3343         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
3344           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a4 /= m3, b3 /= m3, c2, depth, stream);
3345           stream.point(x2, y2);
3346           resampleLineTo(x2, y2, lambda22, a4, b3, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
3347         }
3348       }
3349     }
3350     return function(stream) {
3351       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
3352       var resampleStream = {
3353         point,
3354         lineStart,
3355         lineEnd,
3356         polygonStart: function() {
3357           stream.polygonStart();
3358           resampleStream.lineStart = ringStart;
3359         },
3360         polygonEnd: function() {
3361           stream.polygonEnd();
3362           resampleStream.lineStart = lineStart;
3363         }
3364       };
3365       function point(x2, y2) {
3366         x2 = project(x2, y2);
3367         stream.point(x2[0], x2[1]);
3368       }
3369       function lineStart() {
3370         x05 = NaN;
3371         resampleStream.point = linePoint2;
3372         stream.lineStart();
3373       }
3374       function linePoint2(lambda, phi) {
3375         var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
3376         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p2[0], y05 = p2[1], lambda04 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream);
3377         stream.point(x05, y05);
3378       }
3379       function lineEnd() {
3380         resampleStream.point = point;
3381         stream.lineEnd();
3382       }
3383       function ringStart() {
3384         lineStart();
3385         resampleStream.point = ringPoint;
3386         resampleStream.lineEnd = ringEnd;
3387       }
3388       function ringPoint(lambda, phi) {
3389         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
3390         resampleStream.point = linePoint2;
3391       }
3392       function ringEnd() {
3393         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
3394         resampleStream.lineEnd = lineEnd;
3395         lineEnd();
3396       }
3397       return resampleStream;
3398     };
3399   }
3400   var maxDepth, cosMinDistance;
3401   var init_resample = __esm({
3402     "node_modules/d3-geo/src/projection/resample.js"() {
3403       init_cartesian();
3404       init_math();
3405       init_transform();
3406       maxDepth = 16;
3407       cosMinDistance = cos(30 * radians);
3408     }
3409   });
3410
3411   // node_modules/d3-geo/src/projection/index.js
3412   function transformRotate(rotate) {
3413     return transformer({
3414       point: function(x2, y2) {
3415         var r2 = rotate(x2, y2);
3416         return this.stream.point(r2[0], r2[1]);
3417       }
3418     });
3419   }
3420   function scaleTranslate(k3, dx, dy, sx, sy) {
3421     function transform2(x2, y2) {
3422       x2 *= sx;
3423       y2 *= sy;
3424       return [dx + k3 * x2, dy - k3 * y2];
3425     }
3426     transform2.invert = function(x2, y2) {
3427       return [(x2 - dx) / k3 * sx, (dy - y2) / k3 * sy];
3428     };
3429     return transform2;
3430   }
3431   function scaleTranslateRotate(k3, dx, dy, sx, sy, alpha) {
3432     if (!alpha) return scaleTranslate(k3, dx, dy, sx, sy);
3433     var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a4 = cosAlpha * k3, b3 = sinAlpha * k3, ai = cosAlpha / k3, bi = sinAlpha / k3, ci = (sinAlpha * dy - cosAlpha * dx) / k3, fi = (sinAlpha * dx + cosAlpha * dy) / k3;
3434     function transform2(x2, y2) {
3435       x2 *= sx;
3436       y2 *= sy;
3437       return [a4 * x2 - b3 * y2 + dx, dy - b3 * x2 - a4 * y2];
3438     }
3439     transform2.invert = function(x2, y2) {
3440       return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
3441     };
3442     return transform2;
3443   }
3444   function projection(project) {
3445     return projectionMutator(function() {
3446       return project;
3447     })();
3448   }
3449   function projectionMutator(projectAt) {
3450     var project, k3 = 150, x2 = 480, y2 = 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;
3451     function projection2(point) {
3452       return projectRotateTransform(point[0] * radians, point[1] * radians);
3453     }
3454     function invert(point) {
3455       point = projectRotateTransform.invert(point[0], point[1]);
3456       return point && [point[0] * degrees, point[1] * degrees];
3457     }
3458     projection2.stream = function(stream) {
3459       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
3460     };
3461     projection2.preclip = function(_3) {
3462       return arguments.length ? (preclip = _3, theta = void 0, reset()) : preclip;
3463     };
3464     projection2.postclip = function(_3) {
3465       return arguments.length ? (postclip = _3, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3466     };
3467     projection2.clipAngle = function(_3) {
3468       return arguments.length ? (preclip = +_3 ? circle_default(theta = _3 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
3469     };
3470     projection2.clipExtent = function(_3) {
3471       return arguments.length ? (postclip = _3 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3472     };
3473     projection2.scale = function(_3) {
3474       return arguments.length ? (k3 = +_3, recenter()) : k3;
3475     };
3476     projection2.translate = function(_3) {
3477       return arguments.length ? (x2 = +_3[0], y2 = +_3[1], recenter()) : [x2, y2];
3478     };
3479     projection2.center = function(_3) {
3480       return arguments.length ? (lambda = _3[0] % 360 * radians, phi = _3[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
3481     };
3482     projection2.rotate = function(_3) {
3483       return arguments.length ? (deltaLambda = _3[0] % 360 * radians, deltaPhi = _3[1] % 360 * radians, deltaGamma = _3.length > 2 ? _3[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
3484     };
3485     projection2.angle = function(_3) {
3486       return arguments.length ? (alpha = _3 % 360 * radians, recenter()) : alpha * degrees;
3487     };
3488     projection2.reflectX = function(_3) {
3489       return arguments.length ? (sx = _3 ? -1 : 1, recenter()) : sx < 0;
3490     };
3491     projection2.reflectY = function(_3) {
3492       return arguments.length ? (sy = _3 ? -1 : 1, recenter()) : sy < 0;
3493     };
3494     projection2.precision = function(_3) {
3495       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _3 * _3), reset()) : sqrt(delta2);
3496     };
3497     projection2.fitExtent = function(extent, object) {
3498       return fitExtent(projection2, extent, object);
3499     };
3500     projection2.fitSize = function(size, object) {
3501       return fitSize(projection2, size, object);
3502     };
3503     projection2.fitWidth = function(width, object) {
3504       return fitWidth(projection2, width, object);
3505     };
3506     projection2.fitHeight = function(height, object) {
3507       return fitHeight(projection2, height, object);
3508     };
3509     function recenter() {
3510       var center = scaleTranslateRotate(k3, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k3, x2 - center[0], y2 - center[1], sx, sy, alpha);
3511       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
3512       projectTransform = compose_default(project, transform2);
3513       projectRotateTransform = compose_default(rotate, projectTransform);
3514       projectResample = resample_default(projectTransform, delta2);
3515       return reset();
3516     }
3517     function reset() {
3518       cache = cacheStream = null;
3519       return projection2;
3520     }
3521     return function() {
3522       project = projectAt.apply(this, arguments);
3523       projection2.invert = project.invert && invert;
3524       return recenter();
3525     };
3526   }
3527   var transformRadians;
3528   var init_projection = __esm({
3529     "node_modules/d3-geo/src/projection/index.js"() {
3530       init_antimeridian();
3531       init_circle2();
3532       init_rectangle();
3533       init_compose();
3534       init_identity();
3535       init_math();
3536       init_rotation();
3537       init_transform();
3538       init_fit();
3539       init_resample();
3540       transformRadians = transformer({
3541         point: function(x2, y2) {
3542           this.stream.point(x2 * radians, y2 * radians);
3543         }
3544       });
3545     }
3546   });
3547
3548   // node_modules/d3-geo/src/projection/mercator.js
3549   function mercatorRaw(lambda, phi) {
3550     return [lambda, log(tan((halfPi + phi) / 2))];
3551   }
3552   function mercator_default() {
3553     return mercatorProjection(mercatorRaw).scale(961 / tau);
3554   }
3555   function mercatorProjection(project) {
3556     var m3 = projection(project), center = m3.center, scale = m3.scale, translate = m3.translate, clipExtent = m3.clipExtent, x05 = null, y05, x12, y12;
3557     m3.scale = function(_3) {
3558       return arguments.length ? (scale(_3), reclip()) : scale();
3559     };
3560     m3.translate = function(_3) {
3561       return arguments.length ? (translate(_3), reclip()) : translate();
3562     };
3563     m3.center = function(_3) {
3564       return arguments.length ? (center(_3), reclip()) : center();
3565     };
3566     m3.clipExtent = function(_3) {
3567       return arguments.length ? (_3 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3568     };
3569     function reclip() {
3570       var k3 = pi * scale(), t2 = m3(rotation_default(m3.rotate()).invert([0, 0]));
3571       return clipExtent(x05 == null ? [[t2[0] - k3, t2[1] - k3], [t2[0] + k3, t2[1] + k3]] : project === mercatorRaw ? [[Math.max(t2[0] - k3, x05), y05], [Math.min(t2[0] + k3, x12), y12]] : [[x05, Math.max(t2[1] - k3, y05)], [x12, Math.min(t2[1] + k3, y12)]]);
3572     }
3573     return reclip();
3574   }
3575   var init_mercator = __esm({
3576     "node_modules/d3-geo/src/projection/mercator.js"() {
3577       init_math();
3578       init_rotation();
3579       init_projection();
3580       mercatorRaw.invert = function(x2, y2) {
3581         return [x2, 2 * atan(exp(y2)) - halfPi];
3582       };
3583     }
3584   });
3585
3586   // node_modules/d3-geo/src/projection/identity.js
3587   function identity_default2() {
3588     var k3 = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
3589       point: function(x2, y2) {
3590         var p2 = projection2([x2, y2]);
3591         this.stream.point(p2[0], p2[1]);
3592       }
3593     }), postclip = identity_default, cache, cacheStream;
3594     function reset() {
3595       kx = k3 * sx;
3596       ky = k3 * sy;
3597       cache = cacheStream = null;
3598       return projection2;
3599     }
3600     function projection2(p2) {
3601       var x2 = p2[0] * kx, y2 = p2[1] * ky;
3602       if (alpha) {
3603         var t2 = y2 * ca - x2 * sa;
3604         x2 = x2 * ca + y2 * sa;
3605         y2 = t2;
3606       }
3607       return [x2 + tx, y2 + ty];
3608     }
3609     projection2.invert = function(p2) {
3610       var x2 = p2[0] - tx, y2 = p2[1] - ty;
3611       if (alpha) {
3612         var t2 = y2 * ca + x2 * sa;
3613         x2 = x2 * ca - y2 * sa;
3614         y2 = t2;
3615       }
3616       return [x2 / kx, y2 / ky];
3617     };
3618     projection2.stream = function(stream) {
3619       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
3620     };
3621     projection2.postclip = function(_3) {
3622       return arguments.length ? (postclip = _3, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3623     };
3624     projection2.clipExtent = function(_3) {
3625       return arguments.length ? (postclip = _3 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_3[0][0], y05 = +_3[0][1], x12 = +_3[1][0], y12 = +_3[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
3626     };
3627     projection2.scale = function(_3) {
3628       return arguments.length ? (k3 = +_3, reset()) : k3;
3629     };
3630     projection2.translate = function(_3) {
3631       return arguments.length ? (tx = +_3[0], ty = +_3[1], reset()) : [tx, ty];
3632     };
3633     projection2.angle = function(_3) {
3634       return arguments.length ? (alpha = _3 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
3635     };
3636     projection2.reflectX = function(_3) {
3637       return arguments.length ? (sx = _3 ? -1 : 1, reset()) : sx < 0;
3638     };
3639     projection2.reflectY = function(_3) {
3640       return arguments.length ? (sy = _3 ? -1 : 1, reset()) : sy < 0;
3641     };
3642     projection2.fitExtent = function(extent, object) {
3643       return fitExtent(projection2, extent, object);
3644     };
3645     projection2.fitSize = function(size, object) {
3646       return fitSize(projection2, size, object);
3647     };
3648     projection2.fitWidth = function(width, object) {
3649       return fitWidth(projection2, width, object);
3650     };
3651     projection2.fitHeight = function(height, object) {
3652       return fitHeight(projection2, height, object);
3653     };
3654     return projection2;
3655   }
3656   var init_identity2 = __esm({
3657     "node_modules/d3-geo/src/projection/identity.js"() {
3658       init_rectangle();
3659       init_identity();
3660       init_transform();
3661       init_fit();
3662       init_math();
3663     }
3664   });
3665
3666   // node_modules/d3-geo/src/index.js
3667   var init_src2 = __esm({
3668     "node_modules/d3-geo/src/index.js"() {
3669       init_area();
3670       init_bounds();
3671       init_length();
3672       init_path();
3673       init_identity2();
3674       init_projection();
3675       init_mercator();
3676       init_stream();
3677       init_transform();
3678     }
3679   });
3680
3681   // modules/geo/geo.js
3682   var geo_exports = {};
3683   __export(geo_exports, {
3684     geoLatToMeters: () => geoLatToMeters,
3685     geoLonToMeters: () => geoLonToMeters,
3686     geoMetersToLat: () => geoMetersToLat,
3687     geoMetersToLon: () => geoMetersToLon,
3688     geoMetersToOffset: () => geoMetersToOffset,
3689     geoOffsetToMeters: () => geoOffsetToMeters,
3690     geoScaleToZoom: () => geoScaleToZoom,
3691     geoSphericalClosestNode: () => geoSphericalClosestNode,
3692     geoSphericalDistance: () => geoSphericalDistance,
3693     geoZoomToScale: () => geoZoomToScale
3694   });
3695   function geoLatToMeters(dLat) {
3696     return dLat * (TAU * POLAR_RADIUS / 360);
3697   }
3698   function geoLonToMeters(dLon, atLat) {
3699     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
3700   }
3701   function geoMetersToLat(m3) {
3702     return m3 / (TAU * POLAR_RADIUS / 360);
3703   }
3704   function geoMetersToLon(m3, atLat) {
3705     return Math.abs(atLat) >= 90 ? 0 : m3 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
3706   }
3707   function geoMetersToOffset(meters, tileSize) {
3708     tileSize = tileSize || 256;
3709     return [
3710       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
3711       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
3712     ];
3713   }
3714   function geoOffsetToMeters(offset, tileSize) {
3715     tileSize = tileSize || 256;
3716     return [
3717       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
3718       -offset[1] * TAU * POLAR_RADIUS / tileSize
3719     ];
3720   }
3721   function geoSphericalDistance(a4, b3) {
3722     var x2 = geoLonToMeters(a4[0] - b3[0], (a4[1] + b3[1]) / 2);
3723     var y2 = geoLatToMeters(a4[1] - b3[1]);
3724     return Math.sqrt(x2 * x2 + y2 * y2);
3725   }
3726   function geoScaleToZoom(k3, tileSize) {
3727     tileSize = tileSize || 256;
3728     var log2ts = Math.log(tileSize) * Math.LOG2E;
3729     return Math.log(k3 * TAU) / Math.LN2 - log2ts;
3730   }
3731   function geoZoomToScale(z3, tileSize) {
3732     tileSize = tileSize || 256;
3733     return tileSize * Math.pow(2, z3) / TAU;
3734   }
3735   function geoSphericalClosestNode(nodes, point) {
3736     var minDistance = Infinity, distance;
3737     var indexOfMin;
3738     for (var i3 in nodes) {
3739       distance = geoSphericalDistance(nodes[i3].loc, point);
3740       if (distance < minDistance) {
3741         minDistance = distance;
3742         indexOfMin = i3;
3743       }
3744     }
3745     if (indexOfMin !== void 0) {
3746       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
3747     } else {
3748       return null;
3749     }
3750   }
3751   var TAU, EQUATORIAL_RADIUS, POLAR_RADIUS;
3752   var init_geo = __esm({
3753     "modules/geo/geo.js"() {
3754       "use strict";
3755       TAU = 2 * Math.PI;
3756       EQUATORIAL_RADIUS = 6378137;
3757       POLAR_RADIUS = 63567523e-1;
3758     }
3759   });
3760
3761   // modules/geo/extent.js
3762   var extent_exports = {};
3763   __export(extent_exports, {
3764     geoExtent: () => geoExtent
3765   });
3766   function geoExtent(min3, max3) {
3767     if (!(this instanceof geoExtent)) {
3768       return new geoExtent(min3, max3);
3769     } else if (min3 instanceof geoExtent) {
3770       return min3;
3771     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
3772       this[0] = min3[0];
3773       this[1] = min3[1];
3774     } else {
3775       this[0] = min3 || [Infinity, Infinity];
3776       this[1] = max3 || min3 || [-Infinity, -Infinity];
3777     }
3778   }
3779   var init_extent = __esm({
3780     "modules/geo/extent.js"() {
3781       "use strict";
3782       init_geo();
3783       geoExtent.prototype = new Array(2);
3784       Object.assign(geoExtent.prototype, {
3785         equals: function(obj) {
3786           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];
3787         },
3788         extend: function(obj) {
3789           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3790           return geoExtent(
3791             [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
3792             [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
3793           );
3794         },
3795         _extend: function(extent) {
3796           this[0][0] = Math.min(extent[0][0], this[0][0]);
3797           this[0][1] = Math.min(extent[0][1], this[0][1]);
3798           this[1][0] = Math.max(extent[1][0], this[1][0]);
3799           this[1][1] = Math.max(extent[1][1], this[1][1]);
3800         },
3801         area: function() {
3802           return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
3803         },
3804         center: function() {
3805           return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
3806         },
3807         rectangle: function() {
3808           return [this[0][0], this[0][1], this[1][0], this[1][1]];
3809         },
3810         bbox: function() {
3811           return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
3812         },
3813         polygon: function() {
3814           return [
3815             [this[0][0], this[0][1]],
3816             [this[0][0], this[1][1]],
3817             [this[1][0], this[1][1]],
3818             [this[1][0], this[0][1]],
3819             [this[0][0], this[0][1]]
3820           ];
3821         },
3822         contains: function(obj) {
3823           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3824           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];
3825         },
3826         intersects: function(obj) {
3827           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3828           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];
3829         },
3830         intersection: function(obj) {
3831           if (!this.intersects(obj)) return new geoExtent();
3832           return new geoExtent(
3833             [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
3834             [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
3835           );
3836         },
3837         percentContainedIn: function(obj) {
3838           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3839           var a1 = this.intersection(obj).area();
3840           var a22 = this.area();
3841           if (a1 === Infinity || a22 === Infinity) {
3842             return 0;
3843           } else if (a1 === 0 || a22 === 0) {
3844             if (obj.contains(this)) {
3845               return 1;
3846             }
3847             return 0;
3848           } else {
3849             return a1 / a22;
3850           }
3851         },
3852         padByMeters: function(meters) {
3853           var dLat = geoMetersToLat(meters);
3854           var dLon = geoMetersToLon(meters, this.center()[1]);
3855           return geoExtent(
3856             [this[0][0] - dLon, this[0][1] - dLat],
3857             [this[1][0] + dLon, this[1][1] + dLat]
3858           );
3859         },
3860         toParam: function() {
3861           return this.rectangle().join(",");
3862         },
3863         split: function() {
3864           const center = this.center();
3865           return [
3866             geoExtent(this[0], center),
3867             geoExtent([center[0], this[0][1]], [this[1][0], center[1]]),
3868             geoExtent(center, this[1]),
3869             geoExtent([this[0][0], center[1]], [center[0], this[1][1]])
3870           ];
3871         }
3872       });
3873     }
3874   });
3875
3876   // node_modules/d3-polygon/src/area.js
3877   function area_default3(polygon2) {
3878     var i3 = -1, n3 = polygon2.length, a4, b3 = polygon2[n3 - 1], area = 0;
3879     while (++i3 < n3) {
3880       a4 = b3;
3881       b3 = polygon2[i3];
3882       area += a4[1] * b3[0] - a4[0] * b3[1];
3883     }
3884     return area / 2;
3885   }
3886   var init_area3 = __esm({
3887     "node_modules/d3-polygon/src/area.js"() {
3888     }
3889   });
3890
3891   // node_modules/d3-polygon/src/centroid.js
3892   function centroid_default2(polygon2) {
3893     var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a4, b3 = polygon2[n3 - 1], c2, k3 = 0;
3894     while (++i3 < n3) {
3895       a4 = b3;
3896       b3 = polygon2[i3];
3897       k3 += c2 = a4[0] * b3[1] - b3[0] * a4[1];
3898       x2 += (a4[0] + b3[0]) * c2;
3899       y2 += (a4[1] + b3[1]) * c2;
3900     }
3901     return k3 *= 3, [x2 / k3, y2 / k3];
3902   }
3903   var init_centroid2 = __esm({
3904     "node_modules/d3-polygon/src/centroid.js"() {
3905     }
3906   });
3907
3908   // node_modules/d3-polygon/src/cross.js
3909   function cross_default(a4, b3, c2) {
3910     return (b3[0] - a4[0]) * (c2[1] - a4[1]) - (b3[1] - a4[1]) * (c2[0] - a4[0]);
3911   }
3912   var init_cross = __esm({
3913     "node_modules/d3-polygon/src/cross.js"() {
3914     }
3915   });
3916
3917   // node_modules/d3-polygon/src/hull.js
3918   function lexicographicOrder(a4, b3) {
3919     return a4[0] - b3[0] || a4[1] - b3[1];
3920   }
3921   function computeUpperHullIndexes(points) {
3922     const n3 = points.length, indexes = [0, 1];
3923     let size = 2, i3;
3924     for (i3 = 2; i3 < n3; ++i3) {
3925       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0) --size;
3926       indexes[size++] = i3;
3927     }
3928     return indexes.slice(0, size);
3929   }
3930   function hull_default(points) {
3931     if ((n3 = points.length) < 3) return null;
3932     var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
3933     for (i3 = 0; i3 < n3; ++i3) sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
3934     sortedPoints.sort(lexicographicOrder);
3935     for (i3 = 0; i3 < n3; ++i3) flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
3936     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
3937     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
3938     for (i3 = upperIndexes.length - 1; i3 >= 0; --i3) hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
3939     for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3) hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
3940     return hull;
3941   }
3942   var init_hull = __esm({
3943     "node_modules/d3-polygon/src/hull.js"() {
3944       init_cross();
3945     }
3946   });
3947
3948   // node_modules/d3-polygon/src/index.js
3949   var init_src3 = __esm({
3950     "node_modules/d3-polygon/src/index.js"() {
3951       init_area3();
3952       init_centroid2();
3953       init_hull();
3954     }
3955   });
3956
3957   // modules/geo/vector.js
3958   var vector_exports = {};
3959   __export(vector_exports, {
3960     geoVecAdd: () => geoVecAdd,
3961     geoVecAngle: () => geoVecAngle,
3962     geoVecCross: () => geoVecCross,
3963     geoVecDot: () => geoVecDot,
3964     geoVecEqual: () => geoVecEqual,
3965     geoVecFloor: () => geoVecFloor,
3966     geoVecInterp: () => geoVecInterp,
3967     geoVecLength: () => geoVecLength,
3968     geoVecLengthSquare: () => geoVecLengthSquare,
3969     geoVecNormalize: () => geoVecNormalize,
3970     geoVecNormalizedDot: () => geoVecNormalizedDot,
3971     geoVecProject: () => geoVecProject,
3972     geoVecScale: () => geoVecScale,
3973     geoVecSubtract: () => geoVecSubtract
3974   });
3975   function geoVecEqual(a4, b3, epsilon3) {
3976     if (epsilon3) {
3977       return Math.abs(a4[0] - b3[0]) <= epsilon3 && Math.abs(a4[1] - b3[1]) <= epsilon3;
3978     } else {
3979       return a4[0] === b3[0] && a4[1] === b3[1];
3980     }
3981   }
3982   function geoVecAdd(a4, b3) {
3983     return [a4[0] + b3[0], a4[1] + b3[1]];
3984   }
3985   function geoVecSubtract(a4, b3) {
3986     return [a4[0] - b3[0], a4[1] - b3[1]];
3987   }
3988   function geoVecScale(a4, mag) {
3989     return [a4[0] * mag, a4[1] * mag];
3990   }
3991   function geoVecFloor(a4) {
3992     return [Math.floor(a4[0]), Math.floor(a4[1])];
3993   }
3994   function geoVecInterp(a4, b3, t2) {
3995     return [
3996       a4[0] + (b3[0] - a4[0]) * t2,
3997       a4[1] + (b3[1] - a4[1]) * t2
3998     ];
3999   }
4000   function geoVecLength(a4, b3) {
4001     return Math.sqrt(geoVecLengthSquare(a4, b3));
4002   }
4003   function geoVecLengthSquare(a4, b3) {
4004     b3 = b3 || [0, 0];
4005     var x2 = a4[0] - b3[0];
4006     var y2 = a4[1] - b3[1];
4007     return x2 * x2 + y2 * y2;
4008   }
4009   function geoVecNormalize(a4) {
4010     var length2 = Math.sqrt(a4[0] * a4[0] + a4[1] * a4[1]);
4011     if (length2 !== 0) {
4012       return geoVecScale(a4, 1 / length2);
4013     }
4014     return [0, 0];
4015   }
4016   function geoVecAngle(a4, b3) {
4017     return Math.atan2(b3[1] - a4[1], b3[0] - a4[0]);
4018   }
4019   function geoVecDot(a4, b3, origin) {
4020     origin = origin || [0, 0];
4021     var p2 = geoVecSubtract(a4, origin);
4022     var q3 = geoVecSubtract(b3, origin);
4023     return p2[0] * q3[0] + p2[1] * q3[1];
4024   }
4025   function geoVecNormalizedDot(a4, b3, origin) {
4026     origin = origin || [0, 0];
4027     var p2 = geoVecNormalize(geoVecSubtract(a4, origin));
4028     var q3 = geoVecNormalize(geoVecSubtract(b3, origin));
4029     return geoVecDot(p2, q3);
4030   }
4031   function geoVecCross(a4, b3, origin) {
4032     origin = origin || [0, 0];
4033     var p2 = geoVecSubtract(a4, origin);
4034     var q3 = geoVecSubtract(b3, origin);
4035     return p2[0] * q3[1] - p2[1] * q3[0];
4036   }
4037   function geoVecProject(a4, points) {
4038     var min3 = Infinity;
4039     var idx;
4040     var target;
4041     for (var i3 = 0; i3 < points.length - 1; i3++) {
4042       var o2 = points[i3];
4043       var s2 = geoVecSubtract(points[i3 + 1], o2);
4044       var v3 = geoVecSubtract(a4, o2);
4045       var proj = geoVecDot(v3, s2) / geoVecDot(s2, s2);
4046       var p2;
4047       if (proj < 0) {
4048         p2 = o2;
4049       } else if (proj > 1) {
4050         p2 = points[i3 + 1];
4051       } else {
4052         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
4053       }
4054       var dist = geoVecLength(p2, a4);
4055       if (dist < min3) {
4056         min3 = dist;
4057         idx = i3 + 1;
4058         target = p2;
4059       }
4060     }
4061     if (idx !== void 0) {
4062       return { index: idx, distance: min3, target };
4063     } else {
4064       return null;
4065     }
4066   }
4067   var init_vector = __esm({
4068     "modules/geo/vector.js"() {
4069       "use strict";
4070     }
4071   });
4072
4073   // modules/geo/geom.js
4074   var geom_exports = {};
4075   __export(geom_exports, {
4076     geoAngle: () => geoAngle,
4077     geoChooseEdge: () => geoChooseEdge,
4078     geoEdgeEqual: () => geoEdgeEqual,
4079     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
4080     geoHasLineIntersections: () => geoHasLineIntersections,
4081     geoHasSelfIntersections: () => geoHasSelfIntersections,
4082     geoLineIntersection: () => geoLineIntersection,
4083     geoPathHasIntersections: () => geoPathHasIntersections,
4084     geoPathIntersections: () => geoPathIntersections,
4085     geoPathLength: () => geoPathLength,
4086     geoPointInPolygon: () => geoPointInPolygon,
4087     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
4088     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
4089     geoRotate: () => geoRotate,
4090     geoViewportEdge: () => geoViewportEdge
4091   });
4092   function geoAngle(a4, b3, projection2) {
4093     return geoVecAngle(projection2(a4.loc), projection2(b3.loc));
4094   }
4095   function geoEdgeEqual(a4, b3) {
4096     return a4[0] === b3[0] && a4[1] === b3[1] || a4[0] === b3[1] && a4[1] === b3[0];
4097   }
4098   function geoRotate(points, angle2, around) {
4099     return points.map(function(point) {
4100       var radial = geoVecSubtract(point, around);
4101       return [
4102         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
4103         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
4104       ];
4105     });
4106   }
4107   function geoChooseEdge(nodes, point, projection2, activeID) {
4108     var dist = geoVecLength;
4109     var points = nodes.map(function(n3) {
4110       return projection2(n3.loc);
4111     });
4112     var ids = nodes.map(function(n3) {
4113       return n3.id;
4114     });
4115     var min3 = Infinity;
4116     var idx;
4117     var loc;
4118     for (var i3 = 0; i3 < points.length - 1; i3++) {
4119       if (ids[i3] === activeID || ids[i3 + 1] === activeID) continue;
4120       var o2 = points[i3];
4121       var s2 = geoVecSubtract(points[i3 + 1], o2);
4122       var v3 = geoVecSubtract(point, o2);
4123       var proj = geoVecDot(v3, s2) / geoVecDot(s2, s2);
4124       var p2;
4125       if (proj < 0) {
4126         p2 = o2;
4127       } else if (proj > 1) {
4128         p2 = points[i3 + 1];
4129       } else {
4130         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
4131       }
4132       var d2 = dist(p2, point);
4133       if (d2 < min3) {
4134         min3 = d2;
4135         idx = i3 + 1;
4136         loc = projection2.invert(p2);
4137       }
4138     }
4139     if (idx !== void 0) {
4140       return { index: idx, distance: min3, loc };
4141     } else {
4142       return null;
4143     }
4144   }
4145   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
4146     var actives = [];
4147     var inactives = [];
4148     var j3, k3, n1, n22, segment;
4149     for (j3 = 0; j3 < activeNodes.length - 1; j3++) {
4150       n1 = activeNodes[j3];
4151       n22 = activeNodes[j3 + 1];
4152       segment = [n1.loc, n22.loc];
4153       if (n1.id === activeID || n22.id === activeID) {
4154         actives.push(segment);
4155       }
4156     }
4157     for (j3 = 0; j3 < inactiveNodes.length - 1; j3++) {
4158       n1 = inactiveNodes[j3];
4159       n22 = inactiveNodes[j3 + 1];
4160       segment = [n1.loc, n22.loc];
4161       inactives.push(segment);
4162     }
4163     for (j3 = 0; j3 < actives.length; j3++) {
4164       for (k3 = 0; k3 < inactives.length; k3++) {
4165         var p2 = actives[j3];
4166         var q3 = inactives[k3];
4167         var hit = geoLineIntersection(p2, q3);
4168         if (hit) {
4169           return true;
4170         }
4171       }
4172     }
4173     return false;
4174   }
4175   function geoHasSelfIntersections(nodes, activeID) {
4176     var actives = [];
4177     var inactives = [];
4178     var j3, k3;
4179     for (j3 = 0; j3 < nodes.length - 1; j3++) {
4180       var n1 = nodes[j3];
4181       var n22 = nodes[j3 + 1];
4182       var segment = [n1.loc, n22.loc];
4183       if (n1.id === activeID || n22.id === activeID) {
4184         actives.push(segment);
4185       } else {
4186         inactives.push(segment);
4187       }
4188     }
4189     for (j3 = 0; j3 < actives.length; j3++) {
4190       for (k3 = 0; k3 < inactives.length; k3++) {
4191         var p2 = actives[j3];
4192         var q3 = inactives[k3];
4193         if (geoVecEqual(p2[1], q3[0]) || geoVecEqual(p2[0], q3[1]) || geoVecEqual(p2[0], q3[0]) || geoVecEqual(p2[1], q3[1])) {
4194           continue;
4195         }
4196         var hit = geoLineIntersection(p2, q3);
4197         if (hit) {
4198           var epsilon3 = 1e-8;
4199           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q3[1], hit, epsilon3) || geoVecEqual(q3[0], hit, epsilon3)) {
4200             continue;
4201           } else {
4202             return true;
4203           }
4204         }
4205       }
4206     }
4207     return false;
4208   }
4209   function geoLineIntersection(a4, b3) {
4210     var p2 = [a4[0][0], a4[0][1]];
4211     var p22 = [a4[1][0], a4[1][1]];
4212     var q3 = [b3[0][0], b3[0][1]];
4213     var q22 = [b3[1][0], b3[1][1]];
4214     var r2 = geoVecSubtract(p22, p2);
4215     var s2 = geoVecSubtract(q22, q3);
4216     var uNumerator = geoVecCross(geoVecSubtract(q3, p2), r2);
4217     var denominator = geoVecCross(r2, s2);
4218     if (uNumerator && denominator) {
4219       var u2 = uNumerator / denominator;
4220       var t2 = geoVecCross(geoVecSubtract(q3, p2), s2) / denominator;
4221       if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
4222         return geoVecInterp(p2, p22, t2);
4223       }
4224     }
4225     return null;
4226   }
4227   function geoPathIntersections(path1, path2) {
4228     var intersections = [];
4229     for (var i3 = 0; i3 < path1.length - 1; i3++) {
4230       for (var j3 = 0; j3 < path2.length - 1; j3++) {
4231         var a4 = [path1[i3], path1[i3 + 1]];
4232         var b3 = [path2[j3], path2[j3 + 1]];
4233         var hit = geoLineIntersection(a4, b3);
4234         if (hit) {
4235           intersections.push(hit);
4236         }
4237       }
4238     }
4239     return intersections;
4240   }
4241   function geoPathHasIntersections(path1, path2) {
4242     for (var i3 = 0; i3 < path1.length - 1; i3++) {
4243       for (var j3 = 0; j3 < path2.length - 1; j3++) {
4244         var a4 = [path1[i3], path1[i3 + 1]];
4245         var b3 = [path2[j3], path2[j3 + 1]];
4246         var hit = geoLineIntersection(a4, b3);
4247         if (hit) {
4248           return true;
4249         }
4250       }
4251     }
4252     return false;
4253   }
4254   function geoPointInPolygon(point, polygon2) {
4255     var x2 = point[0];
4256     var y2 = point[1];
4257     var inside = false;
4258     for (var i3 = 0, j3 = polygon2.length - 1; i3 < polygon2.length; j3 = i3++) {
4259       var xi = polygon2[i3][0];
4260       var yi = polygon2[i3][1];
4261       var xj = polygon2[j3][0];
4262       var yj = polygon2[j3][1];
4263       var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
4264       if (intersect2) inside = !inside;
4265     }
4266     return inside;
4267   }
4268   function geoPolygonContainsPolygon(outer, inner) {
4269     return inner.every(function(point) {
4270       return geoPointInPolygon(point, outer);
4271     });
4272   }
4273   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
4274     function testPoints(outer2, inner2) {
4275       return inner2.some(function(point) {
4276         return geoPointInPolygon(point, outer2);
4277       });
4278     }
4279     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
4280   }
4281   function geoGetSmallestSurroundingRectangle(points) {
4282     var hull = hull_default(points);
4283     var centroid = centroid_default2(hull);
4284     var minArea = Infinity;
4285     var ssrExtent = [];
4286     var ssrAngle = 0;
4287     var c1 = hull[0];
4288     for (var i3 = 0; i3 <= hull.length - 1; i3++) {
4289       var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
4290       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
4291       var poly = geoRotate(hull, -angle2, centroid);
4292       var extent = poly.reduce(function(extent2, point) {
4293         return extent2.extend(geoExtent(point));
4294       }, geoExtent());
4295       var area = extent.area();
4296       if (area < minArea) {
4297         minArea = area;
4298         ssrExtent = extent;
4299         ssrAngle = angle2;
4300       }
4301       c1 = c2;
4302     }
4303     return {
4304       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
4305       angle: ssrAngle
4306     };
4307   }
4308   function geoPathLength(path) {
4309     var length2 = 0;
4310     for (var i3 = 0; i3 < path.length - 1; i3++) {
4311       length2 += geoVecLength(path[i3], path[i3 + 1]);
4312     }
4313     return length2;
4314   }
4315   function geoViewportEdge(point, dimensions) {
4316     var pad3 = [80, 20, 50, 20];
4317     var x2 = 0;
4318     var y2 = 0;
4319     if (point[0] > dimensions[0] - pad3[1]) {
4320       x2 = -10;
4321     }
4322     if (point[0] < pad3[3]) {
4323       x2 = 10;
4324     }
4325     if (point[1] > dimensions[1] - pad3[2]) {
4326       y2 = -10;
4327     }
4328     if (point[1] < pad3[0]) {
4329       y2 = 10;
4330     }
4331     if (x2 || y2) {
4332       return [x2, y2];
4333     } else {
4334       return null;
4335     }
4336   }
4337   var init_geom = __esm({
4338     "modules/geo/geom.js"() {
4339       "use strict";
4340       init_src3();
4341       init_extent();
4342       init_vector();
4343     }
4344   });
4345
4346   // node_modules/d3-dispatch/src/dispatch.js
4347   function dispatch() {
4348     for (var i3 = 0, n3 = arguments.length, _3 = {}, t2; i3 < n3; ++i3) {
4349       if (!(t2 = arguments[i3] + "") || t2 in _3 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
4350       _3[t2] = [];
4351     }
4352     return new Dispatch(_3);
4353   }
4354   function Dispatch(_3) {
4355     this._ = _3;
4356   }
4357   function parseTypenames(typenames, types) {
4358     return typenames.trim().split(/^|\s+/).map(function(t2) {
4359       var name = "", i3 = t2.indexOf(".");
4360       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
4361       if (t2 && !types.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
4362       return { type: t2, name };
4363     });
4364   }
4365   function get(type2, name) {
4366     for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
4367       if ((c2 = type2[i3]).name === name) {
4368         return c2.value;
4369       }
4370     }
4371   }
4372   function set(type2, name, callback) {
4373     for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
4374       if (type2[i3].name === name) {
4375         type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
4376         break;
4377       }
4378     }
4379     if (callback != null) type2.push({ name, value: callback });
4380     return type2;
4381   }
4382   var noop2, dispatch_default;
4383   var init_dispatch = __esm({
4384     "node_modules/d3-dispatch/src/dispatch.js"() {
4385       noop2 = { value: () => {
4386       } };
4387       Dispatch.prototype = dispatch.prototype = {
4388         constructor: Dispatch,
4389         on: function(typename, callback) {
4390           var _3 = this._, T3 = parseTypenames(typename + "", _3), t2, i3 = -1, n3 = T3.length;
4391           if (arguments.length < 2) {
4392             while (++i3 < n3) if ((t2 = (typename = T3[i3]).type) && (t2 = get(_3[t2], typename.name))) return t2;
4393             return;
4394           }
4395           if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
4396           while (++i3 < n3) {
4397             if (t2 = (typename = T3[i3]).type) _3[t2] = set(_3[t2], typename.name, callback);
4398             else if (callback == null) for (t2 in _3) _3[t2] = set(_3[t2], typename.name, null);
4399           }
4400           return this;
4401         },
4402         copy: function() {
4403           var copy2 = {}, _3 = this._;
4404           for (var t2 in _3) copy2[t2] = _3[t2].slice();
4405           return new Dispatch(copy2);
4406         },
4407         call: function(type2, that) {
4408           if ((n3 = arguments.length - 2) > 0) for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3) args[i3] = arguments[i3 + 2];
4409           if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
4410           for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
4411         },
4412         apply: function(type2, that, args) {
4413           if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
4414           for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
4415         }
4416       };
4417       dispatch_default = dispatch;
4418     }
4419   });
4420
4421   // node_modules/d3-dispatch/src/index.js
4422   var init_src4 = __esm({
4423     "node_modules/d3-dispatch/src/index.js"() {
4424       init_dispatch();
4425     }
4426   });
4427
4428   // node_modules/d3-selection/src/namespaces.js
4429   var xhtml, namespaces_default;
4430   var init_namespaces = __esm({
4431     "node_modules/d3-selection/src/namespaces.js"() {
4432       xhtml = "http://www.w3.org/1999/xhtml";
4433       namespaces_default = {
4434         svg: "http://www.w3.org/2000/svg",
4435         xhtml,
4436         xlink: "http://www.w3.org/1999/xlink",
4437         xml: "http://www.w3.org/XML/1998/namespace",
4438         xmlns: "http://www.w3.org/2000/xmlns/"
4439       };
4440     }
4441   });
4442
4443   // node_modules/d3-selection/src/namespace.js
4444   function namespace_default(name) {
4445     var prefix = name += "", i3 = prefix.indexOf(":");
4446     if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns") name = name.slice(i3 + 1);
4447     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
4448   }
4449   var init_namespace = __esm({
4450     "node_modules/d3-selection/src/namespace.js"() {
4451       init_namespaces();
4452     }
4453   });
4454
4455   // node_modules/d3-selection/src/creator.js
4456   function creatorInherit(name) {
4457     return function() {
4458       var document2 = this.ownerDocument, uri = this.namespaceURI;
4459       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
4460     };
4461   }
4462   function creatorFixed(fullname) {
4463     return function() {
4464       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
4465     };
4466   }
4467   function creator_default(name) {
4468     var fullname = namespace_default(name);
4469     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
4470   }
4471   var init_creator = __esm({
4472     "node_modules/d3-selection/src/creator.js"() {
4473       init_namespace();
4474       init_namespaces();
4475     }
4476   });
4477
4478   // node_modules/d3-selection/src/selector.js
4479   function none() {
4480   }
4481   function selector_default(selector) {
4482     return selector == null ? none : function() {
4483       return this.querySelector(selector);
4484     };
4485   }
4486   var init_selector = __esm({
4487     "node_modules/d3-selection/src/selector.js"() {
4488     }
4489   });
4490
4491   // node_modules/d3-selection/src/selection/select.js
4492   function select_default(select) {
4493     if (typeof select !== "function") select = selector_default(select);
4494     for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4495       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
4496         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
4497           if ("__data__" in node) subnode.__data__ = node.__data__;
4498           subgroup[i3] = subnode;
4499         }
4500       }
4501     }
4502     return new Selection(subgroups, this._parents);
4503   }
4504   var init_select = __esm({
4505     "node_modules/d3-selection/src/selection/select.js"() {
4506       init_selection();
4507       init_selector();
4508     }
4509   });
4510
4511   // node_modules/d3-selection/src/array.js
4512   function array(x2) {
4513     return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
4514   }
4515   var init_array = __esm({
4516     "node_modules/d3-selection/src/array.js"() {
4517     }
4518   });
4519
4520   // node_modules/d3-selection/src/selectorAll.js
4521   function empty() {
4522     return [];
4523   }
4524   function selectorAll_default(selector) {
4525     return selector == null ? empty : function() {
4526       return this.querySelectorAll(selector);
4527     };
4528   }
4529   var init_selectorAll = __esm({
4530     "node_modules/d3-selection/src/selectorAll.js"() {
4531     }
4532   });
4533
4534   // node_modules/d3-selection/src/selection/selectAll.js
4535   function arrayAll(select) {
4536     return function() {
4537       return array(select.apply(this, arguments));
4538     };
4539   }
4540   function selectAll_default(select) {
4541     if (typeof select === "function") select = arrayAll(select);
4542     else select = selectorAll_default(select);
4543     for (var groups = this._groups, m3 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m3; ++j3) {
4544       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
4545         if (node = group[i3]) {
4546           subgroups.push(select.call(node, node.__data__, i3, group));
4547           parents.push(node);
4548         }
4549       }
4550     }
4551     return new Selection(subgroups, parents);
4552   }
4553   var init_selectAll = __esm({
4554     "node_modules/d3-selection/src/selection/selectAll.js"() {
4555       init_selection();
4556       init_array();
4557       init_selectorAll();
4558     }
4559   });
4560
4561   // node_modules/d3-selection/src/matcher.js
4562   function matcher_default(selector) {
4563     return function() {
4564       return this.matches(selector);
4565     };
4566   }
4567   function childMatcher(selector) {
4568     return function(node) {
4569       return node.matches(selector);
4570     };
4571   }
4572   var init_matcher = __esm({
4573     "node_modules/d3-selection/src/matcher.js"() {
4574     }
4575   });
4576
4577   // node_modules/d3-selection/src/selection/selectChild.js
4578   function childFind(match) {
4579     return function() {
4580       return find.call(this.children, match);
4581     };
4582   }
4583   function childFirst() {
4584     return this.firstElementChild;
4585   }
4586   function selectChild_default(match) {
4587     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
4588   }
4589   var find;
4590   var init_selectChild = __esm({
4591     "node_modules/d3-selection/src/selection/selectChild.js"() {
4592       init_matcher();
4593       find = Array.prototype.find;
4594     }
4595   });
4596
4597   // node_modules/d3-selection/src/selection/selectChildren.js
4598   function children() {
4599     return Array.from(this.children);
4600   }
4601   function childrenFilter(match) {
4602     return function() {
4603       return filter.call(this.children, match);
4604     };
4605   }
4606   function selectChildren_default(match) {
4607     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
4608   }
4609   var filter;
4610   var init_selectChildren = __esm({
4611     "node_modules/d3-selection/src/selection/selectChildren.js"() {
4612       init_matcher();
4613       filter = Array.prototype.filter;
4614     }
4615   });
4616
4617   // node_modules/d3-selection/src/selection/filter.js
4618   function filter_default(match) {
4619     if (typeof match !== "function") match = matcher_default(match);
4620     for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4621       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
4622         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
4623           subgroup.push(node);
4624         }
4625       }
4626     }
4627     return new Selection(subgroups, this._parents);
4628   }
4629   var init_filter = __esm({
4630     "node_modules/d3-selection/src/selection/filter.js"() {
4631       init_selection();
4632       init_matcher();
4633     }
4634   });
4635
4636   // node_modules/d3-selection/src/selection/sparse.js
4637   function sparse_default(update) {
4638     return new Array(update.length);
4639   }
4640   var init_sparse = __esm({
4641     "node_modules/d3-selection/src/selection/sparse.js"() {
4642     }
4643   });
4644
4645   // node_modules/d3-selection/src/selection/enter.js
4646   function enter_default() {
4647     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
4648   }
4649   function EnterNode(parent2, datum2) {
4650     this.ownerDocument = parent2.ownerDocument;
4651     this.namespaceURI = parent2.namespaceURI;
4652     this._next = null;
4653     this._parent = parent2;
4654     this.__data__ = datum2;
4655   }
4656   var init_enter = __esm({
4657     "node_modules/d3-selection/src/selection/enter.js"() {
4658       init_sparse();
4659       init_selection();
4660       EnterNode.prototype = {
4661         constructor: EnterNode,
4662         appendChild: function(child) {
4663           return this._parent.insertBefore(child, this._next);
4664         },
4665         insertBefore: function(child, next) {
4666           return this._parent.insertBefore(child, next);
4667         },
4668         querySelector: function(selector) {
4669           return this._parent.querySelector(selector);
4670         },
4671         querySelectorAll: function(selector) {
4672           return this._parent.querySelectorAll(selector);
4673         }
4674       };
4675     }
4676   });
4677
4678   // node_modules/d3-selection/src/constant.js
4679   function constant_default(x2) {
4680     return function() {
4681       return x2;
4682     };
4683   }
4684   var init_constant = __esm({
4685     "node_modules/d3-selection/src/constant.js"() {
4686     }
4687   });
4688
4689   // node_modules/d3-selection/src/selection/data.js
4690   function bindIndex(parent2, group, enter, update, exit, data) {
4691     var i3 = 0, node, groupLength = group.length, dataLength = data.length;
4692     for (; i3 < dataLength; ++i3) {
4693       if (node = group[i3]) {
4694         node.__data__ = data[i3];
4695         update[i3] = node;
4696       } else {
4697         enter[i3] = new EnterNode(parent2, data[i3]);
4698       }
4699     }
4700     for (; i3 < groupLength; ++i3) {
4701       if (node = group[i3]) {
4702         exit[i3] = node;
4703       }
4704     }
4705   }
4706   function bindKey(parent2, group, enter, update, exit, data, key) {
4707     var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
4708     for (i3 = 0; i3 < groupLength; ++i3) {
4709       if (node = group[i3]) {
4710         keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
4711         if (nodeByKeyValue.has(keyValue)) {
4712           exit[i3] = node;
4713         } else {
4714           nodeByKeyValue.set(keyValue, node);
4715         }
4716       }
4717     }
4718     for (i3 = 0; i3 < dataLength; ++i3) {
4719       keyValue = key.call(parent2, data[i3], i3, data) + "";
4720       if (node = nodeByKeyValue.get(keyValue)) {
4721         update[i3] = node;
4722         node.__data__ = data[i3];
4723         nodeByKeyValue.delete(keyValue);
4724       } else {
4725         enter[i3] = new EnterNode(parent2, data[i3]);
4726       }
4727     }
4728     for (i3 = 0; i3 < groupLength; ++i3) {
4729       if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
4730         exit[i3] = node;
4731       }
4732     }
4733   }
4734   function datum(node) {
4735     return node.__data__;
4736   }
4737   function data_default(value, key) {
4738     if (!arguments.length) return Array.from(this, datum);
4739     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
4740     if (typeof value !== "function") value = constant_default(value);
4741     for (var m3 = groups.length, update = new Array(m3), enter = new Array(m3), exit = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4742       var parent2 = parents[j3], group = groups[j3], groupLength = group.length, data = arraylike(value.call(parent2, parent2 && parent2.__data__, j3, parents)), dataLength = data.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength);
4743       bind(parent2, group, enterGroup, updateGroup, exitGroup, data, key);
4744       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
4745         if (previous = enterGroup[i0]) {
4746           if (i0 >= i1) i1 = i0 + 1;
4747           while (!(next = updateGroup[i1]) && ++i1 < dataLength) ;
4748           previous._next = next || null;
4749         }
4750       }
4751     }
4752     update = new Selection(update, parents);
4753     update._enter = enter;
4754     update._exit = exit;
4755     return update;
4756   }
4757   function arraylike(data) {
4758     return typeof data === "object" && "length" in data ? data : Array.from(data);
4759   }
4760   var init_data = __esm({
4761     "node_modules/d3-selection/src/selection/data.js"() {
4762       init_selection();
4763       init_enter();
4764       init_constant();
4765     }
4766   });
4767
4768   // node_modules/d3-selection/src/selection/exit.js
4769   function exit_default() {
4770     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
4771   }
4772   var init_exit = __esm({
4773     "node_modules/d3-selection/src/selection/exit.js"() {
4774       init_sparse();
4775       init_selection();
4776     }
4777   });
4778
4779   // node_modules/d3-selection/src/selection/join.js
4780   function join_default(onenter, onupdate, onexit) {
4781     var enter = this.enter(), update = this, exit = this.exit();
4782     if (typeof onenter === "function") {
4783       enter = onenter(enter);
4784       if (enter) enter = enter.selection();
4785     } else {
4786       enter = enter.append(onenter + "");
4787     }
4788     if (onupdate != null) {
4789       update = onupdate(update);
4790       if (update) update = update.selection();
4791     }
4792     if (onexit == null) exit.remove();
4793     else onexit(exit);
4794     return enter && update ? enter.merge(update).order() : update;
4795   }
4796   var init_join = __esm({
4797     "node_modules/d3-selection/src/selection/join.js"() {
4798     }
4799   });
4800
4801   // node_modules/d3-selection/src/selection/merge.js
4802   function merge_default(context) {
4803     var selection2 = context.selection ? context.selection() : context;
4804     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
4805       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge3 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
4806         if (node = group0[i3] || group1[i3]) {
4807           merge3[i3] = node;
4808         }
4809       }
4810     }
4811     for (; j3 < m0; ++j3) {
4812       merges[j3] = groups0[j3];
4813     }
4814     return new Selection(merges, this._parents);
4815   }
4816   var init_merge2 = __esm({
4817     "node_modules/d3-selection/src/selection/merge.js"() {
4818       init_selection();
4819     }
4820   });
4821
4822   // node_modules/d3-selection/src/selection/order.js
4823   function order_default() {
4824     for (var groups = this._groups, j3 = -1, m3 = groups.length; ++j3 < m3; ) {
4825       for (var group = groups[j3], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
4826         if (node = group[i3]) {
4827           if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
4828           next = node;
4829         }
4830       }
4831     }
4832     return this;
4833   }
4834   var init_order = __esm({
4835     "node_modules/d3-selection/src/selection/order.js"() {
4836     }
4837   });
4838
4839   // node_modules/d3-selection/src/selection/sort.js
4840   function sort_default(compare2) {
4841     if (!compare2) compare2 = ascending2;
4842     function compareNode(a4, b3) {
4843       return a4 && b3 ? compare2(a4.__data__, b3.__data__) : !a4 - !b3;
4844     }
4845     for (var groups = this._groups, m3 = groups.length, sortgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
4846       for (var group = groups[j3], n3 = group.length, sortgroup = sortgroups[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
4847         if (node = group[i3]) {
4848           sortgroup[i3] = node;
4849         }
4850       }
4851       sortgroup.sort(compareNode);
4852     }
4853     return new Selection(sortgroups, this._parents).order();
4854   }
4855   function ascending2(a4, b3) {
4856     return a4 < b3 ? -1 : a4 > b3 ? 1 : a4 >= b3 ? 0 : NaN;
4857   }
4858   var init_sort2 = __esm({
4859     "node_modules/d3-selection/src/selection/sort.js"() {
4860       init_selection();
4861     }
4862   });
4863
4864   // node_modules/d3-selection/src/selection/call.js
4865   function call_default() {
4866     var callback = arguments[0];
4867     arguments[0] = this;
4868     callback.apply(null, arguments);
4869     return this;
4870   }
4871   var init_call = __esm({
4872     "node_modules/d3-selection/src/selection/call.js"() {
4873     }
4874   });
4875
4876   // node_modules/d3-selection/src/selection/nodes.js
4877   function nodes_default() {
4878     return Array.from(this);
4879   }
4880   var init_nodes = __esm({
4881     "node_modules/d3-selection/src/selection/nodes.js"() {
4882     }
4883   });
4884
4885   // node_modules/d3-selection/src/selection/node.js
4886   function node_default() {
4887     for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
4888       for (var group = groups[j3], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
4889         var node = group[i3];
4890         if (node) return node;
4891       }
4892     }
4893     return null;
4894   }
4895   var init_node = __esm({
4896     "node_modules/d3-selection/src/selection/node.js"() {
4897     }
4898   });
4899
4900   // node_modules/d3-selection/src/selection/size.js
4901   function size_default() {
4902     let size = 0;
4903     for (const node of this) ++size;
4904     return size;
4905   }
4906   var init_size = __esm({
4907     "node_modules/d3-selection/src/selection/size.js"() {
4908     }
4909   });
4910
4911   // node_modules/d3-selection/src/selection/empty.js
4912   function empty_default() {
4913     return !this.node();
4914   }
4915   var init_empty = __esm({
4916     "node_modules/d3-selection/src/selection/empty.js"() {
4917     }
4918   });
4919
4920   // node_modules/d3-selection/src/selection/each.js
4921   function each_default(callback) {
4922     for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
4923       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
4924         if (node = group[i3]) callback.call(node, node.__data__, i3, group);
4925       }
4926     }
4927     return this;
4928   }
4929   var init_each = __esm({
4930     "node_modules/d3-selection/src/selection/each.js"() {
4931     }
4932   });
4933
4934   // node_modules/d3-selection/src/selection/attr.js
4935   function attrRemove(name) {
4936     return function() {
4937       this.removeAttribute(name);
4938     };
4939   }
4940   function attrRemoveNS(fullname) {
4941     return function() {
4942       this.removeAttributeNS(fullname.space, fullname.local);
4943     };
4944   }
4945   function attrConstant(name, value) {
4946     return function() {
4947       this.setAttribute(name, value);
4948     };
4949   }
4950   function attrConstantNS(fullname, value) {
4951     return function() {
4952       this.setAttributeNS(fullname.space, fullname.local, value);
4953     };
4954   }
4955   function attrFunction(name, value) {
4956     return function() {
4957       var v3 = value.apply(this, arguments);
4958       if (v3 == null) this.removeAttribute(name);
4959       else this.setAttribute(name, v3);
4960     };
4961   }
4962   function attrFunctionNS(fullname, value) {
4963     return function() {
4964       var v3 = value.apply(this, arguments);
4965       if (v3 == null) this.removeAttributeNS(fullname.space, fullname.local);
4966       else this.setAttributeNS(fullname.space, fullname.local, v3);
4967     };
4968   }
4969   function attr_default(name, value) {
4970     var fullname = namespace_default(name);
4971     if (arguments.length < 2) {
4972       var node = this.node();
4973       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
4974     }
4975     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
4976   }
4977   var init_attr = __esm({
4978     "node_modules/d3-selection/src/selection/attr.js"() {
4979       init_namespace();
4980     }
4981   });
4982
4983   // node_modules/d3-selection/src/window.js
4984   function window_default(node) {
4985     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
4986   }
4987   var init_window = __esm({
4988     "node_modules/d3-selection/src/window.js"() {
4989     }
4990   });
4991
4992   // node_modules/d3-selection/src/selection/style.js
4993   function styleRemove(name) {
4994     return function() {
4995       this.style.removeProperty(name);
4996     };
4997   }
4998   function styleConstant(name, value, priority) {
4999     return function() {
5000       this.style.setProperty(name, value, priority);
5001     };
5002   }
5003   function styleFunction(name, value, priority) {
5004     return function() {
5005       var v3 = value.apply(this, arguments);
5006       if (v3 == null) this.style.removeProperty(name);
5007       else this.style.setProperty(name, v3, priority);
5008     };
5009   }
5010   function style_default(name, value, priority) {
5011     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
5012   }
5013   function styleValue(node, name) {
5014     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
5015   }
5016   var init_style = __esm({
5017     "node_modules/d3-selection/src/selection/style.js"() {
5018       init_window();
5019     }
5020   });
5021
5022   // node_modules/d3-selection/src/selection/property.js
5023   function propertyRemove(name) {
5024     return function() {
5025       delete this[name];
5026     };
5027   }
5028   function propertyConstant(name, value) {
5029     return function() {
5030       this[name] = value;
5031     };
5032   }
5033   function propertyFunction(name, value) {
5034     return function() {
5035       var v3 = value.apply(this, arguments);
5036       if (v3 == null) delete this[name];
5037       else this[name] = v3;
5038     };
5039   }
5040   function property_default(name, value) {
5041     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
5042   }
5043   var init_property = __esm({
5044     "node_modules/d3-selection/src/selection/property.js"() {
5045     }
5046   });
5047
5048   // node_modules/d3-selection/src/selection/classed.js
5049   function classArray(string) {
5050     return string.trim().split(/^|\s+/);
5051   }
5052   function classList(node) {
5053     return node.classList || new ClassList(node);
5054   }
5055   function ClassList(node) {
5056     this._node = node;
5057     this._names = classArray(node.getAttribute("class") || "");
5058   }
5059   function classedAdd(node, names) {
5060     var list = classList(node), i3 = -1, n3 = names.length;
5061     while (++i3 < n3) list.add(names[i3]);
5062   }
5063   function classedRemove(node, names) {
5064     var list = classList(node), i3 = -1, n3 = names.length;
5065     while (++i3 < n3) list.remove(names[i3]);
5066   }
5067   function classedTrue(names) {
5068     return function() {
5069       classedAdd(this, names);
5070     };
5071   }
5072   function classedFalse(names) {
5073     return function() {
5074       classedRemove(this, names);
5075     };
5076   }
5077   function classedFunction(names, value) {
5078     return function() {
5079       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
5080     };
5081   }
5082   function classed_default(name, value) {
5083     var names = classArray(name + "");
5084     if (arguments.length < 2) {
5085       var list = classList(this.node()), i3 = -1, n3 = names.length;
5086       while (++i3 < n3) if (!list.contains(names[i3])) return false;
5087       return true;
5088     }
5089     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
5090   }
5091   var init_classed = __esm({
5092     "node_modules/d3-selection/src/selection/classed.js"() {
5093       ClassList.prototype = {
5094         add: function(name) {
5095           var i3 = this._names.indexOf(name);
5096           if (i3 < 0) {
5097             this._names.push(name);
5098             this._node.setAttribute("class", this._names.join(" "));
5099           }
5100         },
5101         remove: function(name) {
5102           var i3 = this._names.indexOf(name);
5103           if (i3 >= 0) {
5104             this._names.splice(i3, 1);
5105             this._node.setAttribute("class", this._names.join(" "));
5106           }
5107         },
5108         contains: function(name) {
5109           return this._names.indexOf(name) >= 0;
5110         }
5111       };
5112     }
5113   });
5114
5115   // node_modules/d3-selection/src/selection/text.js
5116   function textRemove() {
5117     this.textContent = "";
5118   }
5119   function textConstant(value) {
5120     return function() {
5121       this.textContent = value;
5122     };
5123   }
5124   function textFunction(value) {
5125     return function() {
5126       var v3 = value.apply(this, arguments);
5127       this.textContent = v3 == null ? "" : v3;
5128     };
5129   }
5130   function text_default(value) {
5131     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
5132   }
5133   var init_text = __esm({
5134     "node_modules/d3-selection/src/selection/text.js"() {
5135     }
5136   });
5137
5138   // node_modules/d3-selection/src/selection/html.js
5139   function htmlRemove() {
5140     this.innerHTML = "";
5141   }
5142   function htmlConstant(value) {
5143     return function() {
5144       this.innerHTML = value;
5145     };
5146   }
5147   function htmlFunction(value) {
5148     return function() {
5149       var v3 = value.apply(this, arguments);
5150       this.innerHTML = v3 == null ? "" : v3;
5151     };
5152   }
5153   function html_default(value) {
5154     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
5155   }
5156   var init_html = __esm({
5157     "node_modules/d3-selection/src/selection/html.js"() {
5158     }
5159   });
5160
5161   // node_modules/d3-selection/src/selection/raise.js
5162   function raise() {
5163     if (this.nextSibling) this.parentNode.appendChild(this);
5164   }
5165   function raise_default() {
5166     return this.each(raise);
5167   }
5168   var init_raise = __esm({
5169     "node_modules/d3-selection/src/selection/raise.js"() {
5170     }
5171   });
5172
5173   // node_modules/d3-selection/src/selection/lower.js
5174   function lower() {
5175     if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
5176   }
5177   function lower_default() {
5178     return this.each(lower);
5179   }
5180   var init_lower = __esm({
5181     "node_modules/d3-selection/src/selection/lower.js"() {
5182     }
5183   });
5184
5185   // node_modules/d3-selection/src/selection/append.js
5186   function append_default(name) {
5187     var create2 = typeof name === "function" ? name : creator_default(name);
5188     return this.select(function() {
5189       return this.appendChild(create2.apply(this, arguments));
5190     });
5191   }
5192   var init_append = __esm({
5193     "node_modules/d3-selection/src/selection/append.js"() {
5194       init_creator();
5195     }
5196   });
5197
5198   // node_modules/d3-selection/src/selection/insert.js
5199   function constantNull() {
5200     return null;
5201   }
5202   function insert_default(name, before) {
5203     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
5204     return this.select(function() {
5205       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
5206     });
5207   }
5208   var init_insert = __esm({
5209     "node_modules/d3-selection/src/selection/insert.js"() {
5210       init_creator();
5211       init_selector();
5212     }
5213   });
5214
5215   // node_modules/d3-selection/src/selection/remove.js
5216   function remove() {
5217     var parent2 = this.parentNode;
5218     if (parent2) parent2.removeChild(this);
5219   }
5220   function remove_default() {
5221     return this.each(remove);
5222   }
5223   var init_remove = __esm({
5224     "node_modules/d3-selection/src/selection/remove.js"() {
5225     }
5226   });
5227
5228   // node_modules/d3-selection/src/selection/clone.js
5229   function selection_cloneShallow() {
5230     var clone2 = this.cloneNode(false), parent2 = this.parentNode;
5231     return parent2 ? parent2.insertBefore(clone2, this.nextSibling) : clone2;
5232   }
5233   function selection_cloneDeep() {
5234     var clone2 = this.cloneNode(true), parent2 = this.parentNode;
5235     return parent2 ? parent2.insertBefore(clone2, this.nextSibling) : clone2;
5236   }
5237   function clone_default(deep) {
5238     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
5239   }
5240   var init_clone = __esm({
5241     "node_modules/d3-selection/src/selection/clone.js"() {
5242     }
5243   });
5244
5245   // node_modules/d3-selection/src/selection/datum.js
5246   function datum_default(value) {
5247     return arguments.length ? this.property("__data__", value) : this.node().__data__;
5248   }
5249   var init_datum = __esm({
5250     "node_modules/d3-selection/src/selection/datum.js"() {
5251     }
5252   });
5253
5254   // node_modules/d3-selection/src/selection/on.js
5255   function contextListener(listener) {
5256     return function(event) {
5257       listener.call(this, event, this.__data__);
5258     };
5259   }
5260   function parseTypenames2(typenames) {
5261     return typenames.trim().split(/^|\s+/).map(function(t2) {
5262       var name = "", i3 = t2.indexOf(".");
5263       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
5264       return { type: t2, name };
5265     });
5266   }
5267   function onRemove(typename) {
5268     return function() {
5269       var on = this.__on;
5270       if (!on) return;
5271       for (var j3 = 0, i3 = -1, m3 = on.length, o2; j3 < m3; ++j3) {
5272         if (o2 = on[j3], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
5273           this.removeEventListener(o2.type, o2.listener, o2.options);
5274         } else {
5275           on[++i3] = o2;
5276         }
5277       }
5278       if (++i3) on.length = i3;
5279       else delete this.__on;
5280     };
5281   }
5282   function onAdd(typename, value, options) {
5283     return function() {
5284       var on = this.__on, o2, listener = contextListener(value);
5285       if (on) for (var j3 = 0, m3 = on.length; j3 < m3; ++j3) {
5286         if ((o2 = on[j3]).type === typename.type && o2.name === typename.name) {
5287           this.removeEventListener(o2.type, o2.listener, o2.options);
5288           this.addEventListener(o2.type, o2.listener = listener, o2.options = options);
5289           o2.value = value;
5290           return;
5291         }
5292       }
5293       this.addEventListener(typename.type, listener, options);
5294       o2 = { type: typename.type, name: typename.name, value, listener, options };
5295       if (!on) this.__on = [o2];
5296       else on.push(o2);
5297     };
5298   }
5299   function on_default(typename, value, options) {
5300     var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
5301     if (arguments.length < 2) {
5302       var on = this.node().__on;
5303       if (on) for (var j3 = 0, m3 = on.length, o2; j3 < m3; ++j3) {
5304         for (i3 = 0, o2 = on[j3]; i3 < n3; ++i3) {
5305           if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
5306             return o2.value;
5307           }
5308         }
5309       }
5310       return;
5311     }
5312     on = value ? onAdd : onRemove;
5313     for (i3 = 0; i3 < n3; ++i3) this.each(on(typenames[i3], value, options));
5314     return this;
5315   }
5316   var init_on = __esm({
5317     "node_modules/d3-selection/src/selection/on.js"() {
5318     }
5319   });
5320
5321   // node_modules/d3-selection/src/selection/dispatch.js
5322   function dispatchEvent(node, type2, params) {
5323     var window2 = window_default(node), event = window2.CustomEvent;
5324     if (typeof event === "function") {
5325       event = new event(type2, params);
5326     } else {
5327       event = window2.document.createEvent("Event");
5328       if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
5329       else event.initEvent(type2, false, false);
5330     }
5331     node.dispatchEvent(event);
5332   }
5333   function dispatchConstant(type2, params) {
5334     return function() {
5335       return dispatchEvent(this, type2, params);
5336     };
5337   }
5338   function dispatchFunction(type2, params) {
5339     return function() {
5340       return dispatchEvent(this, type2, params.apply(this, arguments));
5341     };
5342   }
5343   function dispatch_default2(type2, params) {
5344     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
5345   }
5346   var init_dispatch2 = __esm({
5347     "node_modules/d3-selection/src/selection/dispatch.js"() {
5348       init_window();
5349     }
5350   });
5351
5352   // node_modules/d3-selection/src/selection/iterator.js
5353   function* iterator_default() {
5354     for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) {
5355       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
5356         if (node = group[i3]) yield node;
5357       }
5358     }
5359   }
5360   var init_iterator = __esm({
5361     "node_modules/d3-selection/src/selection/iterator.js"() {
5362     }
5363   });
5364
5365   // node_modules/d3-selection/src/selection/index.js
5366   function Selection(groups, parents) {
5367     this._groups = groups;
5368     this._parents = parents;
5369   }
5370   function selection() {
5371     return new Selection([[document.documentElement]], root);
5372   }
5373   function selection_selection() {
5374     return this;
5375   }
5376   var root, selection_default;
5377   var init_selection = __esm({
5378     "node_modules/d3-selection/src/selection/index.js"() {
5379       init_select();
5380       init_selectAll();
5381       init_selectChild();
5382       init_selectChildren();
5383       init_filter();
5384       init_data();
5385       init_enter();
5386       init_exit();
5387       init_join();
5388       init_merge2();
5389       init_order();
5390       init_sort2();
5391       init_call();
5392       init_nodes();
5393       init_node();
5394       init_size();
5395       init_empty();
5396       init_each();
5397       init_attr();
5398       init_style();
5399       init_property();
5400       init_classed();
5401       init_text();
5402       init_html();
5403       init_raise();
5404       init_lower();
5405       init_append();
5406       init_insert();
5407       init_remove();
5408       init_clone();
5409       init_datum();
5410       init_on();
5411       init_dispatch2();
5412       init_iterator();
5413       root = [null];
5414       Selection.prototype = selection.prototype = {
5415         constructor: Selection,
5416         select: select_default,
5417         selectAll: selectAll_default,
5418         selectChild: selectChild_default,
5419         selectChildren: selectChildren_default,
5420         filter: filter_default,
5421         data: data_default,
5422         enter: enter_default,
5423         exit: exit_default,
5424         join: join_default,
5425         merge: merge_default,
5426         selection: selection_selection,
5427         order: order_default,
5428         sort: sort_default,
5429         call: call_default,
5430         nodes: nodes_default,
5431         node: node_default,
5432         size: size_default,
5433         empty: empty_default,
5434         each: each_default,
5435         attr: attr_default,
5436         style: style_default,
5437         property: property_default,
5438         classed: classed_default,
5439         text: text_default,
5440         html: html_default,
5441         raise: raise_default,
5442         lower: lower_default,
5443         append: append_default,
5444         insert: insert_default,
5445         remove: remove_default,
5446         clone: clone_default,
5447         datum: datum_default,
5448         on: on_default,
5449         dispatch: dispatch_default2,
5450         [Symbol.iterator]: iterator_default
5451       };
5452       selection_default = selection;
5453     }
5454   });
5455
5456   // node_modules/d3-selection/src/select.js
5457   function select_default2(selector) {
5458     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
5459   }
5460   var init_select2 = __esm({
5461     "node_modules/d3-selection/src/select.js"() {
5462       init_selection();
5463     }
5464   });
5465
5466   // node_modules/d3-selection/src/sourceEvent.js
5467   function sourceEvent_default(event) {
5468     let sourceEvent;
5469     while (sourceEvent = event.sourceEvent) event = sourceEvent;
5470     return event;
5471   }
5472   var init_sourceEvent = __esm({
5473     "node_modules/d3-selection/src/sourceEvent.js"() {
5474     }
5475   });
5476
5477   // node_modules/d3-selection/src/pointer.js
5478   function pointer_default(event, node) {
5479     event = sourceEvent_default(event);
5480     if (node === void 0) node = event.currentTarget;
5481     if (node) {
5482       var svg2 = node.ownerSVGElement || node;
5483       if (svg2.createSVGPoint) {
5484         var point = svg2.createSVGPoint();
5485         point.x = event.clientX, point.y = event.clientY;
5486         point = point.matrixTransform(node.getScreenCTM().inverse());
5487         return [point.x, point.y];
5488       }
5489       if (node.getBoundingClientRect) {
5490         var rect = node.getBoundingClientRect();
5491         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
5492       }
5493     }
5494     return [event.pageX, event.pageY];
5495   }
5496   var init_pointer = __esm({
5497     "node_modules/d3-selection/src/pointer.js"() {
5498       init_sourceEvent();
5499     }
5500   });
5501
5502   // node_modules/d3-selection/src/selectAll.js
5503   function selectAll_default2(selector) {
5504     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
5505   }
5506   var init_selectAll2 = __esm({
5507     "node_modules/d3-selection/src/selectAll.js"() {
5508       init_array();
5509       init_selection();
5510     }
5511   });
5512
5513   // node_modules/d3-selection/src/index.js
5514   var init_src5 = __esm({
5515     "node_modules/d3-selection/src/index.js"() {
5516       init_matcher();
5517       init_namespace();
5518       init_pointer();
5519       init_select2();
5520       init_selectAll2();
5521       init_selection();
5522       init_selector();
5523       init_selectorAll();
5524       init_style();
5525     }
5526   });
5527
5528   // node_modules/d3-drag/src/noevent.js
5529   function nopropagation(event) {
5530     event.stopImmediatePropagation();
5531   }
5532   function noevent_default(event) {
5533     event.preventDefault();
5534     event.stopImmediatePropagation();
5535   }
5536   var nonpassive, nonpassivecapture;
5537   var init_noevent = __esm({
5538     "node_modules/d3-drag/src/noevent.js"() {
5539       nonpassive = { passive: false };
5540       nonpassivecapture = { capture: true, passive: false };
5541     }
5542   });
5543
5544   // node_modules/d3-drag/src/nodrag.js
5545   function nodrag_default(view) {
5546     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
5547     if ("onselectstart" in root3) {
5548       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
5549     } else {
5550       root3.__noselect = root3.style.MozUserSelect;
5551       root3.style.MozUserSelect = "none";
5552     }
5553   }
5554   function yesdrag(view, noclick) {
5555     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
5556     if (noclick) {
5557       selection2.on("click.drag", noevent_default, nonpassivecapture);
5558       setTimeout(function() {
5559         selection2.on("click.drag", null);
5560       }, 0);
5561     }
5562     if ("onselectstart" in root3) {
5563       selection2.on("selectstart.drag", null);
5564     } else {
5565       root3.style.MozUserSelect = root3.__noselect;
5566       delete root3.__noselect;
5567     }
5568   }
5569   var init_nodrag = __esm({
5570     "node_modules/d3-drag/src/nodrag.js"() {
5571       init_src5();
5572       init_noevent();
5573     }
5574   });
5575
5576   // node_modules/d3-drag/src/constant.js
5577   var constant_default2;
5578   var init_constant2 = __esm({
5579     "node_modules/d3-drag/src/constant.js"() {
5580       constant_default2 = (x2) => () => x2;
5581     }
5582   });
5583
5584   // node_modules/d3-drag/src/event.js
5585   function DragEvent(type2, {
5586     sourceEvent,
5587     subject,
5588     target,
5589     identifier,
5590     active,
5591     x: x2,
5592     y: y2,
5593     dx,
5594     dy,
5595     dispatch: dispatch14
5596   }) {
5597     Object.defineProperties(this, {
5598       type: { value: type2, enumerable: true, configurable: true },
5599       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
5600       subject: { value: subject, enumerable: true, configurable: true },
5601       target: { value: target, enumerable: true, configurable: true },
5602       identifier: { value: identifier, enumerable: true, configurable: true },
5603       active: { value: active, enumerable: true, configurable: true },
5604       x: { value: x2, enumerable: true, configurable: true },
5605       y: { value: y2, enumerable: true, configurable: true },
5606       dx: { value: dx, enumerable: true, configurable: true },
5607       dy: { value: dy, enumerable: true, configurable: true },
5608       _: { value: dispatch14 }
5609     });
5610   }
5611   var init_event = __esm({
5612     "node_modules/d3-drag/src/event.js"() {
5613       DragEvent.prototype.on = function() {
5614         var value = this._.on.apply(this._, arguments);
5615         return value === this._ ? this : value;
5616       };
5617     }
5618   });
5619
5620   // node_modules/d3-drag/src/drag.js
5621   function defaultFilter(event) {
5622     return !event.ctrlKey && !event.button;
5623   }
5624   function defaultContainer() {
5625     return this.parentNode;
5626   }
5627   function defaultSubject(event, d2) {
5628     return d2 == null ? { x: event.x, y: event.y } : d2;
5629   }
5630   function defaultTouchable() {
5631     return navigator.maxTouchPoints || "ontouchstart" in this;
5632   }
5633   function drag_default() {
5634     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
5635     function drag(selection2) {
5636       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)");
5637     }
5638     function mousedowned(event, d2) {
5639       if (touchending || !filter2.call(this, event, d2)) return;
5640       var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
5641       if (!gesture) return;
5642       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
5643       nodrag_default(event.view);
5644       nopropagation(event);
5645       mousemoving = false;
5646       mousedownx = event.clientX;
5647       mousedowny = event.clientY;
5648       gesture("start", event);
5649     }
5650     function mousemoved(event) {
5651       noevent_default(event);
5652       if (!mousemoving) {
5653         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
5654         mousemoving = dx * dx + dy * dy > clickDistance2;
5655       }
5656       gestures.mouse("drag", event);
5657     }
5658     function mouseupped(event) {
5659       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
5660       yesdrag(event.view, mousemoving);
5661       noevent_default(event);
5662       gestures.mouse("end", event);
5663     }
5664     function touchstarted(event, d2) {
5665       if (!filter2.call(this, event, d2)) return;
5666       var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
5667       for (i3 = 0; i3 < n3; ++i3) {
5668         if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
5669           nopropagation(event);
5670           gesture("start", event, touches[i3]);
5671         }
5672       }
5673     }
5674     function touchmoved(event) {
5675       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
5676       for (i3 = 0; i3 < n3; ++i3) {
5677         if (gesture = gestures[touches[i3].identifier]) {
5678           noevent_default(event);
5679           gesture("drag", event, touches[i3]);
5680         }
5681       }
5682     }
5683     function touchended(event) {
5684       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
5685       if (touchending) clearTimeout(touchending);
5686       touchending = setTimeout(function() {
5687         touchending = null;
5688       }, 500);
5689       for (i3 = 0; i3 < n3; ++i3) {
5690         if (gesture = gestures[touches[i3].identifier]) {
5691           nopropagation(event);
5692           gesture("end", event, touches[i3]);
5693         }
5694       }
5695     }
5696     function beforestart(that, container2, event, d2, identifier, touch) {
5697       var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
5698       if ((s2 = subject.call(that, new DragEvent("beforestart", {
5699         sourceEvent: event,
5700         target: drag,
5701         identifier,
5702         active,
5703         x: p2[0],
5704         y: p2[1],
5705         dx: 0,
5706         dy: 0,
5707         dispatch: dispatch14
5708       }), d2)) == null) return;
5709       dx = s2.x - p2[0] || 0;
5710       dy = s2.y - p2[1] || 0;
5711       return function gesture(type2, event2, touch2) {
5712         var p02 = p2, n3;
5713         switch (type2) {
5714           case "start":
5715             gestures[identifier] = gesture, n3 = active++;
5716             break;
5717           case "end":
5718             delete gestures[identifier], --active;
5719           // falls through
5720           case "drag":
5721             p2 = pointer_default(touch2 || event2, container2), n3 = active;
5722             break;
5723         }
5724         dispatch14.call(
5725           type2,
5726           that,
5727           new DragEvent(type2, {
5728             sourceEvent: event2,
5729             subject: s2,
5730             target: drag,
5731             identifier,
5732             active: n3,
5733             x: p2[0] + dx,
5734             y: p2[1] + dy,
5735             dx: p2[0] - p02[0],
5736             dy: p2[1] - p02[1],
5737             dispatch: dispatch14
5738           }),
5739           d2
5740         );
5741       };
5742     }
5743     drag.filter = function(_3) {
5744       return arguments.length ? (filter2 = typeof _3 === "function" ? _3 : constant_default2(!!_3), drag) : filter2;
5745     };
5746     drag.container = function(_3) {
5747       return arguments.length ? (container = typeof _3 === "function" ? _3 : constant_default2(_3), drag) : container;
5748     };
5749     drag.subject = function(_3) {
5750       return arguments.length ? (subject = typeof _3 === "function" ? _3 : constant_default2(_3), drag) : subject;
5751     };
5752     drag.touchable = function(_3) {
5753       return arguments.length ? (touchable = typeof _3 === "function" ? _3 : constant_default2(!!_3), drag) : touchable;
5754     };
5755     drag.on = function() {
5756       var value = listeners.on.apply(listeners, arguments);
5757       return value === listeners ? drag : value;
5758     };
5759     drag.clickDistance = function(_3) {
5760       return arguments.length ? (clickDistance2 = (_3 = +_3) * _3, drag) : Math.sqrt(clickDistance2);
5761     };
5762     return drag;
5763   }
5764   var init_drag = __esm({
5765     "node_modules/d3-drag/src/drag.js"() {
5766       init_src4();
5767       init_src5();
5768       init_nodrag();
5769       init_noevent();
5770       init_constant2();
5771       init_event();
5772     }
5773   });
5774
5775   // node_modules/d3-drag/src/index.js
5776   var init_src6 = __esm({
5777     "node_modules/d3-drag/src/index.js"() {
5778       init_drag();
5779       init_nodrag();
5780     }
5781   });
5782
5783   // node_modules/d3-color/src/define.js
5784   function define_default(constructor, factory, prototype4) {
5785     constructor.prototype = factory.prototype = prototype4;
5786     prototype4.constructor = constructor;
5787   }
5788   function extend(parent2, definition) {
5789     var prototype4 = Object.create(parent2.prototype);
5790     for (var key in definition) prototype4[key] = definition[key];
5791     return prototype4;
5792   }
5793   var init_define = __esm({
5794     "node_modules/d3-color/src/define.js"() {
5795     }
5796   });
5797
5798   // node_modules/d3-color/src/color.js
5799   function Color() {
5800   }
5801   function color_formatHex() {
5802     return this.rgb().formatHex();
5803   }
5804   function color_formatHex8() {
5805     return this.rgb().formatHex8();
5806   }
5807   function color_formatHsl() {
5808     return hslConvert(this).formatHsl();
5809   }
5810   function color_formatRgb() {
5811     return this.rgb().formatRgb();
5812   }
5813   function color(format2) {
5814     var m3, l2;
5815     format2 = (format2 + "").trim().toLowerCase();
5816     return (m3 = reHex.exec(format2)) ? (l2 = m3[1].length, m3 = parseInt(m3[1], 16), l2 === 6 ? rgbn(m3) : l2 === 3 ? new Rgb(m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, (m3 & 15) << 4 | m3 & 15, 1) : l2 === 8 ? rgba(m3 >> 24 & 255, m3 >> 16 & 255, m3 >> 8 & 255, (m3 & 255) / 255) : l2 === 4 ? rgba(m3 >> 12 & 15 | m3 >> 8 & 240, m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, ((m3 & 15) << 4 | m3 & 15) / 255) : null) : (m3 = reRgbInteger.exec(format2)) ? new Rgb(m3[1], m3[2], m3[3], 1) : (m3 = reRgbPercent.exec(format2)) ? new Rgb(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, 1) : (m3 = reRgbaInteger.exec(format2)) ? rgba(m3[1], m3[2], m3[3], m3[4]) : (m3 = reRgbaPercent.exec(format2)) ? rgba(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, m3[4]) : (m3 = reHslPercent.exec(format2)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, 1) : (m3 = reHslaPercent.exec(format2)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, m3[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
5817   }
5818   function rgbn(n3) {
5819     return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
5820   }
5821   function rgba(r2, g3, b3, a4) {
5822     if (a4 <= 0) r2 = g3 = b3 = NaN;
5823     return new Rgb(r2, g3, b3, a4);
5824   }
5825   function rgbConvert(o2) {
5826     if (!(o2 instanceof Color)) o2 = color(o2);
5827     if (!o2) return new Rgb();
5828     o2 = o2.rgb();
5829     return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
5830   }
5831   function rgb(r2, g3, b3, opacity) {
5832     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b3, opacity == null ? 1 : opacity);
5833   }
5834   function Rgb(r2, g3, b3, opacity) {
5835     this.r = +r2;
5836     this.g = +g3;
5837     this.b = +b3;
5838     this.opacity = +opacity;
5839   }
5840   function rgb_formatHex() {
5841     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
5842   }
5843   function rgb_formatHex8() {
5844     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
5845   }
5846   function rgb_formatRgb() {
5847     const a4 = clampa(this.opacity);
5848     return `${a4 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a4 === 1 ? ")" : `, ${a4})`}`;
5849   }
5850   function clampa(opacity) {
5851     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
5852   }
5853   function clampi(value) {
5854     return Math.max(0, Math.min(255, Math.round(value) || 0));
5855   }
5856   function hex(value) {
5857     value = clampi(value);
5858     return (value < 16 ? "0" : "") + value.toString(16);
5859   }
5860   function hsla(h3, s2, l2, a4) {
5861     if (a4 <= 0) h3 = s2 = l2 = NaN;
5862     else if (l2 <= 0 || l2 >= 1) h3 = s2 = NaN;
5863     else if (s2 <= 0) h3 = NaN;
5864     return new Hsl(h3, s2, l2, a4);
5865   }
5866   function hslConvert(o2) {
5867     if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
5868     if (!(o2 instanceof Color)) o2 = color(o2);
5869     if (!o2) return new Hsl();
5870     if (o2 instanceof Hsl) return o2;
5871     o2 = o2.rgb();
5872     var r2 = o2.r / 255, g3 = o2.g / 255, b3 = o2.b / 255, min3 = Math.min(r2, g3, b3), max3 = Math.max(r2, g3, b3), h3 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
5873     if (s2) {
5874       if (r2 === max3) h3 = (g3 - b3) / s2 + (g3 < b3) * 6;
5875       else if (g3 === max3) h3 = (b3 - r2) / s2 + 2;
5876       else h3 = (r2 - g3) / s2 + 4;
5877       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
5878       h3 *= 60;
5879     } else {
5880       s2 = l2 > 0 && l2 < 1 ? 0 : h3;
5881     }
5882     return new Hsl(h3, s2, l2, o2.opacity);
5883   }
5884   function hsl(h3, s2, l2, opacity) {
5885     return arguments.length === 1 ? hslConvert(h3) : new Hsl(h3, s2, l2, opacity == null ? 1 : opacity);
5886   }
5887   function Hsl(h3, s2, l2, opacity) {
5888     this.h = +h3;
5889     this.s = +s2;
5890     this.l = +l2;
5891     this.opacity = +opacity;
5892   }
5893   function clamph(value) {
5894     value = (value || 0) % 360;
5895     return value < 0 ? value + 360 : value;
5896   }
5897   function clampt(value) {
5898     return Math.max(0, Math.min(1, value || 0));
5899   }
5900   function hsl2rgb(h3, m1, m22) {
5901     return (h3 < 60 ? m1 + (m22 - m1) * h3 / 60 : h3 < 180 ? m22 : h3 < 240 ? m1 + (m22 - m1) * (240 - h3) / 60 : m1) * 255;
5902   }
5903   var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named;
5904   var init_color = __esm({
5905     "node_modules/d3-color/src/color.js"() {
5906       init_define();
5907       darker = 0.7;
5908       brighter = 1 / darker;
5909       reI = "\\s*([+-]?\\d+)\\s*";
5910       reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
5911       reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
5912       reHex = /^#([0-9a-f]{3,8})$/;
5913       reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
5914       reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
5915       reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
5916       reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
5917       reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
5918       reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
5919       named = {
5920         aliceblue: 15792383,
5921         antiquewhite: 16444375,
5922         aqua: 65535,
5923         aquamarine: 8388564,
5924         azure: 15794175,
5925         beige: 16119260,
5926         bisque: 16770244,
5927         black: 0,
5928         blanchedalmond: 16772045,
5929         blue: 255,
5930         blueviolet: 9055202,
5931         brown: 10824234,
5932         burlywood: 14596231,
5933         cadetblue: 6266528,
5934         chartreuse: 8388352,
5935         chocolate: 13789470,
5936         coral: 16744272,
5937         cornflowerblue: 6591981,
5938         cornsilk: 16775388,
5939         crimson: 14423100,
5940         cyan: 65535,
5941         darkblue: 139,
5942         darkcyan: 35723,
5943         darkgoldenrod: 12092939,
5944         darkgray: 11119017,
5945         darkgreen: 25600,
5946         darkgrey: 11119017,
5947         darkkhaki: 12433259,
5948         darkmagenta: 9109643,
5949         darkolivegreen: 5597999,
5950         darkorange: 16747520,
5951         darkorchid: 10040012,
5952         darkred: 9109504,
5953         darksalmon: 15308410,
5954         darkseagreen: 9419919,
5955         darkslateblue: 4734347,
5956         darkslategray: 3100495,
5957         darkslategrey: 3100495,
5958         darkturquoise: 52945,
5959         darkviolet: 9699539,
5960         deeppink: 16716947,
5961         deepskyblue: 49151,
5962         dimgray: 6908265,
5963         dimgrey: 6908265,
5964         dodgerblue: 2003199,
5965         firebrick: 11674146,
5966         floralwhite: 16775920,
5967         forestgreen: 2263842,
5968         fuchsia: 16711935,
5969         gainsboro: 14474460,
5970         ghostwhite: 16316671,
5971         gold: 16766720,
5972         goldenrod: 14329120,
5973         gray: 8421504,
5974         green: 32768,
5975         greenyellow: 11403055,
5976         grey: 8421504,
5977         honeydew: 15794160,
5978         hotpink: 16738740,
5979         indianred: 13458524,
5980         indigo: 4915330,
5981         ivory: 16777200,
5982         khaki: 15787660,
5983         lavender: 15132410,
5984         lavenderblush: 16773365,
5985         lawngreen: 8190976,
5986         lemonchiffon: 16775885,
5987         lightblue: 11393254,
5988         lightcoral: 15761536,
5989         lightcyan: 14745599,
5990         lightgoldenrodyellow: 16448210,
5991         lightgray: 13882323,
5992         lightgreen: 9498256,
5993         lightgrey: 13882323,
5994         lightpink: 16758465,
5995         lightsalmon: 16752762,
5996         lightseagreen: 2142890,
5997         lightskyblue: 8900346,
5998         lightslategray: 7833753,
5999         lightslategrey: 7833753,
6000         lightsteelblue: 11584734,
6001         lightyellow: 16777184,
6002         lime: 65280,
6003         limegreen: 3329330,
6004         linen: 16445670,
6005         magenta: 16711935,
6006         maroon: 8388608,
6007         mediumaquamarine: 6737322,
6008         mediumblue: 205,
6009         mediumorchid: 12211667,
6010         mediumpurple: 9662683,
6011         mediumseagreen: 3978097,
6012         mediumslateblue: 8087790,
6013         mediumspringgreen: 64154,
6014         mediumturquoise: 4772300,
6015         mediumvioletred: 13047173,
6016         midnightblue: 1644912,
6017         mintcream: 16121850,
6018         mistyrose: 16770273,
6019         moccasin: 16770229,
6020         navajowhite: 16768685,
6021         navy: 128,
6022         oldlace: 16643558,
6023         olive: 8421376,
6024         olivedrab: 7048739,
6025         orange: 16753920,
6026         orangered: 16729344,
6027         orchid: 14315734,
6028         palegoldenrod: 15657130,
6029         palegreen: 10025880,
6030         paleturquoise: 11529966,
6031         palevioletred: 14381203,
6032         papayawhip: 16773077,
6033         peachpuff: 16767673,
6034         peru: 13468991,
6035         pink: 16761035,
6036         plum: 14524637,
6037         powderblue: 11591910,
6038         purple: 8388736,
6039         rebeccapurple: 6697881,
6040         red: 16711680,
6041         rosybrown: 12357519,
6042         royalblue: 4286945,
6043         saddlebrown: 9127187,
6044         salmon: 16416882,
6045         sandybrown: 16032864,
6046         seagreen: 3050327,
6047         seashell: 16774638,
6048         sienna: 10506797,
6049         silver: 12632256,
6050         skyblue: 8900331,
6051         slateblue: 6970061,
6052         slategray: 7372944,
6053         slategrey: 7372944,
6054         snow: 16775930,
6055         springgreen: 65407,
6056         steelblue: 4620980,
6057         tan: 13808780,
6058         teal: 32896,
6059         thistle: 14204888,
6060         tomato: 16737095,
6061         turquoise: 4251856,
6062         violet: 15631086,
6063         wheat: 16113331,
6064         white: 16777215,
6065         whitesmoke: 16119285,
6066         yellow: 16776960,
6067         yellowgreen: 10145074
6068       };
6069       define_default(Color, color, {
6070         copy(channels) {
6071           return Object.assign(new this.constructor(), this, channels);
6072         },
6073         displayable() {
6074           return this.rgb().displayable();
6075         },
6076         hex: color_formatHex,
6077         // Deprecated! Use color.formatHex.
6078         formatHex: color_formatHex,
6079         formatHex8: color_formatHex8,
6080         formatHsl: color_formatHsl,
6081         formatRgb: color_formatRgb,
6082         toString: color_formatRgb
6083       });
6084       define_default(Rgb, rgb, extend(Color, {
6085         brighter(k3) {
6086           k3 = k3 == null ? brighter : Math.pow(brighter, k3);
6087           return new Rgb(this.r * k3, this.g * k3, this.b * k3, this.opacity);
6088         },
6089         darker(k3) {
6090           k3 = k3 == null ? darker : Math.pow(darker, k3);
6091           return new Rgb(this.r * k3, this.g * k3, this.b * k3, this.opacity);
6092         },
6093         rgb() {
6094           return this;
6095         },
6096         clamp() {
6097           return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
6098         },
6099         displayable() {
6100           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);
6101         },
6102         hex: rgb_formatHex,
6103         // Deprecated! Use color.formatHex.
6104         formatHex: rgb_formatHex,
6105         formatHex8: rgb_formatHex8,
6106         formatRgb: rgb_formatRgb,
6107         toString: rgb_formatRgb
6108       }));
6109       define_default(Hsl, hsl, extend(Color, {
6110         brighter(k3) {
6111           k3 = k3 == null ? brighter : Math.pow(brighter, k3);
6112           return new Hsl(this.h, this.s, this.l * k3, this.opacity);
6113         },
6114         darker(k3) {
6115           k3 = k3 == null ? darker : Math.pow(darker, k3);
6116           return new Hsl(this.h, this.s, this.l * k3, this.opacity);
6117         },
6118         rgb() {
6119           var h3 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h3) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m22 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m22;
6120           return new Rgb(
6121             hsl2rgb(h3 >= 240 ? h3 - 240 : h3 + 120, m1, m22),
6122             hsl2rgb(h3, m1, m22),
6123             hsl2rgb(h3 < 120 ? h3 + 240 : h3 - 120, m1, m22),
6124             this.opacity
6125           );
6126         },
6127         clamp() {
6128           return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
6129         },
6130         displayable() {
6131           return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
6132         },
6133         formatHsl() {
6134           const a4 = clampa(this.opacity);
6135           return `${a4 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a4 === 1 ? ")" : `, ${a4})`}`;
6136         }
6137       }));
6138     }
6139   });
6140
6141   // node_modules/d3-color/src/index.js
6142   var init_src7 = __esm({
6143     "node_modules/d3-color/src/index.js"() {
6144       init_color();
6145     }
6146   });
6147
6148   // node_modules/d3-interpolate/src/basis.js
6149   function basis(t12, v0, v1, v22, v3) {
6150     var t2 = t12 * t12, t3 = t2 * t12;
6151     return ((1 - 3 * t12 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t12 + 3 * t2 - 3 * t3) * v22 + t3 * v3) / 6;
6152   }
6153   function basis_default(values) {
6154     var n3 = values.length - 1;
6155     return function(t2) {
6156       var i3 = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n3 - 1) : Math.floor(t2 * n3), v1 = values[i3], v22 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v22, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v22 - v1;
6157       return basis((t2 - i3 / n3) * n3, v0, v1, v22, v3);
6158     };
6159   }
6160   var init_basis = __esm({
6161     "node_modules/d3-interpolate/src/basis.js"() {
6162     }
6163   });
6164
6165   // node_modules/d3-interpolate/src/basisClosed.js
6166   function basisClosed_default(values) {
6167     var n3 = values.length;
6168     return function(t2) {
6169       var i3 = Math.floor(((t2 %= 1) < 0 ? ++t2 : t2) * n3), v0 = values[(i3 + n3 - 1) % n3], v1 = values[i3 % n3], v22 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
6170       return basis((t2 - i3 / n3) * n3, v0, v1, v22, v3);
6171     };
6172   }
6173   var init_basisClosed = __esm({
6174     "node_modules/d3-interpolate/src/basisClosed.js"() {
6175       init_basis();
6176     }
6177   });
6178
6179   // node_modules/d3-interpolate/src/constant.js
6180   var constant_default3;
6181   var init_constant3 = __esm({
6182     "node_modules/d3-interpolate/src/constant.js"() {
6183       constant_default3 = (x2) => () => x2;
6184     }
6185   });
6186
6187   // node_modules/d3-interpolate/src/color.js
6188   function linear(a4, d2) {
6189     return function(t2) {
6190       return a4 + t2 * d2;
6191     };
6192   }
6193   function exponential(a4, b3, y2) {
6194     return a4 = Math.pow(a4, y2), b3 = Math.pow(b3, y2) - a4, y2 = 1 / y2, function(t2) {
6195       return Math.pow(a4 + t2 * b3, y2);
6196     };
6197   }
6198   function gamma(y2) {
6199     return (y2 = +y2) === 1 ? nogamma : function(a4, b3) {
6200       return b3 - a4 ? exponential(a4, b3, y2) : constant_default3(isNaN(a4) ? b3 : a4);
6201     };
6202   }
6203   function nogamma(a4, b3) {
6204     var d2 = b3 - a4;
6205     return d2 ? linear(a4, d2) : constant_default3(isNaN(a4) ? b3 : a4);
6206   }
6207   var init_color2 = __esm({
6208     "node_modules/d3-interpolate/src/color.js"() {
6209       init_constant3();
6210     }
6211   });
6212
6213   // node_modules/d3-interpolate/src/rgb.js
6214   function rgbSpline(spline) {
6215     return function(colors) {
6216       var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b3 = new Array(n3), i3, color2;
6217       for (i3 = 0; i3 < n3; ++i3) {
6218         color2 = rgb(colors[i3]);
6219         r2[i3] = color2.r || 0;
6220         g3[i3] = color2.g || 0;
6221         b3[i3] = color2.b || 0;
6222       }
6223       r2 = spline(r2);
6224       g3 = spline(g3);
6225       b3 = spline(b3);
6226       color2.opacity = 1;
6227       return function(t2) {
6228         color2.r = r2(t2);
6229         color2.g = g3(t2);
6230         color2.b = b3(t2);
6231         return color2 + "";
6232       };
6233     };
6234   }
6235   var rgb_default, rgbBasis, rgbBasisClosed;
6236   var init_rgb = __esm({
6237     "node_modules/d3-interpolate/src/rgb.js"() {
6238       init_src7();
6239       init_basis();
6240       init_basisClosed();
6241       init_color2();
6242       rgb_default = function rgbGamma(y2) {
6243         var color2 = gamma(y2);
6244         function rgb2(start2, end) {
6245           var r2 = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g3 = color2(start2.g, end.g), b3 = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
6246           return function(t2) {
6247             start2.r = r2(t2);
6248             start2.g = g3(t2);
6249             start2.b = b3(t2);
6250             start2.opacity = opacity(t2);
6251             return start2 + "";
6252           };
6253         }
6254         rgb2.gamma = rgbGamma;
6255         return rgb2;
6256       }(1);
6257       rgbBasis = rgbSpline(basis_default);
6258       rgbBasisClosed = rgbSpline(basisClosed_default);
6259     }
6260   });
6261
6262   // node_modules/d3-interpolate/src/numberArray.js
6263   function numberArray_default(a4, b3) {
6264     if (!b3) b3 = [];
6265     var n3 = a4 ? Math.min(b3.length, a4.length) : 0, c2 = b3.slice(), i3;
6266     return function(t2) {
6267       for (i3 = 0; i3 < n3; ++i3) c2[i3] = a4[i3] * (1 - t2) + b3[i3] * t2;
6268       return c2;
6269     };
6270   }
6271   function isNumberArray(x2) {
6272     return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
6273   }
6274   var init_numberArray = __esm({
6275     "node_modules/d3-interpolate/src/numberArray.js"() {
6276     }
6277   });
6278
6279   // node_modules/d3-interpolate/src/array.js
6280   function genericArray(a4, b3) {
6281     var nb = b3 ? b3.length : 0, na = a4 ? Math.min(nb, a4.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
6282     for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a4[i3], b3[i3]);
6283     for (; i3 < nb; ++i3) c2[i3] = b3[i3];
6284     return function(t2) {
6285       for (i3 = 0; i3 < na; ++i3) c2[i3] = x2[i3](t2);
6286       return c2;
6287     };
6288   }
6289   var init_array2 = __esm({
6290     "node_modules/d3-interpolate/src/array.js"() {
6291       init_value();
6292     }
6293   });
6294
6295   // node_modules/d3-interpolate/src/date.js
6296   function date_default(a4, b3) {
6297     var d2 = /* @__PURE__ */ new Date();
6298     return a4 = +a4, b3 = +b3, function(t2) {
6299       return d2.setTime(a4 * (1 - t2) + b3 * t2), d2;
6300     };
6301   }
6302   var init_date = __esm({
6303     "node_modules/d3-interpolate/src/date.js"() {
6304     }
6305   });
6306
6307   // node_modules/d3-interpolate/src/number.js
6308   function number_default(a4, b3) {
6309     return a4 = +a4, b3 = +b3, function(t2) {
6310       return a4 * (1 - t2) + b3 * t2;
6311     };
6312   }
6313   var init_number2 = __esm({
6314     "node_modules/d3-interpolate/src/number.js"() {
6315     }
6316   });
6317
6318   // node_modules/d3-interpolate/src/object.js
6319   function object_default(a4, b3) {
6320     var i3 = {}, c2 = {}, k3;
6321     if (a4 === null || typeof a4 !== "object") a4 = {};
6322     if (b3 === null || typeof b3 !== "object") b3 = {};
6323     for (k3 in b3) {
6324       if (k3 in a4) {
6325         i3[k3] = value_default(a4[k3], b3[k3]);
6326       } else {
6327         c2[k3] = b3[k3];
6328       }
6329     }
6330     return function(t2) {
6331       for (k3 in i3) c2[k3] = i3[k3](t2);
6332       return c2;
6333     };
6334   }
6335   var init_object = __esm({
6336     "node_modules/d3-interpolate/src/object.js"() {
6337       init_value();
6338     }
6339   });
6340
6341   // node_modules/d3-interpolate/src/string.js
6342   function zero2(b3) {
6343     return function() {
6344       return b3;
6345     };
6346   }
6347   function one(b3) {
6348     return function(t2) {
6349       return b3(t2) + "";
6350     };
6351   }
6352   function string_default(a4, b3) {
6353     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q3 = [];
6354     a4 = a4 + "", b3 = b3 + "";
6355     while ((am = reA.exec(a4)) && (bm = reB.exec(b3))) {
6356       if ((bs = bm.index) > bi) {
6357         bs = b3.slice(bi, bs);
6358         if (s2[i3]) s2[i3] += bs;
6359         else s2[++i3] = bs;
6360       }
6361       if ((am = am[0]) === (bm = bm[0])) {
6362         if (s2[i3]) s2[i3] += bm;
6363         else s2[++i3] = bm;
6364       } else {
6365         s2[++i3] = null;
6366         q3.push({ i: i3, x: number_default(am, bm) });
6367       }
6368       bi = reB.lastIndex;
6369     }
6370     if (bi < b3.length) {
6371       bs = b3.slice(bi);
6372       if (s2[i3]) s2[i3] += bs;
6373       else s2[++i3] = bs;
6374     }
6375     return s2.length < 2 ? q3[0] ? one(q3[0].x) : zero2(b3) : (b3 = q3.length, function(t2) {
6376       for (var i4 = 0, o2; i4 < b3; ++i4) s2[(o2 = q3[i4]).i] = o2.x(t2);
6377       return s2.join("");
6378     });
6379   }
6380   var reA, reB;
6381   var init_string2 = __esm({
6382     "node_modules/d3-interpolate/src/string.js"() {
6383       init_number2();
6384       reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
6385       reB = new RegExp(reA.source, "g");
6386     }
6387   });
6388
6389   // node_modules/d3-interpolate/src/value.js
6390   function value_default(a4, b3) {
6391     var t2 = typeof b3, c2;
6392     return b3 == null || t2 === "boolean" ? constant_default3(b3) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b3)) ? (b3 = c2, rgb_default) : string_default : b3 instanceof color ? rgb_default : b3 instanceof Date ? date_default : isNumberArray(b3) ? numberArray_default : Array.isArray(b3) ? genericArray : typeof b3.valueOf !== "function" && typeof b3.toString !== "function" || isNaN(b3) ? object_default : number_default)(a4, b3);
6393   }
6394   var init_value = __esm({
6395     "node_modules/d3-interpolate/src/value.js"() {
6396       init_src7();
6397       init_rgb();
6398       init_array2();
6399       init_date();
6400       init_number2();
6401       init_object();
6402       init_string2();
6403       init_constant3();
6404       init_numberArray();
6405     }
6406   });
6407
6408   // node_modules/d3-interpolate/src/round.js
6409   function round_default(a4, b3) {
6410     return a4 = +a4, b3 = +b3, function(t2) {
6411       return Math.round(a4 * (1 - t2) + b3 * t2);
6412     };
6413   }
6414   var init_round = __esm({
6415     "node_modules/d3-interpolate/src/round.js"() {
6416     }
6417   });
6418
6419   // node_modules/d3-interpolate/src/transform/decompose.js
6420   function decompose_default(a4, b3, c2, d2, e3, f2) {
6421     var scaleX, scaleY, skewX;
6422     if (scaleX = Math.sqrt(a4 * a4 + b3 * b3)) a4 /= scaleX, b3 /= scaleX;
6423     if (skewX = a4 * c2 + b3 * d2) c2 -= a4 * skewX, d2 -= b3 * skewX;
6424     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
6425     if (a4 * d2 < b3 * c2) a4 = -a4, b3 = -b3, skewX = -skewX, scaleX = -scaleX;
6426     return {
6427       translateX: e3,
6428       translateY: f2,
6429       rotate: Math.atan2(b3, a4) * degrees2,
6430       skewX: Math.atan(skewX) * degrees2,
6431       scaleX,
6432       scaleY
6433     };
6434   }
6435   var degrees2, identity;
6436   var init_decompose = __esm({
6437     "node_modules/d3-interpolate/src/transform/decompose.js"() {
6438       degrees2 = 180 / Math.PI;
6439       identity = {
6440         translateX: 0,
6441         translateY: 0,
6442         rotate: 0,
6443         skewX: 0,
6444         scaleX: 1,
6445         scaleY: 1
6446       };
6447     }
6448   });
6449
6450   // node_modules/d3-interpolate/src/transform/parse.js
6451   function parseCss(value) {
6452     const m3 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
6453     return m3.isIdentity ? identity : decompose_default(m3.a, m3.b, m3.c, m3.d, m3.e, m3.f);
6454   }
6455   function parseSvg(value) {
6456     if (value == null) return identity;
6457     if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
6458     svgNode.setAttribute("transform", value);
6459     if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
6460     value = value.matrix;
6461     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
6462   }
6463   var svgNode;
6464   var init_parse = __esm({
6465     "node_modules/d3-interpolate/src/transform/parse.js"() {
6466       init_decompose();
6467     }
6468   });
6469
6470   // node_modules/d3-interpolate/src/transform/index.js
6471   function interpolateTransform(parse, pxComma, pxParen, degParen) {
6472     function pop(s2) {
6473       return s2.length ? s2.pop() + " " : "";
6474     }
6475     function translate(xa, ya, xb, yb, s2, q3) {
6476       if (xa !== xb || ya !== yb) {
6477         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
6478         q3.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
6479       } else if (xb || yb) {
6480         s2.push("translate(" + xb + pxComma + yb + pxParen);
6481       }
6482     }
6483     function rotate(a4, b3, s2, q3) {
6484       if (a4 !== b3) {
6485         if (a4 - b3 > 180) b3 += 360;
6486         else if (b3 - a4 > 180) a4 += 360;
6487         q3.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a4, b3) });
6488       } else if (b3) {
6489         s2.push(pop(s2) + "rotate(" + b3 + degParen);
6490       }
6491     }
6492     function skewX(a4, b3, s2, q3) {
6493       if (a4 !== b3) {
6494         q3.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a4, b3) });
6495       } else if (b3) {
6496         s2.push(pop(s2) + "skewX(" + b3 + degParen);
6497       }
6498     }
6499     function scale(xa, ya, xb, yb, s2, q3) {
6500       if (xa !== xb || ya !== yb) {
6501         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
6502         q3.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
6503       } else if (xb !== 1 || yb !== 1) {
6504         s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
6505       }
6506     }
6507     return function(a4, b3) {
6508       var s2 = [], q3 = [];
6509       a4 = parse(a4), b3 = parse(b3);
6510       translate(a4.translateX, a4.translateY, b3.translateX, b3.translateY, s2, q3);
6511       rotate(a4.rotate, b3.rotate, s2, q3);
6512       skewX(a4.skewX, b3.skewX, s2, q3);
6513       scale(a4.scaleX, a4.scaleY, b3.scaleX, b3.scaleY, s2, q3);
6514       a4 = b3 = null;
6515       return function(t2) {
6516         var i3 = -1, n3 = q3.length, o2;
6517         while (++i3 < n3) s2[(o2 = q3[i3]).i] = o2.x(t2);
6518         return s2.join("");
6519       };
6520     };
6521   }
6522   var interpolateTransformCss, interpolateTransformSvg;
6523   var init_transform2 = __esm({
6524     "node_modules/d3-interpolate/src/transform/index.js"() {
6525       init_number2();
6526       init_parse();
6527       interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
6528       interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
6529     }
6530   });
6531
6532   // node_modules/d3-interpolate/src/zoom.js
6533   function cosh(x2) {
6534     return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
6535   }
6536   function sinh(x2) {
6537     return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
6538   }
6539   function tanh(x2) {
6540     return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
6541   }
6542   var epsilon22, zoom_default;
6543   var init_zoom = __esm({
6544     "node_modules/d3-interpolate/src/zoom.js"() {
6545       epsilon22 = 1e-12;
6546       zoom_default = function zoomRho(rho, rho2, rho4) {
6547         function zoom(p02, p1) {
6548           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, i3, S3;
6549           if (d2 < epsilon22) {
6550             S3 = Math.log(w1 / w0) / rho;
6551             i3 = function(t2) {
6552               return [
6553                 ux0 + t2 * dx,
6554                 uy0 + t2 * dy,
6555                 w0 * Math.exp(rho * t2 * S3)
6556               ];
6557             };
6558           } else {
6559             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);
6560             S3 = (r1 - r0) / rho;
6561             i3 = function(t2) {
6562               var s2 = t2 * S3, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
6563               return [
6564                 ux0 + u2 * dx,
6565                 uy0 + u2 * dy,
6566                 w0 * coshr0 / cosh(rho * s2 + r0)
6567               ];
6568             };
6569           }
6570           i3.duration = S3 * 1e3 * rho / Math.SQRT2;
6571           return i3;
6572         }
6573         zoom.rho = function(_3) {
6574           var _1 = Math.max(1e-3, +_3), _22 = _1 * _1, _4 = _22 * _22;
6575           return zoomRho(_1, _22, _4);
6576         };
6577         return zoom;
6578       }(Math.SQRT2, 2, 4);
6579     }
6580   });
6581
6582   // node_modules/d3-interpolate/src/quantize.js
6583   function quantize_default(interpolator, n3) {
6584     var samples = new Array(n3);
6585     for (var i3 = 0; i3 < n3; ++i3) samples[i3] = interpolator(i3 / (n3 - 1));
6586     return samples;
6587   }
6588   var init_quantize = __esm({
6589     "node_modules/d3-interpolate/src/quantize.js"() {
6590     }
6591   });
6592
6593   // node_modules/d3-interpolate/src/index.js
6594   var init_src8 = __esm({
6595     "node_modules/d3-interpolate/src/index.js"() {
6596       init_value();
6597       init_number2();
6598       init_round();
6599       init_string2();
6600       init_transform2();
6601       init_zoom();
6602       init_rgb();
6603       init_quantize();
6604     }
6605   });
6606
6607   // node_modules/d3-timer/src/timer.js
6608   function now() {
6609     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
6610   }
6611   function clearNow() {
6612     clockNow = 0;
6613   }
6614   function Timer() {
6615     this._call = this._time = this._next = null;
6616   }
6617   function timer(callback, delay, time) {
6618     var t2 = new Timer();
6619     t2.restart(callback, delay, time);
6620     return t2;
6621   }
6622   function timerFlush() {
6623     now();
6624     ++frame;
6625     var t2 = taskHead, e3;
6626     while (t2) {
6627       if ((e3 = clockNow - t2._time) >= 0) t2._call.call(void 0, e3);
6628       t2 = t2._next;
6629     }
6630     --frame;
6631   }
6632   function wake() {
6633     clockNow = (clockLast = clock.now()) + clockSkew;
6634     frame = timeout = 0;
6635     try {
6636       timerFlush();
6637     } finally {
6638       frame = 0;
6639       nap();
6640       clockNow = 0;
6641     }
6642   }
6643   function poke() {
6644     var now3 = clock.now(), delay = now3 - clockLast;
6645     if (delay > pokeDelay) clockSkew -= delay, clockLast = now3;
6646   }
6647   function nap() {
6648     var t02, t12 = taskHead, t2, time = Infinity;
6649     while (t12) {
6650       if (t12._call) {
6651         if (time > t12._time) time = t12._time;
6652         t02 = t12, t12 = t12._next;
6653       } else {
6654         t2 = t12._next, t12._next = null;
6655         t12 = t02 ? t02._next = t2 : taskHead = t2;
6656       }
6657     }
6658     taskTail = t02;
6659     sleep(time);
6660   }
6661   function sleep(time) {
6662     if (frame) return;
6663     if (timeout) timeout = clearTimeout(timeout);
6664     var delay = time - clockNow;
6665     if (delay > 24) {
6666       if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
6667       if (interval) interval = clearInterval(interval);
6668     } else {
6669       if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
6670       frame = 1, setFrame(wake);
6671     }
6672   }
6673   var frame, timeout, interval, pokeDelay, taskHead, taskTail, clockLast, clockNow, clockSkew, clock, setFrame;
6674   var init_timer = __esm({
6675     "node_modules/d3-timer/src/timer.js"() {
6676       frame = 0;
6677       timeout = 0;
6678       interval = 0;
6679       pokeDelay = 1e3;
6680       clockLast = 0;
6681       clockNow = 0;
6682       clockSkew = 0;
6683       clock = typeof performance === "object" && performance.now ? performance : Date;
6684       setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
6685         setTimeout(f2, 17);
6686       };
6687       Timer.prototype = timer.prototype = {
6688         constructor: Timer,
6689         restart: function(callback, delay, time) {
6690           if (typeof callback !== "function") throw new TypeError("callback is not a function");
6691           time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
6692           if (!this._next && taskTail !== this) {
6693             if (taskTail) taskTail._next = this;
6694             else taskHead = this;
6695             taskTail = this;
6696           }
6697           this._call = callback;
6698           this._time = time;
6699           sleep();
6700         },
6701         stop: function() {
6702           if (this._call) {
6703             this._call = null;
6704             this._time = Infinity;
6705             sleep();
6706           }
6707         }
6708       };
6709     }
6710   });
6711
6712   // node_modules/d3-timer/src/timeout.js
6713   function timeout_default(callback, delay, time) {
6714     var t2 = new Timer();
6715     delay = delay == null ? 0 : +delay;
6716     t2.restart((elapsed) => {
6717       t2.stop();
6718       callback(elapsed + delay);
6719     }, delay, time);
6720     return t2;
6721   }
6722   var init_timeout = __esm({
6723     "node_modules/d3-timer/src/timeout.js"() {
6724       init_timer();
6725     }
6726   });
6727
6728   // node_modules/d3-timer/src/index.js
6729   var init_src9 = __esm({
6730     "node_modules/d3-timer/src/index.js"() {
6731       init_timer();
6732       init_timeout();
6733     }
6734   });
6735
6736   // node_modules/d3-transition/src/transition/schedule.js
6737   function schedule_default(node, name, id2, index, group, timing) {
6738     var schedules = node.__transition;
6739     if (!schedules) node.__transition = {};
6740     else if (id2 in schedules) return;
6741     create(node, id2, {
6742       name,
6743       index,
6744       // For context during callback.
6745       group,
6746       // For context during callback.
6747       on: emptyOn,
6748       tween: emptyTween,
6749       time: timing.time,
6750       delay: timing.delay,
6751       duration: timing.duration,
6752       ease: timing.ease,
6753       timer: null,
6754       state: CREATED
6755     });
6756   }
6757   function init(node, id2) {
6758     var schedule = get2(node, id2);
6759     if (schedule.state > CREATED) throw new Error("too late; already scheduled");
6760     return schedule;
6761   }
6762   function set2(node, id2) {
6763     var schedule = get2(node, id2);
6764     if (schedule.state > STARTED) throw new Error("too late; already running");
6765     return schedule;
6766   }
6767   function get2(node, id2) {
6768     var schedule = node.__transition;
6769     if (!schedule || !(schedule = schedule[id2])) throw new Error("transition not found");
6770     return schedule;
6771   }
6772   function create(node, id2, self2) {
6773     var schedules = node.__transition, tween;
6774     schedules[id2] = self2;
6775     self2.timer = timer(schedule, 0, self2.time);
6776     function schedule(elapsed) {
6777       self2.state = SCHEDULED;
6778       self2.timer.restart(start2, self2.delay, self2.time);
6779       if (self2.delay <= elapsed) start2(elapsed - self2.delay);
6780     }
6781     function start2(elapsed) {
6782       var i3, j3, n3, o2;
6783       if (self2.state !== SCHEDULED) return stop();
6784       for (i3 in schedules) {
6785         o2 = schedules[i3];
6786         if (o2.name !== self2.name) continue;
6787         if (o2.state === STARTED) return timeout_default(start2);
6788         if (o2.state === RUNNING) {
6789           o2.state = ENDED;
6790           o2.timer.stop();
6791           o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
6792           delete schedules[i3];
6793         } else if (+i3 < id2) {
6794           o2.state = ENDED;
6795           o2.timer.stop();
6796           o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
6797           delete schedules[i3];
6798         }
6799       }
6800       timeout_default(function() {
6801         if (self2.state === STARTED) {
6802           self2.state = RUNNING;
6803           self2.timer.restart(tick, self2.delay, self2.time);
6804           tick(elapsed);
6805         }
6806       });
6807       self2.state = STARTING;
6808       self2.on.call("start", node, node.__data__, self2.index, self2.group);
6809       if (self2.state !== STARTING) return;
6810       self2.state = STARTED;
6811       tween = new Array(n3 = self2.tween.length);
6812       for (i3 = 0, j3 = -1; i3 < n3; ++i3) {
6813         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
6814           tween[++j3] = o2;
6815         }
6816       }
6817       tween.length = j3 + 1;
6818     }
6819     function tick(elapsed) {
6820       var t2 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i3 = -1, n3 = tween.length;
6821       while (++i3 < n3) {
6822         tween[i3].call(node, t2);
6823       }
6824       if (self2.state === ENDING) {
6825         self2.on.call("end", node, node.__data__, self2.index, self2.group);
6826         stop();
6827       }
6828     }
6829     function stop() {
6830       self2.state = ENDED;
6831       self2.timer.stop();
6832       delete schedules[id2];
6833       for (var i3 in schedules) return;
6834       delete node.__transition;
6835     }
6836   }
6837   var emptyOn, emptyTween, CREATED, SCHEDULED, STARTING, STARTED, RUNNING, ENDING, ENDED;
6838   var init_schedule = __esm({
6839     "node_modules/d3-transition/src/transition/schedule.js"() {
6840       init_src4();
6841       init_src9();
6842       emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
6843       emptyTween = [];
6844       CREATED = 0;
6845       SCHEDULED = 1;
6846       STARTING = 2;
6847       STARTED = 3;
6848       RUNNING = 4;
6849       ENDING = 5;
6850       ENDED = 6;
6851     }
6852   });
6853
6854   // node_modules/d3-transition/src/interrupt.js
6855   function interrupt_default(node, name) {
6856     var schedules = node.__transition, schedule, active, empty2 = true, i3;
6857     if (!schedules) return;
6858     name = name == null ? null : name + "";
6859     for (i3 in schedules) {
6860       if ((schedule = schedules[i3]).name !== name) {
6861         empty2 = false;
6862         continue;
6863       }
6864       active = schedule.state > STARTING && schedule.state < ENDING;
6865       schedule.state = ENDED;
6866       schedule.timer.stop();
6867       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
6868       delete schedules[i3];
6869     }
6870     if (empty2) delete node.__transition;
6871   }
6872   var init_interrupt = __esm({
6873     "node_modules/d3-transition/src/interrupt.js"() {
6874       init_schedule();
6875     }
6876   });
6877
6878   // node_modules/d3-transition/src/selection/interrupt.js
6879   function interrupt_default2(name) {
6880     return this.each(function() {
6881       interrupt_default(this, name);
6882     });
6883   }
6884   var init_interrupt2 = __esm({
6885     "node_modules/d3-transition/src/selection/interrupt.js"() {
6886       init_interrupt();
6887     }
6888   });
6889
6890   // node_modules/d3-transition/src/transition/tween.js
6891   function tweenRemove(id2, name) {
6892     var tween0, tween1;
6893     return function() {
6894       var schedule = set2(this, id2), tween = schedule.tween;
6895       if (tween !== tween0) {
6896         tween1 = tween0 = tween;
6897         for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
6898           if (tween1[i3].name === name) {
6899             tween1 = tween1.slice();
6900             tween1.splice(i3, 1);
6901             break;
6902           }
6903         }
6904       }
6905       schedule.tween = tween1;
6906     };
6907   }
6908   function tweenFunction(id2, name, value) {
6909     var tween0, tween1;
6910     if (typeof value !== "function") throw new Error();
6911     return function() {
6912       var schedule = set2(this, id2), tween = schedule.tween;
6913       if (tween !== tween0) {
6914         tween1 = (tween0 = tween).slice();
6915         for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
6916           if (tween1[i3].name === name) {
6917             tween1[i3] = t2;
6918             break;
6919           }
6920         }
6921         if (i3 === n3) tween1.push(t2);
6922       }
6923       schedule.tween = tween1;
6924     };
6925   }
6926   function tween_default(name, value) {
6927     var id2 = this._id;
6928     name += "";
6929     if (arguments.length < 2) {
6930       var tween = get2(this.node(), id2).tween;
6931       for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
6932         if ((t2 = tween[i3]).name === name) {
6933           return t2.value;
6934         }
6935       }
6936       return null;
6937     }
6938     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
6939   }
6940   function tweenValue(transition2, name, value) {
6941     var id2 = transition2._id;
6942     transition2.each(function() {
6943       var schedule = set2(this, id2);
6944       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
6945     });
6946     return function(node) {
6947       return get2(node, id2).value[name];
6948     };
6949   }
6950   var init_tween = __esm({
6951     "node_modules/d3-transition/src/transition/tween.js"() {
6952       init_schedule();
6953     }
6954   });
6955
6956   // node_modules/d3-transition/src/transition/interpolate.js
6957   function interpolate_default(a4, b3) {
6958     var c2;
6959     return (typeof b3 === "number" ? number_default : b3 instanceof color ? rgb_default : (c2 = color(b3)) ? (b3 = c2, rgb_default) : string_default)(a4, b3);
6960   }
6961   var init_interpolate = __esm({
6962     "node_modules/d3-transition/src/transition/interpolate.js"() {
6963       init_src7();
6964       init_src8();
6965     }
6966   });
6967
6968   // node_modules/d3-transition/src/transition/attr.js
6969   function attrRemove2(name) {
6970     return function() {
6971       this.removeAttribute(name);
6972     };
6973   }
6974   function attrRemoveNS2(fullname) {
6975     return function() {
6976       this.removeAttributeNS(fullname.space, fullname.local);
6977     };
6978   }
6979   function attrConstant2(name, interpolate, value1) {
6980     var string00, string1 = value1 + "", interpolate0;
6981     return function() {
6982       var string0 = this.getAttribute(name);
6983       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
6984     };
6985   }
6986   function attrConstantNS2(fullname, interpolate, value1) {
6987     var string00, string1 = value1 + "", interpolate0;
6988     return function() {
6989       var string0 = this.getAttributeNS(fullname.space, fullname.local);
6990       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
6991     };
6992   }
6993   function attrFunction2(name, interpolate, value) {
6994     var string00, string10, interpolate0;
6995     return function() {
6996       var string0, value1 = value(this), string1;
6997       if (value1 == null) return void this.removeAttribute(name);
6998       string0 = this.getAttribute(name);
6999       string1 = value1 + "";
7000       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7001     };
7002   }
7003   function attrFunctionNS2(fullname, interpolate, value) {
7004     var string00, string10, interpolate0;
7005     return function() {
7006       var string0, value1 = value(this), string1;
7007       if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
7008       string0 = this.getAttributeNS(fullname.space, fullname.local);
7009       string1 = value1 + "";
7010       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7011     };
7012   }
7013   function attr_default2(name, value) {
7014     var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
7015     return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i3, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i3, value));
7016   }
7017   var init_attr2 = __esm({
7018     "node_modules/d3-transition/src/transition/attr.js"() {
7019       init_src8();
7020       init_src5();
7021       init_tween();
7022       init_interpolate();
7023     }
7024   });
7025
7026   // node_modules/d3-transition/src/transition/attrTween.js
7027   function attrInterpolate(name, i3) {
7028     return function(t2) {
7029       this.setAttribute(name, i3.call(this, t2));
7030     };
7031   }
7032   function attrInterpolateNS(fullname, i3) {
7033     return function(t2) {
7034       this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
7035     };
7036   }
7037   function attrTweenNS(fullname, value) {
7038     var t02, i0;
7039     function tween() {
7040       var i3 = value.apply(this, arguments);
7041       if (i3 !== i0) t02 = (i0 = i3) && attrInterpolateNS(fullname, i3);
7042       return t02;
7043     }
7044     tween._value = value;
7045     return tween;
7046   }
7047   function attrTween(name, value) {
7048     var t02, i0;
7049     function tween() {
7050       var i3 = value.apply(this, arguments);
7051       if (i3 !== i0) t02 = (i0 = i3) && attrInterpolate(name, i3);
7052       return t02;
7053     }
7054     tween._value = value;
7055     return tween;
7056   }
7057   function attrTween_default(name, value) {
7058     var key = "attr." + name;
7059     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
7060     if (value == null) return this.tween(key, null);
7061     if (typeof value !== "function") throw new Error();
7062     var fullname = namespace_default(name);
7063     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
7064   }
7065   var init_attrTween = __esm({
7066     "node_modules/d3-transition/src/transition/attrTween.js"() {
7067       init_src5();
7068     }
7069   });
7070
7071   // node_modules/d3-transition/src/transition/delay.js
7072   function delayFunction(id2, value) {
7073     return function() {
7074       init(this, id2).delay = +value.apply(this, arguments);
7075     };
7076   }
7077   function delayConstant(id2, value) {
7078     return value = +value, function() {
7079       init(this, id2).delay = value;
7080     };
7081   }
7082   function delay_default(value) {
7083     var id2 = this._id;
7084     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
7085   }
7086   var init_delay = __esm({
7087     "node_modules/d3-transition/src/transition/delay.js"() {
7088       init_schedule();
7089     }
7090   });
7091
7092   // node_modules/d3-transition/src/transition/duration.js
7093   function durationFunction(id2, value) {
7094     return function() {
7095       set2(this, id2).duration = +value.apply(this, arguments);
7096     };
7097   }
7098   function durationConstant(id2, value) {
7099     return value = +value, function() {
7100       set2(this, id2).duration = value;
7101     };
7102   }
7103   function duration_default(value) {
7104     var id2 = this._id;
7105     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
7106   }
7107   var init_duration = __esm({
7108     "node_modules/d3-transition/src/transition/duration.js"() {
7109       init_schedule();
7110     }
7111   });
7112
7113   // node_modules/d3-transition/src/transition/ease.js
7114   function easeConstant(id2, value) {
7115     if (typeof value !== "function") throw new Error();
7116     return function() {
7117       set2(this, id2).ease = value;
7118     };
7119   }
7120   function ease_default(value) {
7121     var id2 = this._id;
7122     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
7123   }
7124   var init_ease = __esm({
7125     "node_modules/d3-transition/src/transition/ease.js"() {
7126       init_schedule();
7127     }
7128   });
7129
7130   // node_modules/d3-transition/src/transition/easeVarying.js
7131   function easeVarying(id2, value) {
7132     return function() {
7133       var v3 = value.apply(this, arguments);
7134       if (typeof v3 !== "function") throw new Error();
7135       set2(this, id2).ease = v3;
7136     };
7137   }
7138   function easeVarying_default(value) {
7139     if (typeof value !== "function") throw new Error();
7140     return this.each(easeVarying(this._id, value));
7141   }
7142   var init_easeVarying = __esm({
7143     "node_modules/d3-transition/src/transition/easeVarying.js"() {
7144       init_schedule();
7145     }
7146   });
7147
7148   // node_modules/d3-transition/src/transition/filter.js
7149   function filter_default2(match) {
7150     if (typeof match !== "function") match = matcher_default(match);
7151     for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
7152       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
7153         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
7154           subgroup.push(node);
7155         }
7156       }
7157     }
7158     return new Transition(subgroups, this._parents, this._name, this._id);
7159   }
7160   var init_filter2 = __esm({
7161     "node_modules/d3-transition/src/transition/filter.js"() {
7162       init_src5();
7163       init_transition2();
7164     }
7165   });
7166
7167   // node_modules/d3-transition/src/transition/merge.js
7168   function merge_default2(transition2) {
7169     if (transition2._id !== this._id) throw new Error();
7170     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) {
7171       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge3 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
7172         if (node = group0[i3] || group1[i3]) {
7173           merge3[i3] = node;
7174         }
7175       }
7176     }
7177     for (; j3 < m0; ++j3) {
7178       merges[j3] = groups0[j3];
7179     }
7180     return new Transition(merges, this._parents, this._name, this._id);
7181   }
7182   var init_merge3 = __esm({
7183     "node_modules/d3-transition/src/transition/merge.js"() {
7184       init_transition2();
7185     }
7186   });
7187
7188   // node_modules/d3-transition/src/transition/on.js
7189   function start(name) {
7190     return (name + "").trim().split(/^|\s+/).every(function(t2) {
7191       var i3 = t2.indexOf(".");
7192       if (i3 >= 0) t2 = t2.slice(0, i3);
7193       return !t2 || t2 === "start";
7194     });
7195   }
7196   function onFunction(id2, name, listener) {
7197     var on0, on1, sit = start(name) ? init : set2;
7198     return function() {
7199       var schedule = sit(this, id2), on = schedule.on;
7200       if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
7201       schedule.on = on1;
7202     };
7203   }
7204   function on_default2(name, listener) {
7205     var id2 = this._id;
7206     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
7207   }
7208   var init_on2 = __esm({
7209     "node_modules/d3-transition/src/transition/on.js"() {
7210       init_schedule();
7211     }
7212   });
7213
7214   // node_modules/d3-transition/src/transition/remove.js
7215   function removeFunction(id2) {
7216     return function() {
7217       var parent2 = this.parentNode;
7218       for (var i3 in this.__transition) if (+i3 !== id2) return;
7219       if (parent2) parent2.removeChild(this);
7220     };
7221   }
7222   function remove_default2() {
7223     return this.on("end.remove", removeFunction(this._id));
7224   }
7225   var init_remove2 = __esm({
7226     "node_modules/d3-transition/src/transition/remove.js"() {
7227     }
7228   });
7229
7230   // node_modules/d3-transition/src/transition/select.js
7231   function select_default3(select) {
7232     var name = this._name, id2 = this._id;
7233     if (typeof select !== "function") select = selector_default(select);
7234     for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) {
7235       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
7236         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
7237           if ("__data__" in node) subnode.__data__ = node.__data__;
7238           subgroup[i3] = subnode;
7239           schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
7240         }
7241       }
7242     }
7243     return new Transition(subgroups, this._parents, name, id2);
7244   }
7245   var init_select3 = __esm({
7246     "node_modules/d3-transition/src/transition/select.js"() {
7247       init_src5();
7248       init_transition2();
7249       init_schedule();
7250     }
7251   });
7252
7253   // node_modules/d3-transition/src/transition/selectAll.js
7254   function selectAll_default3(select) {
7255     var name = this._name, id2 = this._id;
7256     if (typeof select !== "function") select = selectorAll_default(select);
7257     for (var groups = this._groups, m3 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m3; ++j3) {
7258       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7259         if (node = group[i3]) {
7260           for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k3 = 0, l2 = children2.length; k3 < l2; ++k3) {
7261             if (child = children2[k3]) {
7262               schedule_default(child, name, id2, k3, children2, inherit2);
7263             }
7264           }
7265           subgroups.push(children2);
7266           parents.push(node);
7267         }
7268       }
7269     }
7270     return new Transition(subgroups, parents, name, id2);
7271   }
7272   var init_selectAll3 = __esm({
7273     "node_modules/d3-transition/src/transition/selectAll.js"() {
7274       init_src5();
7275       init_transition2();
7276       init_schedule();
7277     }
7278   });
7279
7280   // node_modules/d3-transition/src/transition/selection.js
7281   function selection_default2() {
7282     return new Selection2(this._groups, this._parents);
7283   }
7284   var Selection2;
7285   var init_selection2 = __esm({
7286     "node_modules/d3-transition/src/transition/selection.js"() {
7287       init_src5();
7288       Selection2 = selection_default.prototype.constructor;
7289     }
7290   });
7291
7292   // node_modules/d3-transition/src/transition/style.js
7293   function styleNull(name, interpolate) {
7294     var string00, string10, interpolate0;
7295     return function() {
7296       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
7297       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
7298     };
7299   }
7300   function styleRemove2(name) {
7301     return function() {
7302       this.style.removeProperty(name);
7303     };
7304   }
7305   function styleConstant2(name, interpolate, value1) {
7306     var string00, string1 = value1 + "", interpolate0;
7307     return function() {
7308       var string0 = styleValue(this, name);
7309       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
7310     };
7311   }
7312   function styleFunction2(name, interpolate, value) {
7313     var string00, string10, interpolate0;
7314     return function() {
7315       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
7316       if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
7317       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7318     };
7319   }
7320   function styleMaybeRemove(id2, name) {
7321     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
7322     return function() {
7323       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
7324       if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
7325       schedule.on = on1;
7326     };
7327   }
7328   function style_default2(name, value, priority) {
7329     var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
7330     return value == null ? this.styleTween(name, styleNull(name, i3)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i3, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i3, value), priority).on("end.style." + name, null);
7331   }
7332   var init_style2 = __esm({
7333     "node_modules/d3-transition/src/transition/style.js"() {
7334       init_src8();
7335       init_src5();
7336       init_schedule();
7337       init_tween();
7338       init_interpolate();
7339     }
7340   });
7341
7342   // node_modules/d3-transition/src/transition/styleTween.js
7343   function styleInterpolate(name, i3, priority) {
7344     return function(t2) {
7345       this.style.setProperty(name, i3.call(this, t2), priority);
7346     };
7347   }
7348   function styleTween(name, value, priority) {
7349     var t2, i0;
7350     function tween() {
7351       var i3 = value.apply(this, arguments);
7352       if (i3 !== i0) t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
7353       return t2;
7354     }
7355     tween._value = value;
7356     return tween;
7357   }
7358   function styleTween_default(name, value, priority) {
7359     var key = "style." + (name += "");
7360     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
7361     if (value == null) return this.tween(key, null);
7362     if (typeof value !== "function") throw new Error();
7363     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
7364   }
7365   var init_styleTween = __esm({
7366     "node_modules/d3-transition/src/transition/styleTween.js"() {
7367     }
7368   });
7369
7370   // node_modules/d3-transition/src/transition/text.js
7371   function textConstant2(value) {
7372     return function() {
7373       this.textContent = value;
7374     };
7375   }
7376   function textFunction2(value) {
7377     return function() {
7378       var value1 = value(this);
7379       this.textContent = value1 == null ? "" : value1;
7380     };
7381   }
7382   function text_default2(value) {
7383     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
7384   }
7385   var init_text2 = __esm({
7386     "node_modules/d3-transition/src/transition/text.js"() {
7387       init_tween();
7388     }
7389   });
7390
7391   // node_modules/d3-transition/src/transition/textTween.js
7392   function textInterpolate(i3) {
7393     return function(t2) {
7394       this.textContent = i3.call(this, t2);
7395     };
7396   }
7397   function textTween(value) {
7398     var t02, i0;
7399     function tween() {
7400       var i3 = value.apply(this, arguments);
7401       if (i3 !== i0) t02 = (i0 = i3) && textInterpolate(i3);
7402       return t02;
7403     }
7404     tween._value = value;
7405     return tween;
7406   }
7407   function textTween_default(value) {
7408     var key = "text";
7409     if (arguments.length < 1) return (key = this.tween(key)) && key._value;
7410     if (value == null) return this.tween(key, null);
7411     if (typeof value !== "function") throw new Error();
7412     return this.tween(key, textTween(value));
7413   }
7414   var init_textTween = __esm({
7415     "node_modules/d3-transition/src/transition/textTween.js"() {
7416     }
7417   });
7418
7419   // node_modules/d3-transition/src/transition/transition.js
7420   function transition_default() {
7421     var name = this._name, id0 = this._id, id1 = newId();
7422     for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
7423       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7424         if (node = group[i3]) {
7425           var inherit2 = get2(node, id0);
7426           schedule_default(node, name, id1, i3, group, {
7427             time: inherit2.time + inherit2.delay + inherit2.duration,
7428             delay: 0,
7429             duration: inherit2.duration,
7430             ease: inherit2.ease
7431           });
7432         }
7433       }
7434     }
7435     return new Transition(groups, this._parents, name, id1);
7436   }
7437   var init_transition = __esm({
7438     "node_modules/d3-transition/src/transition/transition.js"() {
7439       init_transition2();
7440       init_schedule();
7441     }
7442   });
7443
7444   // node_modules/d3-transition/src/transition/end.js
7445   function end_default() {
7446     var on0, on1, that = this, id2 = that._id, size = that.size();
7447     return new Promise(function(resolve, reject) {
7448       var cancel = { value: reject }, end = { value: function() {
7449         if (--size === 0) resolve();
7450       } };
7451       that.each(function() {
7452         var schedule = set2(this, id2), on = schedule.on;
7453         if (on !== on0) {
7454           on1 = (on0 = on).copy();
7455           on1._.cancel.push(cancel);
7456           on1._.interrupt.push(cancel);
7457           on1._.end.push(end);
7458         }
7459         schedule.on = on1;
7460       });
7461       if (size === 0) resolve();
7462     });
7463   }
7464   var init_end = __esm({
7465     "node_modules/d3-transition/src/transition/end.js"() {
7466       init_schedule();
7467     }
7468   });
7469
7470   // node_modules/d3-transition/src/transition/index.js
7471   function Transition(groups, parents, name, id2) {
7472     this._groups = groups;
7473     this._parents = parents;
7474     this._name = name;
7475     this._id = id2;
7476   }
7477   function transition(name) {
7478     return selection_default().transition(name);
7479   }
7480   function newId() {
7481     return ++id;
7482   }
7483   var id, selection_prototype;
7484   var init_transition2 = __esm({
7485     "node_modules/d3-transition/src/transition/index.js"() {
7486       init_src5();
7487       init_attr2();
7488       init_attrTween();
7489       init_delay();
7490       init_duration();
7491       init_ease();
7492       init_easeVarying();
7493       init_filter2();
7494       init_merge3();
7495       init_on2();
7496       init_remove2();
7497       init_select3();
7498       init_selectAll3();
7499       init_selection2();
7500       init_style2();
7501       init_styleTween();
7502       init_text2();
7503       init_textTween();
7504       init_transition();
7505       init_tween();
7506       init_end();
7507       id = 0;
7508       selection_prototype = selection_default.prototype;
7509       Transition.prototype = transition.prototype = {
7510         constructor: Transition,
7511         select: select_default3,
7512         selectAll: selectAll_default3,
7513         selectChild: selection_prototype.selectChild,
7514         selectChildren: selection_prototype.selectChildren,
7515         filter: filter_default2,
7516         merge: merge_default2,
7517         selection: selection_default2,
7518         transition: transition_default,
7519         call: selection_prototype.call,
7520         nodes: selection_prototype.nodes,
7521         node: selection_prototype.node,
7522         size: selection_prototype.size,
7523         empty: selection_prototype.empty,
7524         each: selection_prototype.each,
7525         on: on_default2,
7526         attr: attr_default2,
7527         attrTween: attrTween_default,
7528         style: style_default2,
7529         styleTween: styleTween_default,
7530         text: text_default2,
7531         textTween: textTween_default,
7532         remove: remove_default2,
7533         tween: tween_default,
7534         delay: delay_default,
7535         duration: duration_default,
7536         ease: ease_default,
7537         easeVarying: easeVarying_default,
7538         end: end_default,
7539         [Symbol.iterator]: selection_prototype[Symbol.iterator]
7540       };
7541     }
7542   });
7543
7544   // node_modules/d3-ease/src/linear.js
7545   var linear2;
7546   var init_linear = __esm({
7547     "node_modules/d3-ease/src/linear.js"() {
7548       linear2 = (t2) => +t2;
7549     }
7550   });
7551
7552   // node_modules/d3-ease/src/cubic.js
7553   function cubicInOut(t2) {
7554     return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
7555   }
7556   var init_cubic = __esm({
7557     "node_modules/d3-ease/src/cubic.js"() {
7558     }
7559   });
7560
7561   // node_modules/d3-ease/src/index.js
7562   var init_src10 = __esm({
7563     "node_modules/d3-ease/src/index.js"() {
7564       init_linear();
7565       init_cubic();
7566     }
7567   });
7568
7569   // node_modules/d3-transition/src/selection/transition.js
7570   function inherit(node, id2) {
7571     var timing;
7572     while (!(timing = node.__transition) || !(timing = timing[id2])) {
7573       if (!(node = node.parentNode)) {
7574         throw new Error(`transition ${id2} not found`);
7575       }
7576     }
7577     return timing;
7578   }
7579   function transition_default2(name) {
7580     var id2, timing;
7581     if (name instanceof Transition) {
7582       id2 = name._id, name = name._name;
7583     } else {
7584       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
7585     }
7586     for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) {
7587       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7588         if (node = group[i3]) {
7589           schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
7590         }
7591       }
7592     }
7593     return new Transition(groups, this._parents, name, id2);
7594   }
7595   var defaultTiming;
7596   var init_transition3 = __esm({
7597     "node_modules/d3-transition/src/selection/transition.js"() {
7598       init_transition2();
7599       init_schedule();
7600       init_src10();
7601       init_src9();
7602       defaultTiming = {
7603         time: null,
7604         // Set on use.
7605         delay: 0,
7606         duration: 250,
7607         ease: cubicInOut
7608       };
7609     }
7610   });
7611
7612   // node_modules/d3-transition/src/selection/index.js
7613   var init_selection3 = __esm({
7614     "node_modules/d3-transition/src/selection/index.js"() {
7615       init_src5();
7616       init_interrupt2();
7617       init_transition3();
7618       selection_default.prototype.interrupt = interrupt_default2;
7619       selection_default.prototype.transition = transition_default2;
7620     }
7621   });
7622
7623   // node_modules/d3-transition/src/index.js
7624   var init_src11 = __esm({
7625     "node_modules/d3-transition/src/index.js"() {
7626       init_selection3();
7627       init_interrupt();
7628     }
7629   });
7630
7631   // node_modules/d3-zoom/src/constant.js
7632   var constant_default4;
7633   var init_constant4 = __esm({
7634     "node_modules/d3-zoom/src/constant.js"() {
7635       constant_default4 = (x2) => () => x2;
7636     }
7637   });
7638
7639   // node_modules/d3-zoom/src/event.js
7640   function ZoomEvent(type2, {
7641     sourceEvent,
7642     target,
7643     transform: transform2,
7644     dispatch: dispatch14
7645   }) {
7646     Object.defineProperties(this, {
7647       type: { value: type2, enumerable: true, configurable: true },
7648       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
7649       target: { value: target, enumerable: true, configurable: true },
7650       transform: { value: transform2, enumerable: true, configurable: true },
7651       _: { value: dispatch14 }
7652     });
7653   }
7654   var init_event2 = __esm({
7655     "node_modules/d3-zoom/src/event.js"() {
7656     }
7657   });
7658
7659   // node_modules/d3-zoom/src/transform.js
7660   function Transform(k3, x2, y2) {
7661     this.k = k3;
7662     this.x = x2;
7663     this.y = y2;
7664   }
7665   function transform(node) {
7666     while (!node.__zoom) if (!(node = node.parentNode)) return identity2;
7667     return node.__zoom;
7668   }
7669   var identity2;
7670   var init_transform3 = __esm({
7671     "node_modules/d3-zoom/src/transform.js"() {
7672       Transform.prototype = {
7673         constructor: Transform,
7674         scale: function(k3) {
7675           return k3 === 1 ? this : new Transform(this.k * k3, this.x, this.y);
7676         },
7677         translate: function(x2, y2) {
7678           return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
7679         },
7680         apply: function(point) {
7681           return [point[0] * this.k + this.x, point[1] * this.k + this.y];
7682         },
7683         applyX: function(x2) {
7684           return x2 * this.k + this.x;
7685         },
7686         applyY: function(y2) {
7687           return y2 * this.k + this.y;
7688         },
7689         invert: function(location) {
7690           return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
7691         },
7692         invertX: function(x2) {
7693           return (x2 - this.x) / this.k;
7694         },
7695         invertY: function(y2) {
7696           return (y2 - this.y) / this.k;
7697         },
7698         rescaleX: function(x2) {
7699           return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
7700         },
7701         rescaleY: function(y2) {
7702           return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
7703         },
7704         toString: function() {
7705           return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
7706         }
7707       };
7708       identity2 = new Transform(1, 0, 0);
7709       transform.prototype = Transform.prototype;
7710     }
7711   });
7712
7713   // node_modules/d3-zoom/src/noevent.js
7714   function nopropagation2(event) {
7715     event.stopImmediatePropagation();
7716   }
7717   function noevent_default2(event) {
7718     event.preventDefault();
7719     event.stopImmediatePropagation();
7720   }
7721   var init_noevent2 = __esm({
7722     "node_modules/d3-zoom/src/noevent.js"() {
7723     }
7724   });
7725
7726   // node_modules/d3-zoom/src/zoom.js
7727   function defaultFilter2(event) {
7728     return (!event.ctrlKey || event.type === "wheel") && !event.button;
7729   }
7730   function defaultExtent() {
7731     var e3 = this;
7732     if (e3 instanceof SVGElement) {
7733       e3 = e3.ownerSVGElement || e3;
7734       if (e3.hasAttribute("viewBox")) {
7735         e3 = e3.viewBox.baseVal;
7736         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
7737       }
7738       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
7739     }
7740     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
7741   }
7742   function defaultTransform() {
7743     return this.__zoom || identity2;
7744   }
7745   function defaultWheelDelta(event) {
7746     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
7747   }
7748   function defaultTouchable2() {
7749     return navigator.maxTouchPoints || "ontouchstart" in this;
7750   }
7751   function defaultConstrain(transform2, extent, translateExtent) {
7752     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];
7753     return transform2.translate(
7754       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
7755       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
7756     );
7757   }
7758   function zoom_default2() {
7759     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;
7760     function zoom(selection2) {
7761       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)");
7762     }
7763     zoom.transform = function(collection, transform2, point, event) {
7764       var selection2 = collection.selection ? collection.selection() : collection;
7765       selection2.property("__zoom", defaultTransform);
7766       if (collection !== selection2) {
7767         schedule(collection, transform2, point, event);
7768       } else {
7769         selection2.interrupt().each(function() {
7770           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
7771         });
7772       }
7773     };
7774     zoom.scaleBy = function(selection2, k3, p2, event) {
7775       zoom.scaleTo(selection2, function() {
7776         var k0 = this.__zoom.k, k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
7777         return k0 * k1;
7778       }, p2, event);
7779     };
7780     zoom.scaleTo = function(selection2, k3, p2, event) {
7781       zoom.transform(selection2, function() {
7782         var e3 = extent.apply(this, arguments), t02 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t02.invert(p02), k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
7783         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
7784       }, p2, event);
7785     };
7786     zoom.translateBy = function(selection2, x2, y2, event) {
7787       zoom.transform(selection2, function() {
7788         return constrain(this.__zoom.translate(
7789           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
7790           typeof y2 === "function" ? y2.apply(this, arguments) : y2
7791         ), extent.apply(this, arguments), translateExtent);
7792       }, null, event);
7793     };
7794     zoom.translateTo = function(selection2, x2, y2, p2, event) {
7795       zoom.transform(selection2, function() {
7796         var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
7797         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
7798           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
7799           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
7800         ), e3, translateExtent);
7801       }, p2, event);
7802     };
7803     function scale(transform2, k3) {
7804       k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k3));
7805       return k3 === transform2.k ? transform2 : new Transform(k3, transform2.x, transform2.y);
7806     }
7807     function translate(transform2, p02, p1) {
7808       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
7809       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
7810     }
7811     function centroid(extent2) {
7812       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
7813     }
7814     function schedule(transition2, transform2, point, event) {
7815       transition2.on("start.zoom", function() {
7816         gesture(this, arguments).event(event).start();
7817       }).on("interrupt.zoom end.zoom", function() {
7818         gesture(this, arguments).event(event).end();
7819       }).tween("zoom", function() {
7820         var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point == null ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w3 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a4 = that.__zoom, b3 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a4.invert(p2).concat(w3 / a4.k), b3.invert(p2).concat(w3 / b3.k));
7821         return function(t2) {
7822           if (t2 === 1) t2 = b3;
7823           else {
7824             var l2 = i3(t2), k3 = w3 / l2[2];
7825             t2 = new Transform(k3, p2[0] - l2[0] * k3, p2[1] - l2[1] * k3);
7826           }
7827           g3.zoom(null, t2);
7828         };
7829       });
7830     }
7831     function gesture(that, args, clean2) {
7832       return !clean2 && that.__zooming || new Gesture(that, args);
7833     }
7834     function Gesture(that, args) {
7835       this.that = that;
7836       this.args = args;
7837       this.active = 0;
7838       this.sourceEvent = null;
7839       this.extent = extent.apply(that, args);
7840       this.taps = 0;
7841     }
7842     Gesture.prototype = {
7843       event: function(event) {
7844         if (event) this.sourceEvent = event;
7845         return this;
7846       },
7847       start: function() {
7848         if (++this.active === 1) {
7849           this.that.__zooming = this;
7850           this.emit("start");
7851         }
7852         return this;
7853       },
7854       zoom: function(key, transform2) {
7855         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
7856         if (this.touch0 && key !== "touch") this.touch0[1] = transform2.invert(this.touch0[0]);
7857         if (this.touch1 && key !== "touch") this.touch1[1] = transform2.invert(this.touch1[0]);
7858         this.that.__zoom = transform2;
7859         this.emit("zoom");
7860         return this;
7861       },
7862       end: function() {
7863         if (--this.active === 0) {
7864           delete this.that.__zooming;
7865           this.emit("end");
7866         }
7867         return this;
7868       },
7869       emit: function(type2) {
7870         var d2 = select_default2(this.that).datum();
7871         listeners.call(
7872           type2,
7873           this.that,
7874           new ZoomEvent(type2, {
7875             sourceEvent: this.sourceEvent,
7876             target: zoom,
7877             type: type2,
7878             transform: this.that.__zoom,
7879             dispatch: listeners
7880           }),
7881           d2
7882         );
7883       }
7884     };
7885     function wheeled(event, ...args) {
7886       if (!filter2.apply(this, arguments)) return;
7887       var g3 = gesture(this, args).event(event), t2 = this.__zoom, k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = pointer_default(event);
7888       if (g3.wheel) {
7889         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
7890           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
7891         }
7892         clearTimeout(g3.wheel);
7893       } else if (t2.k === k3) return;
7894       else {
7895         g3.mouse = [p2, t2.invert(p2)];
7896         interrupt_default(this);
7897         g3.start();
7898       }
7899       noevent_default2(event);
7900       g3.wheel = setTimeout(wheelidled, wheelDelay);
7901       g3.zoom("mouse", constrain(translate(scale(t2, k3), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
7902       function wheelidled() {
7903         g3.wheel = null;
7904         g3.end();
7905       }
7906     }
7907     function mousedowned(event, ...args) {
7908       if (touchending || !filter2.apply(this, arguments)) return;
7909       var currentTarget = event.currentTarget, g3 = gesture(this, args, true).event(event), v3 = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p2 = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
7910       nodrag_default(event.view);
7911       nopropagation2(event);
7912       g3.mouse = [p2, this.__zoom.invert(p2)];
7913       interrupt_default(this);
7914       g3.start();
7915       function mousemoved(event2) {
7916         noevent_default2(event2);
7917         if (!g3.moved) {
7918           var dx = event2.clientX - x05, dy = event2.clientY - y05;
7919           g3.moved = dx * dx + dy * dy > clickDistance2;
7920         }
7921         g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
7922       }
7923       function mouseupped(event2) {
7924         v3.on("mousemove.zoom mouseup.zoom", null);
7925         yesdrag(event2.view, g3.moved);
7926         noevent_default2(event2);
7927         g3.event(event2).end();
7928       }
7929     }
7930     function dblclicked(event, ...args) {
7931       if (!filter2.apply(this, arguments)) return;
7932       var t02 = this.__zoom, p02 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t02.invert(p02), k1 = t02.k * (event.shiftKey ? 0.5 : 2), t12 = constrain(translate(scale(t02, k1), p02, p1), extent.apply(this, args), translateExtent);
7933       noevent_default2(event);
7934       if (duration > 0) select_default2(this).transition().duration(duration).call(schedule, t12, p02, event);
7935       else select_default2(this).call(zoom.transform, t12, p02, event);
7936     }
7937     function touchstarted(event, ...args) {
7938       if (!filter2.apply(this, arguments)) return;
7939       var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
7940       nopropagation2(event);
7941       for (i3 = 0; i3 < n3; ++i3) {
7942         t2 = touches[i3], p2 = pointer_default(t2, this);
7943         p2 = [p2, this.__zoom.invert(p2), t2.identifier];
7944         if (!g3.touch0) g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
7945         else if (!g3.touch1 && g3.touch0[2] !== p2[2]) g3.touch1 = p2, g3.taps = 0;
7946       }
7947       if (touchstarting) touchstarting = clearTimeout(touchstarting);
7948       if (started) {
7949         if (g3.taps < 2) touchfirst = p2[0], touchstarting = setTimeout(function() {
7950           touchstarting = null;
7951         }, touchDelay);
7952         interrupt_default(this);
7953         g3.start();
7954       }
7955     }
7956     function touchmoved(event, ...args) {
7957       if (!this.__zooming) return;
7958       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
7959       noevent_default2(event);
7960       for (i3 = 0; i3 < n3; ++i3) {
7961         t2 = touches[i3], p2 = pointer_default(t2, this);
7962         if (g3.touch0 && g3.touch0[2] === t2.identifier) g3.touch0[0] = p2;
7963         else if (g3.touch1 && g3.touch1[2] === t2.identifier) g3.touch1[0] = p2;
7964       }
7965       t2 = g3.that.__zoom;
7966       if (g3.touch1) {
7967         var p02 = g3.touch0[0], l0 = g3.touch0[1], p1 = g3.touch1[0], l1 = g3.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;
7968         t2 = scale(t2, Math.sqrt(dp / dl));
7969         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
7970         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
7971       } else if (g3.touch0) p2 = g3.touch0[0], l2 = g3.touch0[1];
7972       else return;
7973       g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
7974     }
7975     function touchended(event, ...args) {
7976       if (!this.__zooming) return;
7977       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
7978       nopropagation2(event);
7979       if (touchending) clearTimeout(touchending);
7980       touchending = setTimeout(function() {
7981         touchending = null;
7982       }, touchDelay);
7983       for (i3 = 0; i3 < n3; ++i3) {
7984         t2 = touches[i3];
7985         if (g3.touch0 && g3.touch0[2] === t2.identifier) delete g3.touch0;
7986         else if (g3.touch1 && g3.touch1[2] === t2.identifier) delete g3.touch1;
7987       }
7988       if (g3.touch1 && !g3.touch0) g3.touch0 = g3.touch1, delete g3.touch1;
7989       if (g3.touch0) g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
7990       else {
7991         g3.end();
7992         if (g3.taps === 2) {
7993           t2 = pointer_default(t2, this);
7994           if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
7995             var p2 = select_default2(this).on("dblclick.zoom");
7996             if (p2) p2.apply(this, arguments);
7997           }
7998         }
7999       }
8000     }
8001     zoom.wheelDelta = function(_3) {
8002       return arguments.length ? (wheelDelta = typeof _3 === "function" ? _3 : constant_default4(+_3), zoom) : wheelDelta;
8003     };
8004     zoom.filter = function(_3) {
8005       return arguments.length ? (filter2 = typeof _3 === "function" ? _3 : constant_default4(!!_3), zoom) : filter2;
8006     };
8007     zoom.touchable = function(_3) {
8008       return arguments.length ? (touchable = typeof _3 === "function" ? _3 : constant_default4(!!_3), zoom) : touchable;
8009     };
8010     zoom.extent = function(_3) {
8011       return arguments.length ? (extent = typeof _3 === "function" ? _3 : constant_default4([[+_3[0][0], +_3[0][1]], [+_3[1][0], +_3[1][1]]]), zoom) : extent;
8012     };
8013     zoom.scaleExtent = function(_3) {
8014       return arguments.length ? (scaleExtent[0] = +_3[0], scaleExtent[1] = +_3[1], zoom) : [scaleExtent[0], scaleExtent[1]];
8015     };
8016     zoom.translateExtent = function(_3) {
8017       return arguments.length ? (translateExtent[0][0] = +_3[0][0], translateExtent[1][0] = +_3[1][0], translateExtent[0][1] = +_3[0][1], translateExtent[1][1] = +_3[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
8018     };
8019     zoom.constrain = function(_3) {
8020       return arguments.length ? (constrain = _3, zoom) : constrain;
8021     };
8022     zoom.duration = function(_3) {
8023       return arguments.length ? (duration = +_3, zoom) : duration;
8024     };
8025     zoom.interpolate = function(_3) {
8026       return arguments.length ? (interpolate = _3, zoom) : interpolate;
8027     };
8028     zoom.on = function() {
8029       var value = listeners.on.apply(listeners, arguments);
8030       return value === listeners ? zoom : value;
8031     };
8032     zoom.clickDistance = function(_3) {
8033       return arguments.length ? (clickDistance2 = (_3 = +_3) * _3, zoom) : Math.sqrt(clickDistance2);
8034     };
8035     zoom.tapDistance = function(_3) {
8036       return arguments.length ? (tapDistance = +_3, zoom) : tapDistance;
8037     };
8038     return zoom;
8039   }
8040   var init_zoom2 = __esm({
8041     "node_modules/d3-zoom/src/zoom.js"() {
8042       init_src4();
8043       init_src6();
8044       init_src8();
8045       init_src5();
8046       init_src11();
8047       init_constant4();
8048       init_event2();
8049       init_transform3();
8050       init_noevent2();
8051     }
8052   });
8053
8054   // node_modules/d3-zoom/src/index.js
8055   var init_src12 = __esm({
8056     "node_modules/d3-zoom/src/index.js"() {
8057       init_zoom2();
8058       init_transform3();
8059     }
8060   });
8061
8062   // modules/geo/raw_mercator.js
8063   var raw_mercator_exports = {};
8064   __export(raw_mercator_exports, {
8065     geoRawMercator: () => geoRawMercator
8066   });
8067   function geoRawMercator() {
8068     const project = mercatorRaw;
8069     let k3 = 512 / Math.PI;
8070     let x2 = 0;
8071     let y2 = 0;
8072     let clipExtent = [[0, 0], [0, 0]];
8073     function projection2(point) {
8074       point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
8075       return [point[0] * k3 + x2, y2 - point[1] * k3];
8076     }
8077     projection2.invert = function(point) {
8078       point = project.invert((point[0] - x2) / k3, (y2 - point[1]) / k3);
8079       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
8080     };
8081     projection2.scale = function(_3) {
8082       if (!arguments.length) return k3;
8083       k3 = +_3;
8084       return projection2;
8085     };
8086     projection2.translate = function(_3) {
8087       if (!arguments.length) return [x2, y2];
8088       x2 = +_3[0];
8089       y2 = +_3[1];
8090       return projection2;
8091     };
8092     projection2.clipExtent = function(_3) {
8093       if (!arguments.length) return clipExtent;
8094       clipExtent = _3;
8095       return projection2;
8096     };
8097     projection2.transform = function(obj) {
8098       if (!arguments.length) return identity2.translate(x2, y2).scale(k3);
8099       x2 = +obj.x;
8100       y2 = +obj.y;
8101       k3 = +obj.k;
8102       return projection2;
8103     };
8104     projection2.stream = transform_default({
8105       point: function(x3, y3) {
8106         const vec = projection2([x3, y3]);
8107         this.stream.point(vec[0], vec[1]);
8108       }
8109     }).stream;
8110     return projection2;
8111   }
8112   var init_raw_mercator = __esm({
8113     "modules/geo/raw_mercator.js"() {
8114       "use strict";
8115       init_src2();
8116       init_src12();
8117     }
8118   });
8119
8120   // modules/geo/ortho.js
8121   var ortho_exports = {};
8122   __export(ortho_exports, {
8123     geoOrthoCalcScore: () => geoOrthoCalcScore,
8124     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
8125     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
8126     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct
8127   });
8128   function geoOrthoNormalizedDotProduct(a4, b3, origin) {
8129     if (geoVecEqual(origin, a4) || geoVecEqual(origin, b3)) {
8130       return 1;
8131     }
8132     return geoVecNormalizedDot(a4, b3, origin);
8133   }
8134   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
8135     var val = Math.abs(dotp);
8136     if (val < epsilon3) {
8137       return 0;
8138     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
8139       return 0;
8140     } else if (val < lowerThreshold || val > upperThreshold) {
8141       return dotp;
8142     } else {
8143       return null;
8144     }
8145   }
8146   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
8147     var score = 0;
8148     var first = isClosed ? 0 : 1;
8149     var last2 = isClosed ? points.length : points.length - 1;
8150     var coords = points.map(function(p2) {
8151       return p2.coord;
8152     });
8153     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
8154     var upperThreshold = Math.cos(threshold * Math.PI / 180);
8155     for (var i3 = first; i3 < last2; i3++) {
8156       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8157       var origin = coords[i3];
8158       var b3 = coords[(i3 + 1) % coords.length];
8159       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a4, b3, origin), epsilon3, lowerThreshold, upperThreshold);
8160       if (dotp === null) continue;
8161       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
8162     }
8163     return score;
8164   }
8165   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
8166     var max3 = -Infinity;
8167     var first = isClosed ? 0 : 1;
8168     var last2 = isClosed ? coords.length : coords.length - 1;
8169     for (var i3 = first; i3 < last2; i3++) {
8170       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8171       var origin = coords[i3];
8172       var b3 = coords[(i3 + 1) % coords.length];
8173       var normalizedDotP = geoOrthoNormalizedDotProduct(a4, b3, origin);
8174       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
8175       if (angle2 > 45) angle2 = 90 - angle2;
8176       if (angle2 >= lessThan) continue;
8177       if (angle2 > max3) max3 = angle2;
8178     }
8179     if (max3 === -Infinity) return null;
8180     return max3;
8181   }
8182   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
8183     var score = null;
8184     var first = isClosed ? 0 : 1;
8185     var last2 = isClosed ? coords.length : coords.length - 1;
8186     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
8187     var upperThreshold = Math.cos(threshold * Math.PI / 180);
8188     for (var i3 = first; i3 < last2; i3++) {
8189       var a4 = coords[(i3 - 1 + coords.length) % coords.length];
8190       var origin = coords[i3];
8191       var b3 = coords[(i3 + 1) % coords.length];
8192       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a4, b3, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
8193       if (dotp === null) continue;
8194       if (Math.abs(dotp) > 0) return 1;
8195       score = 0;
8196     }
8197     return score;
8198   }
8199   var init_ortho = __esm({
8200     "modules/geo/ortho.js"() {
8201       "use strict";
8202       init_vector();
8203     }
8204   });
8205
8206   // modules/geo/index.js
8207   var geo_exports2 = {};
8208   __export(geo_exports2, {
8209     geoAngle: () => geoAngle,
8210     geoChooseEdge: () => geoChooseEdge,
8211     geoEdgeEqual: () => geoEdgeEqual,
8212     geoExtent: () => geoExtent,
8213     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
8214     geoHasLineIntersections: () => geoHasLineIntersections,
8215     geoHasSelfIntersections: () => geoHasSelfIntersections,
8216     geoLatToMeters: () => geoLatToMeters,
8217     geoLineIntersection: () => geoLineIntersection,
8218     geoLonToMeters: () => geoLonToMeters,
8219     geoMetersToLat: () => geoMetersToLat,
8220     geoMetersToLon: () => geoMetersToLon,
8221     geoMetersToOffset: () => geoMetersToOffset,
8222     geoOffsetToMeters: () => geoOffsetToMeters,
8223     geoOrthoCalcScore: () => geoOrthoCalcScore,
8224     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
8225     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
8226     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
8227     geoPathHasIntersections: () => geoPathHasIntersections,
8228     geoPathIntersections: () => geoPathIntersections,
8229     geoPathLength: () => geoPathLength,
8230     geoPointInPolygon: () => geoPointInPolygon,
8231     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
8232     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
8233     geoRawMercator: () => geoRawMercator,
8234     geoRotate: () => geoRotate,
8235     geoScaleToZoom: () => geoScaleToZoom,
8236     geoSphericalClosestNode: () => geoSphericalClosestNode,
8237     geoSphericalDistance: () => geoSphericalDistance,
8238     geoVecAdd: () => geoVecAdd,
8239     geoVecAngle: () => geoVecAngle,
8240     geoVecCross: () => geoVecCross,
8241     geoVecDot: () => geoVecDot,
8242     geoVecEqual: () => geoVecEqual,
8243     geoVecFloor: () => geoVecFloor,
8244     geoVecInterp: () => geoVecInterp,
8245     geoVecLength: () => geoVecLength,
8246     geoVecLengthSquare: () => geoVecLengthSquare,
8247     geoVecNormalize: () => geoVecNormalize,
8248     geoVecNormalizedDot: () => geoVecNormalizedDot,
8249     geoVecProject: () => geoVecProject,
8250     geoVecScale: () => geoVecScale,
8251     geoVecSubtract: () => geoVecSubtract,
8252     geoViewportEdge: () => geoViewportEdge,
8253     geoZoomToScale: () => geoZoomToScale
8254   });
8255   var init_geo2 = __esm({
8256     "modules/geo/index.js"() {
8257       "use strict";
8258       init_extent();
8259       init_geo();
8260       init_geo();
8261       init_geo();
8262       init_geo();
8263       init_geo();
8264       init_geo();
8265       init_geo();
8266       init_geo();
8267       init_geo();
8268       init_geo();
8269       init_geom();
8270       init_geom();
8271       init_geom();
8272       init_geom();
8273       init_geom();
8274       init_geom();
8275       init_geom();
8276       init_geom();
8277       init_geom();
8278       init_geom();
8279       init_geom();
8280       init_geom();
8281       init_geom();
8282       init_geom();
8283       init_geom();
8284       init_raw_mercator();
8285       init_vector();
8286       init_vector();
8287       init_vector();
8288       init_vector();
8289       init_vector();
8290       init_vector();
8291       init_vector();
8292       init_vector();
8293       init_vector();
8294       init_vector();
8295       init_vector();
8296       init_vector();
8297       init_vector();
8298       init_vector();
8299       init_ortho();
8300       init_ortho();
8301       init_ortho();
8302       init_ortho();
8303     }
8304   });
8305
8306   // node_modules/lodash-es/_freeGlobal.js
8307   var freeGlobal, freeGlobal_default;
8308   var init_freeGlobal = __esm({
8309     "node_modules/lodash-es/_freeGlobal.js"() {
8310       freeGlobal = typeof global == "object" && global && global.Object === Object && global;
8311       freeGlobal_default = freeGlobal;
8312     }
8313   });
8314
8315   // node_modules/lodash-es/_root.js
8316   var freeSelf, root2, root_default;
8317   var init_root = __esm({
8318     "node_modules/lodash-es/_root.js"() {
8319       init_freeGlobal();
8320       freeSelf = typeof self == "object" && self && self.Object === Object && self;
8321       root2 = freeGlobal_default || freeSelf || Function("return this")();
8322       root_default = root2;
8323     }
8324   });
8325
8326   // node_modules/lodash-es/_Symbol.js
8327   var Symbol2, Symbol_default;
8328   var init_Symbol = __esm({
8329     "node_modules/lodash-es/_Symbol.js"() {
8330       init_root();
8331       Symbol2 = root_default.Symbol;
8332       Symbol_default = Symbol2;
8333     }
8334   });
8335
8336   // node_modules/lodash-es/_getRawTag.js
8337   function getRawTag(value) {
8338     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
8339     try {
8340       value[symToStringTag] = void 0;
8341       var unmasked = true;
8342     } catch (e3) {
8343     }
8344     var result = nativeObjectToString.call(value);
8345     if (unmasked) {
8346       if (isOwn) {
8347         value[symToStringTag] = tag;
8348       } else {
8349         delete value[symToStringTag];
8350       }
8351     }
8352     return result;
8353   }
8354   var objectProto, hasOwnProperty, nativeObjectToString, symToStringTag, getRawTag_default;
8355   var init_getRawTag = __esm({
8356     "node_modules/lodash-es/_getRawTag.js"() {
8357       init_Symbol();
8358       objectProto = Object.prototype;
8359       hasOwnProperty = objectProto.hasOwnProperty;
8360       nativeObjectToString = objectProto.toString;
8361       symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
8362       getRawTag_default = getRawTag;
8363     }
8364   });
8365
8366   // node_modules/lodash-es/_objectToString.js
8367   function objectToString(value) {
8368     return nativeObjectToString2.call(value);
8369   }
8370   var objectProto2, nativeObjectToString2, objectToString_default;
8371   var init_objectToString = __esm({
8372     "node_modules/lodash-es/_objectToString.js"() {
8373       objectProto2 = Object.prototype;
8374       nativeObjectToString2 = objectProto2.toString;
8375       objectToString_default = objectToString;
8376     }
8377   });
8378
8379   // node_modules/lodash-es/_baseGetTag.js
8380   function baseGetTag(value) {
8381     if (value == null) {
8382       return value === void 0 ? undefinedTag : nullTag;
8383     }
8384     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
8385   }
8386   var nullTag, undefinedTag, symToStringTag2, baseGetTag_default;
8387   var init_baseGetTag = __esm({
8388     "node_modules/lodash-es/_baseGetTag.js"() {
8389       init_Symbol();
8390       init_getRawTag();
8391       init_objectToString();
8392       nullTag = "[object Null]";
8393       undefinedTag = "[object Undefined]";
8394       symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
8395       baseGetTag_default = baseGetTag;
8396     }
8397   });
8398
8399   // node_modules/lodash-es/isObjectLike.js
8400   function isObjectLike(value) {
8401     return value != null && typeof value == "object";
8402   }
8403   var isObjectLike_default;
8404   var init_isObjectLike = __esm({
8405     "node_modules/lodash-es/isObjectLike.js"() {
8406       isObjectLike_default = isObjectLike;
8407     }
8408   });
8409
8410   // node_modules/lodash-es/isSymbol.js
8411   function isSymbol(value) {
8412     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
8413   }
8414   var symbolTag, isSymbol_default;
8415   var init_isSymbol = __esm({
8416     "node_modules/lodash-es/isSymbol.js"() {
8417       init_baseGetTag();
8418       init_isObjectLike();
8419       symbolTag = "[object Symbol]";
8420       isSymbol_default = isSymbol;
8421     }
8422   });
8423
8424   // node_modules/lodash-es/_arrayMap.js
8425   function arrayMap(array2, iteratee) {
8426     var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
8427     while (++index < length2) {
8428       result[index] = iteratee(array2[index], index, array2);
8429     }
8430     return result;
8431   }
8432   var arrayMap_default;
8433   var init_arrayMap = __esm({
8434     "node_modules/lodash-es/_arrayMap.js"() {
8435       arrayMap_default = arrayMap;
8436     }
8437   });
8438
8439   // node_modules/lodash-es/isArray.js
8440   var isArray, isArray_default;
8441   var init_isArray = __esm({
8442     "node_modules/lodash-es/isArray.js"() {
8443       isArray = Array.isArray;
8444       isArray_default = isArray;
8445     }
8446   });
8447
8448   // node_modules/lodash-es/_baseToString.js
8449   function baseToString(value) {
8450     if (typeof value == "string") {
8451       return value;
8452     }
8453     if (isArray_default(value)) {
8454       return arrayMap_default(value, baseToString) + "";
8455     }
8456     if (isSymbol_default(value)) {
8457       return symbolToString ? symbolToString.call(value) : "";
8458     }
8459     var result = value + "";
8460     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
8461   }
8462   var INFINITY, symbolProto, symbolToString, baseToString_default;
8463   var init_baseToString = __esm({
8464     "node_modules/lodash-es/_baseToString.js"() {
8465       init_Symbol();
8466       init_arrayMap();
8467       init_isArray();
8468       init_isSymbol();
8469       INFINITY = 1 / 0;
8470       symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
8471       symbolToString = symbolProto ? symbolProto.toString : void 0;
8472       baseToString_default = baseToString;
8473     }
8474   });
8475
8476   // node_modules/lodash-es/_trimmedEndIndex.js
8477   function trimmedEndIndex(string) {
8478     var index = string.length;
8479     while (index-- && reWhitespace.test(string.charAt(index))) {
8480     }
8481     return index;
8482   }
8483   var reWhitespace, trimmedEndIndex_default;
8484   var init_trimmedEndIndex = __esm({
8485     "node_modules/lodash-es/_trimmedEndIndex.js"() {
8486       reWhitespace = /\s/;
8487       trimmedEndIndex_default = trimmedEndIndex;
8488     }
8489   });
8490
8491   // node_modules/lodash-es/_baseTrim.js
8492   function baseTrim(string) {
8493     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
8494   }
8495   var reTrimStart, baseTrim_default;
8496   var init_baseTrim = __esm({
8497     "node_modules/lodash-es/_baseTrim.js"() {
8498       init_trimmedEndIndex();
8499       reTrimStart = /^\s+/;
8500       baseTrim_default = baseTrim;
8501     }
8502   });
8503
8504   // node_modules/lodash-es/isObject.js
8505   function isObject(value) {
8506     var type2 = typeof value;
8507     return value != null && (type2 == "object" || type2 == "function");
8508   }
8509   var isObject_default;
8510   var init_isObject = __esm({
8511     "node_modules/lodash-es/isObject.js"() {
8512       isObject_default = isObject;
8513     }
8514   });
8515
8516   // node_modules/lodash-es/toNumber.js
8517   function toNumber(value) {
8518     if (typeof value == "number") {
8519       return value;
8520     }
8521     if (isSymbol_default(value)) {
8522       return NAN;
8523     }
8524     if (isObject_default(value)) {
8525       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
8526       value = isObject_default(other) ? other + "" : other;
8527     }
8528     if (typeof value != "string") {
8529       return value === 0 ? value : +value;
8530     }
8531     value = baseTrim_default(value);
8532     var isBinary = reIsBinary.test(value);
8533     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
8534   }
8535   var NAN, reIsBadHex, reIsBinary, reIsOctal, freeParseInt, toNumber_default;
8536   var init_toNumber = __esm({
8537     "node_modules/lodash-es/toNumber.js"() {
8538       init_baseTrim();
8539       init_isObject();
8540       init_isSymbol();
8541       NAN = 0 / 0;
8542       reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
8543       reIsBinary = /^0b[01]+$/i;
8544       reIsOctal = /^0o[0-7]+$/i;
8545       freeParseInt = parseInt;
8546       toNumber_default = toNumber;
8547     }
8548   });
8549
8550   // node_modules/lodash-es/identity.js
8551   function identity3(value) {
8552     return value;
8553   }
8554   var identity_default3;
8555   var init_identity3 = __esm({
8556     "node_modules/lodash-es/identity.js"() {
8557       identity_default3 = identity3;
8558     }
8559   });
8560
8561   // node_modules/lodash-es/isFunction.js
8562   function isFunction(value) {
8563     if (!isObject_default(value)) {
8564       return false;
8565     }
8566     var tag = baseGetTag_default(value);
8567     return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
8568   }
8569   var asyncTag, funcTag, genTag, proxyTag, isFunction_default;
8570   var init_isFunction = __esm({
8571     "node_modules/lodash-es/isFunction.js"() {
8572       init_baseGetTag();
8573       init_isObject();
8574       asyncTag = "[object AsyncFunction]";
8575       funcTag = "[object Function]";
8576       genTag = "[object GeneratorFunction]";
8577       proxyTag = "[object Proxy]";
8578       isFunction_default = isFunction;
8579     }
8580   });
8581
8582   // node_modules/lodash-es/_coreJsData.js
8583   var coreJsData, coreJsData_default;
8584   var init_coreJsData = __esm({
8585     "node_modules/lodash-es/_coreJsData.js"() {
8586       init_root();
8587       coreJsData = root_default["__core-js_shared__"];
8588       coreJsData_default = coreJsData;
8589     }
8590   });
8591
8592   // node_modules/lodash-es/_isMasked.js
8593   function isMasked(func) {
8594     return !!maskSrcKey && maskSrcKey in func;
8595   }
8596   var maskSrcKey, isMasked_default;
8597   var init_isMasked = __esm({
8598     "node_modules/lodash-es/_isMasked.js"() {
8599       init_coreJsData();
8600       maskSrcKey = function() {
8601         var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
8602         return uid ? "Symbol(src)_1." + uid : "";
8603       }();
8604       isMasked_default = isMasked;
8605     }
8606   });
8607
8608   // node_modules/lodash-es/_toSource.js
8609   function toSource(func) {
8610     if (func != null) {
8611       try {
8612         return funcToString.call(func);
8613       } catch (e3) {
8614       }
8615       try {
8616         return func + "";
8617       } catch (e3) {
8618       }
8619     }
8620     return "";
8621   }
8622   var funcProto, funcToString, toSource_default;
8623   var init_toSource = __esm({
8624     "node_modules/lodash-es/_toSource.js"() {
8625       funcProto = Function.prototype;
8626       funcToString = funcProto.toString;
8627       toSource_default = toSource;
8628     }
8629   });
8630
8631   // node_modules/lodash-es/_baseIsNative.js
8632   function baseIsNative(value) {
8633     if (!isObject_default(value) || isMasked_default(value)) {
8634       return false;
8635     }
8636     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
8637     return pattern.test(toSource_default(value));
8638   }
8639   var reRegExpChar, reIsHostCtor, funcProto2, objectProto3, funcToString2, hasOwnProperty2, reIsNative, baseIsNative_default;
8640   var init_baseIsNative = __esm({
8641     "node_modules/lodash-es/_baseIsNative.js"() {
8642       init_isFunction();
8643       init_isMasked();
8644       init_isObject();
8645       init_toSource();
8646       reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
8647       reIsHostCtor = /^\[object .+?Constructor\]$/;
8648       funcProto2 = Function.prototype;
8649       objectProto3 = Object.prototype;
8650       funcToString2 = funcProto2.toString;
8651       hasOwnProperty2 = objectProto3.hasOwnProperty;
8652       reIsNative = RegExp(
8653         "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
8654       );
8655       baseIsNative_default = baseIsNative;
8656     }
8657   });
8658
8659   // node_modules/lodash-es/_getValue.js
8660   function getValue(object, key) {
8661     return object == null ? void 0 : object[key];
8662   }
8663   var getValue_default;
8664   var init_getValue = __esm({
8665     "node_modules/lodash-es/_getValue.js"() {
8666       getValue_default = getValue;
8667     }
8668   });
8669
8670   // node_modules/lodash-es/_getNative.js
8671   function getNative(object, key) {
8672     var value = getValue_default(object, key);
8673     return baseIsNative_default(value) ? value : void 0;
8674   }
8675   var getNative_default;
8676   var init_getNative = __esm({
8677     "node_modules/lodash-es/_getNative.js"() {
8678       init_baseIsNative();
8679       init_getValue();
8680       getNative_default = getNative;
8681     }
8682   });
8683
8684   // node_modules/lodash-es/_WeakMap.js
8685   var WeakMap, WeakMap_default;
8686   var init_WeakMap = __esm({
8687     "node_modules/lodash-es/_WeakMap.js"() {
8688       init_getNative();
8689       init_root();
8690       WeakMap = getNative_default(root_default, "WeakMap");
8691       WeakMap_default = WeakMap;
8692     }
8693   });
8694
8695   // node_modules/lodash-es/_baseCreate.js
8696   var objectCreate, baseCreate, baseCreate_default;
8697   var init_baseCreate = __esm({
8698     "node_modules/lodash-es/_baseCreate.js"() {
8699       init_isObject();
8700       objectCreate = Object.create;
8701       baseCreate = /* @__PURE__ */ function() {
8702         function object() {
8703         }
8704         return function(proto) {
8705           if (!isObject_default(proto)) {
8706             return {};
8707           }
8708           if (objectCreate) {
8709             return objectCreate(proto);
8710           }
8711           object.prototype = proto;
8712           var result = new object();
8713           object.prototype = void 0;
8714           return result;
8715         };
8716       }();
8717       baseCreate_default = baseCreate;
8718     }
8719   });
8720
8721   // node_modules/lodash-es/_apply.js
8722   function apply(func, thisArg, args) {
8723     switch (args.length) {
8724       case 0:
8725         return func.call(thisArg);
8726       case 1:
8727         return func.call(thisArg, args[0]);
8728       case 2:
8729         return func.call(thisArg, args[0], args[1]);
8730       case 3:
8731         return func.call(thisArg, args[0], args[1], args[2]);
8732     }
8733     return func.apply(thisArg, args);
8734   }
8735   var apply_default;
8736   var init_apply = __esm({
8737     "node_modules/lodash-es/_apply.js"() {
8738       apply_default = apply;
8739     }
8740   });
8741
8742   // node_modules/lodash-es/_copyArray.js
8743   function copyArray(source, array2) {
8744     var index = -1, length2 = source.length;
8745     array2 || (array2 = Array(length2));
8746     while (++index < length2) {
8747       array2[index] = source[index];
8748     }
8749     return array2;
8750   }
8751   var copyArray_default;
8752   var init_copyArray = __esm({
8753     "node_modules/lodash-es/_copyArray.js"() {
8754       copyArray_default = copyArray;
8755     }
8756   });
8757
8758   // node_modules/lodash-es/_shortOut.js
8759   function shortOut(func) {
8760     var count = 0, lastCalled = 0;
8761     return function() {
8762       var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
8763       lastCalled = stamp;
8764       if (remaining > 0) {
8765         if (++count >= HOT_COUNT) {
8766           return arguments[0];
8767         }
8768       } else {
8769         count = 0;
8770       }
8771       return func.apply(void 0, arguments);
8772     };
8773   }
8774   var HOT_COUNT, HOT_SPAN, nativeNow, shortOut_default;
8775   var init_shortOut = __esm({
8776     "node_modules/lodash-es/_shortOut.js"() {
8777       HOT_COUNT = 800;
8778       HOT_SPAN = 16;
8779       nativeNow = Date.now;
8780       shortOut_default = shortOut;
8781     }
8782   });
8783
8784   // node_modules/lodash-es/constant.js
8785   function constant(value) {
8786     return function() {
8787       return value;
8788     };
8789   }
8790   var constant_default5;
8791   var init_constant5 = __esm({
8792     "node_modules/lodash-es/constant.js"() {
8793       constant_default5 = constant;
8794     }
8795   });
8796
8797   // node_modules/lodash-es/_defineProperty.js
8798   var defineProperty, defineProperty_default;
8799   var init_defineProperty = __esm({
8800     "node_modules/lodash-es/_defineProperty.js"() {
8801       init_getNative();
8802       defineProperty = function() {
8803         try {
8804           var func = getNative_default(Object, "defineProperty");
8805           func({}, "", {});
8806           return func;
8807         } catch (e3) {
8808         }
8809       }();
8810       defineProperty_default = defineProperty;
8811     }
8812   });
8813
8814   // node_modules/lodash-es/_baseSetToString.js
8815   var baseSetToString, baseSetToString_default;
8816   var init_baseSetToString = __esm({
8817     "node_modules/lodash-es/_baseSetToString.js"() {
8818       init_constant5();
8819       init_defineProperty();
8820       init_identity3();
8821       baseSetToString = !defineProperty_default ? identity_default3 : function(func, string) {
8822         return defineProperty_default(func, "toString", {
8823           "configurable": true,
8824           "enumerable": false,
8825           "value": constant_default5(string),
8826           "writable": true
8827         });
8828       };
8829       baseSetToString_default = baseSetToString;
8830     }
8831   });
8832
8833   // node_modules/lodash-es/_setToString.js
8834   var setToString, setToString_default;
8835   var init_setToString = __esm({
8836     "node_modules/lodash-es/_setToString.js"() {
8837       init_baseSetToString();
8838       init_shortOut();
8839       setToString = shortOut_default(baseSetToString_default);
8840       setToString_default = setToString;
8841     }
8842   });
8843
8844   // node_modules/lodash-es/_arrayEach.js
8845   function arrayEach(array2, iteratee) {
8846     var index = -1, length2 = array2 == null ? 0 : array2.length;
8847     while (++index < length2) {
8848       if (iteratee(array2[index], index, array2) === false) {
8849         break;
8850       }
8851     }
8852     return array2;
8853   }
8854   var arrayEach_default;
8855   var init_arrayEach = __esm({
8856     "node_modules/lodash-es/_arrayEach.js"() {
8857       arrayEach_default = arrayEach;
8858     }
8859   });
8860
8861   // node_modules/lodash-es/_isIndex.js
8862   function isIndex(value, length2) {
8863     var type2 = typeof value;
8864     length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
8865     return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
8866   }
8867   var MAX_SAFE_INTEGER, reIsUint, isIndex_default;
8868   var init_isIndex = __esm({
8869     "node_modules/lodash-es/_isIndex.js"() {
8870       MAX_SAFE_INTEGER = 9007199254740991;
8871       reIsUint = /^(?:0|[1-9]\d*)$/;
8872       isIndex_default = isIndex;
8873     }
8874   });
8875
8876   // node_modules/lodash-es/_baseAssignValue.js
8877   function baseAssignValue(object, key, value) {
8878     if (key == "__proto__" && defineProperty_default) {
8879       defineProperty_default(object, key, {
8880         "configurable": true,
8881         "enumerable": true,
8882         "value": value,
8883         "writable": true
8884       });
8885     } else {
8886       object[key] = value;
8887     }
8888   }
8889   var baseAssignValue_default;
8890   var init_baseAssignValue = __esm({
8891     "node_modules/lodash-es/_baseAssignValue.js"() {
8892       init_defineProperty();
8893       baseAssignValue_default = baseAssignValue;
8894     }
8895   });
8896
8897   // node_modules/lodash-es/eq.js
8898   function eq(value, other) {
8899     return value === other || value !== value && other !== other;
8900   }
8901   var eq_default;
8902   var init_eq = __esm({
8903     "node_modules/lodash-es/eq.js"() {
8904       eq_default = eq;
8905     }
8906   });
8907
8908   // node_modules/lodash-es/_assignValue.js
8909   function assignValue(object, key, value) {
8910     var objValue = object[key];
8911     if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
8912       baseAssignValue_default(object, key, value);
8913     }
8914   }
8915   var objectProto4, hasOwnProperty3, assignValue_default;
8916   var init_assignValue = __esm({
8917     "node_modules/lodash-es/_assignValue.js"() {
8918       init_baseAssignValue();
8919       init_eq();
8920       objectProto4 = Object.prototype;
8921       hasOwnProperty3 = objectProto4.hasOwnProperty;
8922       assignValue_default = assignValue;
8923     }
8924   });
8925
8926   // node_modules/lodash-es/_copyObject.js
8927   function copyObject(source, props, object, customizer) {
8928     var isNew = !object;
8929     object || (object = {});
8930     var index = -1, length2 = props.length;
8931     while (++index < length2) {
8932       var key = props[index];
8933       var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
8934       if (newValue === void 0) {
8935         newValue = source[key];
8936       }
8937       if (isNew) {
8938         baseAssignValue_default(object, key, newValue);
8939       } else {
8940         assignValue_default(object, key, newValue);
8941       }
8942     }
8943     return object;
8944   }
8945   var copyObject_default;
8946   var init_copyObject = __esm({
8947     "node_modules/lodash-es/_copyObject.js"() {
8948       init_assignValue();
8949       init_baseAssignValue();
8950       copyObject_default = copyObject;
8951     }
8952   });
8953
8954   // node_modules/lodash-es/_overRest.js
8955   function overRest(func, start2, transform2) {
8956     start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
8957     return function() {
8958       var args = arguments, index = -1, length2 = nativeMax(args.length - start2, 0), array2 = Array(length2);
8959       while (++index < length2) {
8960         array2[index] = args[start2 + index];
8961       }
8962       index = -1;
8963       var otherArgs = Array(start2 + 1);
8964       while (++index < start2) {
8965         otherArgs[index] = args[index];
8966       }
8967       otherArgs[start2] = transform2(array2);
8968       return apply_default(func, this, otherArgs);
8969     };
8970   }
8971   var nativeMax, overRest_default;
8972   var init_overRest = __esm({
8973     "node_modules/lodash-es/_overRest.js"() {
8974       init_apply();
8975       nativeMax = Math.max;
8976       overRest_default = overRest;
8977     }
8978   });
8979
8980   // node_modules/lodash-es/_baseRest.js
8981   function baseRest(func, start2) {
8982     return setToString_default(overRest_default(func, start2, identity_default3), func + "");
8983   }
8984   var baseRest_default;
8985   var init_baseRest = __esm({
8986     "node_modules/lodash-es/_baseRest.js"() {
8987       init_identity3();
8988       init_overRest();
8989       init_setToString();
8990       baseRest_default = baseRest;
8991     }
8992   });
8993
8994   // node_modules/lodash-es/isLength.js
8995   function isLength(value) {
8996     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
8997   }
8998   var MAX_SAFE_INTEGER2, isLength_default;
8999   var init_isLength = __esm({
9000     "node_modules/lodash-es/isLength.js"() {
9001       MAX_SAFE_INTEGER2 = 9007199254740991;
9002       isLength_default = isLength;
9003     }
9004   });
9005
9006   // node_modules/lodash-es/isArrayLike.js
9007   function isArrayLike(value) {
9008     return value != null && isLength_default(value.length) && !isFunction_default(value);
9009   }
9010   var isArrayLike_default;
9011   var init_isArrayLike = __esm({
9012     "node_modules/lodash-es/isArrayLike.js"() {
9013       init_isFunction();
9014       init_isLength();
9015       isArrayLike_default = isArrayLike;
9016     }
9017   });
9018
9019   // node_modules/lodash-es/_isIterateeCall.js
9020   function isIterateeCall(value, index, object) {
9021     if (!isObject_default(object)) {
9022       return false;
9023     }
9024     var type2 = typeof index;
9025     if (type2 == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type2 == "string" && index in object) {
9026       return eq_default(object[index], value);
9027     }
9028     return false;
9029   }
9030   var isIterateeCall_default;
9031   var init_isIterateeCall = __esm({
9032     "node_modules/lodash-es/_isIterateeCall.js"() {
9033       init_eq();
9034       init_isArrayLike();
9035       init_isIndex();
9036       init_isObject();
9037       isIterateeCall_default = isIterateeCall;
9038     }
9039   });
9040
9041   // node_modules/lodash-es/_createAssigner.js
9042   function createAssigner(assigner) {
9043     return baseRest_default(function(object, sources) {
9044       var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
9045       customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
9046       if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
9047         customizer = length2 < 3 ? void 0 : customizer;
9048         length2 = 1;
9049       }
9050       object = Object(object);
9051       while (++index < length2) {
9052         var source = sources[index];
9053         if (source) {
9054           assigner(object, source, index, customizer);
9055         }
9056       }
9057       return object;
9058     });
9059   }
9060   var createAssigner_default;
9061   var init_createAssigner = __esm({
9062     "node_modules/lodash-es/_createAssigner.js"() {
9063       init_baseRest();
9064       init_isIterateeCall();
9065       createAssigner_default = createAssigner;
9066     }
9067   });
9068
9069   // node_modules/lodash-es/_isPrototype.js
9070   function isPrototype(value) {
9071     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
9072     return value === proto;
9073   }
9074   var objectProto5, isPrototype_default;
9075   var init_isPrototype = __esm({
9076     "node_modules/lodash-es/_isPrototype.js"() {
9077       objectProto5 = Object.prototype;
9078       isPrototype_default = isPrototype;
9079     }
9080   });
9081
9082   // node_modules/lodash-es/_baseTimes.js
9083   function baseTimes(n3, iteratee) {
9084     var index = -1, result = Array(n3);
9085     while (++index < n3) {
9086       result[index] = iteratee(index);
9087     }
9088     return result;
9089   }
9090   var baseTimes_default;
9091   var init_baseTimes = __esm({
9092     "node_modules/lodash-es/_baseTimes.js"() {
9093       baseTimes_default = baseTimes;
9094     }
9095   });
9096
9097   // node_modules/lodash-es/_baseIsArguments.js
9098   function baseIsArguments(value) {
9099     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
9100   }
9101   var argsTag, baseIsArguments_default;
9102   var init_baseIsArguments = __esm({
9103     "node_modules/lodash-es/_baseIsArguments.js"() {
9104       init_baseGetTag();
9105       init_isObjectLike();
9106       argsTag = "[object Arguments]";
9107       baseIsArguments_default = baseIsArguments;
9108     }
9109   });
9110
9111   // node_modules/lodash-es/isArguments.js
9112   var objectProto6, hasOwnProperty4, propertyIsEnumerable, isArguments, isArguments_default;
9113   var init_isArguments = __esm({
9114     "node_modules/lodash-es/isArguments.js"() {
9115       init_baseIsArguments();
9116       init_isObjectLike();
9117       objectProto6 = Object.prototype;
9118       hasOwnProperty4 = objectProto6.hasOwnProperty;
9119       propertyIsEnumerable = objectProto6.propertyIsEnumerable;
9120       isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
9121         return arguments;
9122       }()) ? baseIsArguments_default : function(value) {
9123         return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
9124       };
9125       isArguments_default = isArguments;
9126     }
9127   });
9128
9129   // node_modules/lodash-es/stubFalse.js
9130   function stubFalse() {
9131     return false;
9132   }
9133   var stubFalse_default;
9134   var init_stubFalse = __esm({
9135     "node_modules/lodash-es/stubFalse.js"() {
9136       stubFalse_default = stubFalse;
9137     }
9138   });
9139
9140   // node_modules/lodash-es/isBuffer.js
9141   var freeExports, freeModule, moduleExports, Buffer2, nativeIsBuffer, isBuffer, isBuffer_default;
9142   var init_isBuffer = __esm({
9143     "node_modules/lodash-es/isBuffer.js"() {
9144       init_root();
9145       init_stubFalse();
9146       freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
9147       freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
9148       moduleExports = freeModule && freeModule.exports === freeExports;
9149       Buffer2 = moduleExports ? root_default.Buffer : void 0;
9150       nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
9151       isBuffer = nativeIsBuffer || stubFalse_default;
9152       isBuffer_default = isBuffer;
9153     }
9154   });
9155
9156   // node_modules/lodash-es/_baseIsTypedArray.js
9157   function baseIsTypedArray(value) {
9158     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
9159   }
9160   var argsTag2, arrayTag, boolTag, dateTag, errorTag, funcTag2, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, weakMapTag, arrayBufferTag, dataViewTag, float32Tag, float64Tag, int8Tag, int16Tag, int32Tag, uint8Tag, uint8ClampedTag, uint16Tag, uint32Tag, typedArrayTags, baseIsTypedArray_default;
9161   var init_baseIsTypedArray = __esm({
9162     "node_modules/lodash-es/_baseIsTypedArray.js"() {
9163       init_baseGetTag();
9164       init_isLength();
9165       init_isObjectLike();
9166       argsTag2 = "[object Arguments]";
9167       arrayTag = "[object Array]";
9168       boolTag = "[object Boolean]";
9169       dateTag = "[object Date]";
9170       errorTag = "[object Error]";
9171       funcTag2 = "[object Function]";
9172       mapTag = "[object Map]";
9173       numberTag = "[object Number]";
9174       objectTag = "[object Object]";
9175       regexpTag = "[object RegExp]";
9176       setTag = "[object Set]";
9177       stringTag = "[object String]";
9178       weakMapTag = "[object WeakMap]";
9179       arrayBufferTag = "[object ArrayBuffer]";
9180       dataViewTag = "[object DataView]";
9181       float32Tag = "[object Float32Array]";
9182       float64Tag = "[object Float64Array]";
9183       int8Tag = "[object Int8Array]";
9184       int16Tag = "[object Int16Array]";
9185       int32Tag = "[object Int32Array]";
9186       uint8Tag = "[object Uint8Array]";
9187       uint8ClampedTag = "[object Uint8ClampedArray]";
9188       uint16Tag = "[object Uint16Array]";
9189       uint32Tag = "[object Uint32Array]";
9190       typedArrayTags = {};
9191       typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
9192       typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
9193       baseIsTypedArray_default = baseIsTypedArray;
9194     }
9195   });
9196
9197   // node_modules/lodash-es/_baseUnary.js
9198   function baseUnary(func) {
9199     return function(value) {
9200       return func(value);
9201     };
9202   }
9203   var baseUnary_default;
9204   var init_baseUnary = __esm({
9205     "node_modules/lodash-es/_baseUnary.js"() {
9206       baseUnary_default = baseUnary;
9207     }
9208   });
9209
9210   // node_modules/lodash-es/_nodeUtil.js
9211   var freeExports2, freeModule2, moduleExports2, freeProcess, nodeUtil, nodeUtil_default;
9212   var init_nodeUtil = __esm({
9213     "node_modules/lodash-es/_nodeUtil.js"() {
9214       init_freeGlobal();
9215       freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
9216       freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
9217       moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
9218       freeProcess = moduleExports2 && freeGlobal_default.process;
9219       nodeUtil = function() {
9220         try {
9221           var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
9222           if (types) {
9223             return types;
9224           }
9225           return freeProcess && freeProcess.binding && freeProcess.binding("util");
9226         } catch (e3) {
9227         }
9228       }();
9229       nodeUtil_default = nodeUtil;
9230     }
9231   });
9232
9233   // node_modules/lodash-es/isTypedArray.js
9234   var nodeIsTypedArray, isTypedArray, isTypedArray_default;
9235   var init_isTypedArray = __esm({
9236     "node_modules/lodash-es/isTypedArray.js"() {
9237       init_baseIsTypedArray();
9238       init_baseUnary();
9239       init_nodeUtil();
9240       nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
9241       isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
9242       isTypedArray_default = isTypedArray;
9243     }
9244   });
9245
9246   // node_modules/lodash-es/_arrayLikeKeys.js
9247   function arrayLikeKeys(value, inherited) {
9248     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length2 = result.length;
9249     for (var key in value) {
9250       if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
9251       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
9252       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
9253       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
9254       isIndex_default(key, length2)))) {
9255         result.push(key);
9256       }
9257     }
9258     return result;
9259   }
9260   var objectProto7, hasOwnProperty5, arrayLikeKeys_default;
9261   var init_arrayLikeKeys = __esm({
9262     "node_modules/lodash-es/_arrayLikeKeys.js"() {
9263       init_baseTimes();
9264       init_isArguments();
9265       init_isArray();
9266       init_isBuffer();
9267       init_isIndex();
9268       init_isTypedArray();
9269       objectProto7 = Object.prototype;
9270       hasOwnProperty5 = objectProto7.hasOwnProperty;
9271       arrayLikeKeys_default = arrayLikeKeys;
9272     }
9273   });
9274
9275   // node_modules/lodash-es/_overArg.js
9276   function overArg(func, transform2) {
9277     return function(arg) {
9278       return func(transform2(arg));
9279     };
9280   }
9281   var overArg_default;
9282   var init_overArg = __esm({
9283     "node_modules/lodash-es/_overArg.js"() {
9284       overArg_default = overArg;
9285     }
9286   });
9287
9288   // node_modules/lodash-es/_nativeKeys.js
9289   var nativeKeys, nativeKeys_default;
9290   var init_nativeKeys = __esm({
9291     "node_modules/lodash-es/_nativeKeys.js"() {
9292       init_overArg();
9293       nativeKeys = overArg_default(Object.keys, Object);
9294       nativeKeys_default = nativeKeys;
9295     }
9296   });
9297
9298   // node_modules/lodash-es/_baseKeys.js
9299   function baseKeys(object) {
9300     if (!isPrototype_default(object)) {
9301       return nativeKeys_default(object);
9302     }
9303     var result = [];
9304     for (var key in Object(object)) {
9305       if (hasOwnProperty6.call(object, key) && key != "constructor") {
9306         result.push(key);
9307       }
9308     }
9309     return result;
9310   }
9311   var objectProto8, hasOwnProperty6, baseKeys_default;
9312   var init_baseKeys = __esm({
9313     "node_modules/lodash-es/_baseKeys.js"() {
9314       init_isPrototype();
9315       init_nativeKeys();
9316       objectProto8 = Object.prototype;
9317       hasOwnProperty6 = objectProto8.hasOwnProperty;
9318       baseKeys_default = baseKeys;
9319     }
9320   });
9321
9322   // node_modules/lodash-es/keys.js
9323   function keys(object) {
9324     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
9325   }
9326   var keys_default;
9327   var init_keys = __esm({
9328     "node_modules/lodash-es/keys.js"() {
9329       init_arrayLikeKeys();
9330       init_baseKeys();
9331       init_isArrayLike();
9332       keys_default = keys;
9333     }
9334   });
9335
9336   // node_modules/lodash-es/_nativeKeysIn.js
9337   function nativeKeysIn(object) {
9338     var result = [];
9339     if (object != null) {
9340       for (var key in Object(object)) {
9341         result.push(key);
9342       }
9343     }
9344     return result;
9345   }
9346   var nativeKeysIn_default;
9347   var init_nativeKeysIn = __esm({
9348     "node_modules/lodash-es/_nativeKeysIn.js"() {
9349       nativeKeysIn_default = nativeKeysIn;
9350     }
9351   });
9352
9353   // node_modules/lodash-es/_baseKeysIn.js
9354   function baseKeysIn(object) {
9355     if (!isObject_default(object)) {
9356       return nativeKeysIn_default(object);
9357     }
9358     var isProto = isPrototype_default(object), result = [];
9359     for (var key in object) {
9360       if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object, key)))) {
9361         result.push(key);
9362       }
9363     }
9364     return result;
9365   }
9366   var objectProto9, hasOwnProperty7, baseKeysIn_default;
9367   var init_baseKeysIn = __esm({
9368     "node_modules/lodash-es/_baseKeysIn.js"() {
9369       init_isObject();
9370       init_isPrototype();
9371       init_nativeKeysIn();
9372       objectProto9 = Object.prototype;
9373       hasOwnProperty7 = objectProto9.hasOwnProperty;
9374       baseKeysIn_default = baseKeysIn;
9375     }
9376   });
9377
9378   // node_modules/lodash-es/keysIn.js
9379   function keysIn(object) {
9380     return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
9381   }
9382   var keysIn_default;
9383   var init_keysIn = __esm({
9384     "node_modules/lodash-es/keysIn.js"() {
9385       init_arrayLikeKeys();
9386       init_baseKeysIn();
9387       init_isArrayLike();
9388       keysIn_default = keysIn;
9389     }
9390   });
9391
9392   // node_modules/lodash-es/_isKey.js
9393   function isKey(value, object) {
9394     if (isArray_default(value)) {
9395       return false;
9396     }
9397     var type2 = typeof value;
9398     if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol_default(value)) {
9399       return true;
9400     }
9401     return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
9402   }
9403   var reIsDeepProp, reIsPlainProp, isKey_default;
9404   var init_isKey = __esm({
9405     "node_modules/lodash-es/_isKey.js"() {
9406       init_isArray();
9407       init_isSymbol();
9408       reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
9409       reIsPlainProp = /^\w*$/;
9410       isKey_default = isKey;
9411     }
9412   });
9413
9414   // node_modules/lodash-es/_nativeCreate.js
9415   var nativeCreate, nativeCreate_default;
9416   var init_nativeCreate = __esm({
9417     "node_modules/lodash-es/_nativeCreate.js"() {
9418       init_getNative();
9419       nativeCreate = getNative_default(Object, "create");
9420       nativeCreate_default = nativeCreate;
9421     }
9422   });
9423
9424   // node_modules/lodash-es/_hashClear.js
9425   function hashClear() {
9426     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
9427     this.size = 0;
9428   }
9429   var hashClear_default;
9430   var init_hashClear = __esm({
9431     "node_modules/lodash-es/_hashClear.js"() {
9432       init_nativeCreate();
9433       hashClear_default = hashClear;
9434     }
9435   });
9436
9437   // node_modules/lodash-es/_hashDelete.js
9438   function hashDelete(key) {
9439     var result = this.has(key) && delete this.__data__[key];
9440     this.size -= result ? 1 : 0;
9441     return result;
9442   }
9443   var hashDelete_default;
9444   var init_hashDelete = __esm({
9445     "node_modules/lodash-es/_hashDelete.js"() {
9446       hashDelete_default = hashDelete;
9447     }
9448   });
9449
9450   // node_modules/lodash-es/_hashGet.js
9451   function hashGet(key) {
9452     var data = this.__data__;
9453     if (nativeCreate_default) {
9454       var result = data[key];
9455       return result === HASH_UNDEFINED ? void 0 : result;
9456     }
9457     return hasOwnProperty8.call(data, key) ? data[key] : void 0;
9458   }
9459   var HASH_UNDEFINED, objectProto10, hasOwnProperty8, hashGet_default;
9460   var init_hashGet = __esm({
9461     "node_modules/lodash-es/_hashGet.js"() {
9462       init_nativeCreate();
9463       HASH_UNDEFINED = "__lodash_hash_undefined__";
9464       objectProto10 = Object.prototype;
9465       hasOwnProperty8 = objectProto10.hasOwnProperty;
9466       hashGet_default = hashGet;
9467     }
9468   });
9469
9470   // node_modules/lodash-es/_hashHas.js
9471   function hashHas(key) {
9472     var data = this.__data__;
9473     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty9.call(data, key);
9474   }
9475   var objectProto11, hasOwnProperty9, hashHas_default;
9476   var init_hashHas = __esm({
9477     "node_modules/lodash-es/_hashHas.js"() {
9478       init_nativeCreate();
9479       objectProto11 = Object.prototype;
9480       hasOwnProperty9 = objectProto11.hasOwnProperty;
9481       hashHas_default = hashHas;
9482     }
9483   });
9484
9485   // node_modules/lodash-es/_hashSet.js
9486   function hashSet(key, value) {
9487     var data = this.__data__;
9488     this.size += this.has(key) ? 0 : 1;
9489     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
9490     return this;
9491   }
9492   var HASH_UNDEFINED2, hashSet_default;
9493   var init_hashSet = __esm({
9494     "node_modules/lodash-es/_hashSet.js"() {
9495       init_nativeCreate();
9496       HASH_UNDEFINED2 = "__lodash_hash_undefined__";
9497       hashSet_default = hashSet;
9498     }
9499   });
9500
9501   // node_modules/lodash-es/_Hash.js
9502   function Hash(entries) {
9503     var index = -1, length2 = entries == null ? 0 : entries.length;
9504     this.clear();
9505     while (++index < length2) {
9506       var entry = entries[index];
9507       this.set(entry[0], entry[1]);
9508     }
9509   }
9510   var Hash_default;
9511   var init_Hash = __esm({
9512     "node_modules/lodash-es/_Hash.js"() {
9513       init_hashClear();
9514       init_hashDelete();
9515       init_hashGet();
9516       init_hashHas();
9517       init_hashSet();
9518       Hash.prototype.clear = hashClear_default;
9519       Hash.prototype["delete"] = hashDelete_default;
9520       Hash.prototype.get = hashGet_default;
9521       Hash.prototype.has = hashHas_default;
9522       Hash.prototype.set = hashSet_default;
9523       Hash_default = Hash;
9524     }
9525   });
9526
9527   // node_modules/lodash-es/_listCacheClear.js
9528   function listCacheClear() {
9529     this.__data__ = [];
9530     this.size = 0;
9531   }
9532   var listCacheClear_default;
9533   var init_listCacheClear = __esm({
9534     "node_modules/lodash-es/_listCacheClear.js"() {
9535       listCacheClear_default = listCacheClear;
9536     }
9537   });
9538
9539   // node_modules/lodash-es/_assocIndexOf.js
9540   function assocIndexOf(array2, key) {
9541     var length2 = array2.length;
9542     while (length2--) {
9543       if (eq_default(array2[length2][0], key)) {
9544         return length2;
9545       }
9546     }
9547     return -1;
9548   }
9549   var assocIndexOf_default;
9550   var init_assocIndexOf = __esm({
9551     "node_modules/lodash-es/_assocIndexOf.js"() {
9552       init_eq();
9553       assocIndexOf_default = assocIndexOf;
9554     }
9555   });
9556
9557   // node_modules/lodash-es/_listCacheDelete.js
9558   function listCacheDelete(key) {
9559     var data = this.__data__, index = assocIndexOf_default(data, key);
9560     if (index < 0) {
9561       return false;
9562     }
9563     var lastIndex = data.length - 1;
9564     if (index == lastIndex) {
9565       data.pop();
9566     } else {
9567       splice.call(data, index, 1);
9568     }
9569     --this.size;
9570     return true;
9571   }
9572   var arrayProto, splice, listCacheDelete_default;
9573   var init_listCacheDelete = __esm({
9574     "node_modules/lodash-es/_listCacheDelete.js"() {
9575       init_assocIndexOf();
9576       arrayProto = Array.prototype;
9577       splice = arrayProto.splice;
9578       listCacheDelete_default = listCacheDelete;
9579     }
9580   });
9581
9582   // node_modules/lodash-es/_listCacheGet.js
9583   function listCacheGet(key) {
9584     var data = this.__data__, index = assocIndexOf_default(data, key);
9585     return index < 0 ? void 0 : data[index][1];
9586   }
9587   var listCacheGet_default;
9588   var init_listCacheGet = __esm({
9589     "node_modules/lodash-es/_listCacheGet.js"() {
9590       init_assocIndexOf();
9591       listCacheGet_default = listCacheGet;
9592     }
9593   });
9594
9595   // node_modules/lodash-es/_listCacheHas.js
9596   function listCacheHas(key) {
9597     return assocIndexOf_default(this.__data__, key) > -1;
9598   }
9599   var listCacheHas_default;
9600   var init_listCacheHas = __esm({
9601     "node_modules/lodash-es/_listCacheHas.js"() {
9602       init_assocIndexOf();
9603       listCacheHas_default = listCacheHas;
9604     }
9605   });
9606
9607   // node_modules/lodash-es/_listCacheSet.js
9608   function listCacheSet(key, value) {
9609     var data = this.__data__, index = assocIndexOf_default(data, key);
9610     if (index < 0) {
9611       ++this.size;
9612       data.push([key, value]);
9613     } else {
9614       data[index][1] = value;
9615     }
9616     return this;
9617   }
9618   var listCacheSet_default;
9619   var init_listCacheSet = __esm({
9620     "node_modules/lodash-es/_listCacheSet.js"() {
9621       init_assocIndexOf();
9622       listCacheSet_default = listCacheSet;
9623     }
9624   });
9625
9626   // node_modules/lodash-es/_ListCache.js
9627   function ListCache(entries) {
9628     var index = -1, length2 = entries == null ? 0 : entries.length;
9629     this.clear();
9630     while (++index < length2) {
9631       var entry = entries[index];
9632       this.set(entry[0], entry[1]);
9633     }
9634   }
9635   var ListCache_default;
9636   var init_ListCache = __esm({
9637     "node_modules/lodash-es/_ListCache.js"() {
9638       init_listCacheClear();
9639       init_listCacheDelete();
9640       init_listCacheGet();
9641       init_listCacheHas();
9642       init_listCacheSet();
9643       ListCache.prototype.clear = listCacheClear_default;
9644       ListCache.prototype["delete"] = listCacheDelete_default;
9645       ListCache.prototype.get = listCacheGet_default;
9646       ListCache.prototype.has = listCacheHas_default;
9647       ListCache.prototype.set = listCacheSet_default;
9648       ListCache_default = ListCache;
9649     }
9650   });
9651
9652   // node_modules/lodash-es/_Map.js
9653   var Map2, Map_default;
9654   var init_Map = __esm({
9655     "node_modules/lodash-es/_Map.js"() {
9656       init_getNative();
9657       init_root();
9658       Map2 = getNative_default(root_default, "Map");
9659       Map_default = Map2;
9660     }
9661   });
9662
9663   // node_modules/lodash-es/_mapCacheClear.js
9664   function mapCacheClear() {
9665     this.size = 0;
9666     this.__data__ = {
9667       "hash": new Hash_default(),
9668       "map": new (Map_default || ListCache_default)(),
9669       "string": new Hash_default()
9670     };
9671   }
9672   var mapCacheClear_default;
9673   var init_mapCacheClear = __esm({
9674     "node_modules/lodash-es/_mapCacheClear.js"() {
9675       init_Hash();
9676       init_ListCache();
9677       init_Map();
9678       mapCacheClear_default = mapCacheClear;
9679     }
9680   });
9681
9682   // node_modules/lodash-es/_isKeyable.js
9683   function isKeyable(value) {
9684     var type2 = typeof value;
9685     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9686   }
9687   var isKeyable_default;
9688   var init_isKeyable = __esm({
9689     "node_modules/lodash-es/_isKeyable.js"() {
9690       isKeyable_default = isKeyable;
9691     }
9692   });
9693
9694   // node_modules/lodash-es/_getMapData.js
9695   function getMapData(map2, key) {
9696     var data = map2.__data__;
9697     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9698   }
9699   var getMapData_default;
9700   var init_getMapData = __esm({
9701     "node_modules/lodash-es/_getMapData.js"() {
9702       init_isKeyable();
9703       getMapData_default = getMapData;
9704     }
9705   });
9706
9707   // node_modules/lodash-es/_mapCacheDelete.js
9708   function mapCacheDelete(key) {
9709     var result = getMapData_default(this, key)["delete"](key);
9710     this.size -= result ? 1 : 0;
9711     return result;
9712   }
9713   var mapCacheDelete_default;
9714   var init_mapCacheDelete = __esm({
9715     "node_modules/lodash-es/_mapCacheDelete.js"() {
9716       init_getMapData();
9717       mapCacheDelete_default = mapCacheDelete;
9718     }
9719   });
9720
9721   // node_modules/lodash-es/_mapCacheGet.js
9722   function mapCacheGet(key) {
9723     return getMapData_default(this, key).get(key);
9724   }
9725   var mapCacheGet_default;
9726   var init_mapCacheGet = __esm({
9727     "node_modules/lodash-es/_mapCacheGet.js"() {
9728       init_getMapData();
9729       mapCacheGet_default = mapCacheGet;
9730     }
9731   });
9732
9733   // node_modules/lodash-es/_mapCacheHas.js
9734   function mapCacheHas(key) {
9735     return getMapData_default(this, key).has(key);
9736   }
9737   var mapCacheHas_default;
9738   var init_mapCacheHas = __esm({
9739     "node_modules/lodash-es/_mapCacheHas.js"() {
9740       init_getMapData();
9741       mapCacheHas_default = mapCacheHas;
9742     }
9743   });
9744
9745   // node_modules/lodash-es/_mapCacheSet.js
9746   function mapCacheSet(key, value) {
9747     var data = getMapData_default(this, key), size = data.size;
9748     data.set(key, value);
9749     this.size += data.size == size ? 0 : 1;
9750     return this;
9751   }
9752   var mapCacheSet_default;
9753   var init_mapCacheSet = __esm({
9754     "node_modules/lodash-es/_mapCacheSet.js"() {
9755       init_getMapData();
9756       mapCacheSet_default = mapCacheSet;
9757     }
9758   });
9759
9760   // node_modules/lodash-es/_MapCache.js
9761   function MapCache(entries) {
9762     var index = -1, length2 = entries == null ? 0 : entries.length;
9763     this.clear();
9764     while (++index < length2) {
9765       var entry = entries[index];
9766       this.set(entry[0], entry[1]);
9767     }
9768   }
9769   var MapCache_default;
9770   var init_MapCache = __esm({
9771     "node_modules/lodash-es/_MapCache.js"() {
9772       init_mapCacheClear();
9773       init_mapCacheDelete();
9774       init_mapCacheGet();
9775       init_mapCacheHas();
9776       init_mapCacheSet();
9777       MapCache.prototype.clear = mapCacheClear_default;
9778       MapCache.prototype["delete"] = mapCacheDelete_default;
9779       MapCache.prototype.get = mapCacheGet_default;
9780       MapCache.prototype.has = mapCacheHas_default;
9781       MapCache.prototype.set = mapCacheSet_default;
9782       MapCache_default = MapCache;
9783     }
9784   });
9785
9786   // node_modules/lodash-es/memoize.js
9787   function memoize(func, resolver) {
9788     if (typeof func != "function" || resolver != null && typeof resolver != "function") {
9789       throw new TypeError(FUNC_ERROR_TEXT);
9790     }
9791     var memoized = function() {
9792       var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
9793       if (cache.has(key)) {
9794         return cache.get(key);
9795       }
9796       var result = func.apply(this, args);
9797       memoized.cache = cache.set(key, result) || cache;
9798       return result;
9799     };
9800     memoized.cache = new (memoize.Cache || MapCache_default)();
9801     return memoized;
9802   }
9803   var FUNC_ERROR_TEXT, memoize_default;
9804   var init_memoize = __esm({
9805     "node_modules/lodash-es/memoize.js"() {
9806       init_MapCache();
9807       FUNC_ERROR_TEXT = "Expected a function";
9808       memoize.Cache = MapCache_default;
9809       memoize_default = memoize;
9810     }
9811   });
9812
9813   // node_modules/lodash-es/_memoizeCapped.js
9814   function memoizeCapped(func) {
9815     var result = memoize_default(func, function(key) {
9816       if (cache.size === MAX_MEMOIZE_SIZE) {
9817         cache.clear();
9818       }
9819       return key;
9820     });
9821     var cache = result.cache;
9822     return result;
9823   }
9824   var MAX_MEMOIZE_SIZE, memoizeCapped_default;
9825   var init_memoizeCapped = __esm({
9826     "node_modules/lodash-es/_memoizeCapped.js"() {
9827       init_memoize();
9828       MAX_MEMOIZE_SIZE = 500;
9829       memoizeCapped_default = memoizeCapped;
9830     }
9831   });
9832
9833   // node_modules/lodash-es/_stringToPath.js
9834   var rePropName, reEscapeChar, stringToPath, stringToPath_default;
9835   var init_stringToPath = __esm({
9836     "node_modules/lodash-es/_stringToPath.js"() {
9837       init_memoizeCapped();
9838       rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
9839       reEscapeChar = /\\(\\)?/g;
9840       stringToPath = memoizeCapped_default(function(string) {
9841         var result = [];
9842         if (string.charCodeAt(0) === 46) {
9843           result.push("");
9844         }
9845         string.replace(rePropName, function(match, number3, quote, subString) {
9846           result.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
9847         });
9848         return result;
9849       });
9850       stringToPath_default = stringToPath;
9851     }
9852   });
9853
9854   // node_modules/lodash-es/toString.js
9855   function toString(value) {
9856     return value == null ? "" : baseToString_default(value);
9857   }
9858   var toString_default;
9859   var init_toString = __esm({
9860     "node_modules/lodash-es/toString.js"() {
9861       init_baseToString();
9862       toString_default = toString;
9863     }
9864   });
9865
9866   // node_modules/lodash-es/_castPath.js
9867   function castPath(value, object) {
9868     if (isArray_default(value)) {
9869       return value;
9870     }
9871     return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value));
9872   }
9873   var castPath_default;
9874   var init_castPath = __esm({
9875     "node_modules/lodash-es/_castPath.js"() {
9876       init_isArray();
9877       init_isKey();
9878       init_stringToPath();
9879       init_toString();
9880       castPath_default = castPath;
9881     }
9882   });
9883
9884   // node_modules/lodash-es/_toKey.js
9885   function toKey(value) {
9886     if (typeof value == "string" || isSymbol_default(value)) {
9887       return value;
9888     }
9889     var result = value + "";
9890     return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
9891   }
9892   var INFINITY2, toKey_default;
9893   var init_toKey = __esm({
9894     "node_modules/lodash-es/_toKey.js"() {
9895       init_isSymbol();
9896       INFINITY2 = 1 / 0;
9897       toKey_default = toKey;
9898     }
9899   });
9900
9901   // node_modules/lodash-es/_baseGet.js
9902   function baseGet(object, path) {
9903     path = castPath_default(path, object);
9904     var index = 0, length2 = path.length;
9905     while (object != null && index < length2) {
9906       object = object[toKey_default(path[index++])];
9907     }
9908     return index && index == length2 ? object : void 0;
9909   }
9910   var baseGet_default;
9911   var init_baseGet = __esm({
9912     "node_modules/lodash-es/_baseGet.js"() {
9913       init_castPath();
9914       init_toKey();
9915       baseGet_default = baseGet;
9916     }
9917   });
9918
9919   // node_modules/lodash-es/_arrayPush.js
9920   function arrayPush(array2, values) {
9921     var index = -1, length2 = values.length, offset = array2.length;
9922     while (++index < length2) {
9923       array2[offset + index] = values[index];
9924     }
9925     return array2;
9926   }
9927   var arrayPush_default;
9928   var init_arrayPush = __esm({
9929     "node_modules/lodash-es/_arrayPush.js"() {
9930       arrayPush_default = arrayPush;
9931     }
9932   });
9933
9934   // node_modules/lodash-es/_isFlattenable.js
9935   function isFlattenable(value) {
9936     return isArray_default(value) || isArguments_default(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9937   }
9938   var spreadableSymbol, isFlattenable_default;
9939   var init_isFlattenable = __esm({
9940     "node_modules/lodash-es/_isFlattenable.js"() {
9941       init_Symbol();
9942       init_isArguments();
9943       init_isArray();
9944       spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0;
9945       isFlattenable_default = isFlattenable;
9946     }
9947   });
9948
9949   // node_modules/lodash-es/_baseFlatten.js
9950   function baseFlatten(array2, depth, predicate, isStrict, result) {
9951     var index = -1, length2 = array2.length;
9952     predicate || (predicate = isFlattenable_default);
9953     result || (result = []);
9954     while (++index < length2) {
9955       var value = array2[index];
9956       if (depth > 0 && predicate(value)) {
9957         if (depth > 1) {
9958           baseFlatten(value, depth - 1, predicate, isStrict, result);
9959         } else {
9960           arrayPush_default(result, value);
9961         }
9962       } else if (!isStrict) {
9963         result[result.length] = value;
9964       }
9965     }
9966     return result;
9967   }
9968   var baseFlatten_default;
9969   var init_baseFlatten = __esm({
9970     "node_modules/lodash-es/_baseFlatten.js"() {
9971       init_arrayPush();
9972       init_isFlattenable();
9973       baseFlatten_default = baseFlatten;
9974     }
9975   });
9976
9977   // node_modules/lodash-es/flatten.js
9978   function flatten2(array2) {
9979     var length2 = array2 == null ? 0 : array2.length;
9980     return length2 ? baseFlatten_default(array2, 1) : [];
9981   }
9982   var flatten_default;
9983   var init_flatten = __esm({
9984     "node_modules/lodash-es/flatten.js"() {
9985       init_baseFlatten();
9986       flatten_default = flatten2;
9987     }
9988   });
9989
9990   // node_modules/lodash-es/_flatRest.js
9991   function flatRest(func) {
9992     return setToString_default(overRest_default(func, void 0, flatten_default), func + "");
9993   }
9994   var flatRest_default;
9995   var init_flatRest = __esm({
9996     "node_modules/lodash-es/_flatRest.js"() {
9997       init_flatten();
9998       init_overRest();
9999       init_setToString();
10000       flatRest_default = flatRest;
10001     }
10002   });
10003
10004   // node_modules/lodash-es/_getPrototype.js
10005   var getPrototype, getPrototype_default;
10006   var init_getPrototype = __esm({
10007     "node_modules/lodash-es/_getPrototype.js"() {
10008       init_overArg();
10009       getPrototype = overArg_default(Object.getPrototypeOf, Object);
10010       getPrototype_default = getPrototype;
10011     }
10012   });
10013
10014   // node_modules/lodash-es/isPlainObject.js
10015   function isPlainObject(value) {
10016     if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) {
10017       return false;
10018     }
10019     var proto = getPrototype_default(value);
10020     if (proto === null) {
10021       return true;
10022     }
10023     var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
10024     return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
10025   }
10026   var objectTag2, funcProto3, objectProto12, funcToString3, hasOwnProperty10, objectCtorString, isPlainObject_default;
10027   var init_isPlainObject = __esm({
10028     "node_modules/lodash-es/isPlainObject.js"() {
10029       init_baseGetTag();
10030       init_getPrototype();
10031       init_isObjectLike();
10032       objectTag2 = "[object Object]";
10033       funcProto3 = Function.prototype;
10034       objectProto12 = Object.prototype;
10035       funcToString3 = funcProto3.toString;
10036       hasOwnProperty10 = objectProto12.hasOwnProperty;
10037       objectCtorString = funcToString3.call(Object);
10038       isPlainObject_default = isPlainObject;
10039     }
10040   });
10041
10042   // node_modules/lodash-es/_baseSlice.js
10043   function baseSlice(array2, start2, end) {
10044     var index = -1, length2 = array2.length;
10045     if (start2 < 0) {
10046       start2 = -start2 > length2 ? 0 : length2 + start2;
10047     }
10048     end = end > length2 ? length2 : end;
10049     if (end < 0) {
10050       end += length2;
10051     }
10052     length2 = start2 > end ? 0 : end - start2 >>> 0;
10053     start2 >>>= 0;
10054     var result = Array(length2);
10055     while (++index < length2) {
10056       result[index] = array2[index + start2];
10057     }
10058     return result;
10059   }
10060   var baseSlice_default;
10061   var init_baseSlice = __esm({
10062     "node_modules/lodash-es/_baseSlice.js"() {
10063       baseSlice_default = baseSlice;
10064     }
10065   });
10066
10067   // node_modules/lodash-es/_basePropertyOf.js
10068   function basePropertyOf(object) {
10069     return function(key) {
10070       return object == null ? void 0 : object[key];
10071     };
10072   }
10073   var basePropertyOf_default;
10074   var init_basePropertyOf = __esm({
10075     "node_modules/lodash-es/_basePropertyOf.js"() {
10076       basePropertyOf_default = basePropertyOf;
10077     }
10078   });
10079
10080   // node_modules/lodash-es/_baseClamp.js
10081   function baseClamp(number3, lower2, upper) {
10082     if (number3 === number3) {
10083       if (upper !== void 0) {
10084         number3 = number3 <= upper ? number3 : upper;
10085       }
10086       if (lower2 !== void 0) {
10087         number3 = number3 >= lower2 ? number3 : lower2;
10088       }
10089     }
10090     return number3;
10091   }
10092   var baseClamp_default;
10093   var init_baseClamp = __esm({
10094     "node_modules/lodash-es/_baseClamp.js"() {
10095       baseClamp_default = baseClamp;
10096     }
10097   });
10098
10099   // node_modules/lodash-es/clamp.js
10100   function clamp(number3, lower2, upper) {
10101     if (upper === void 0) {
10102       upper = lower2;
10103       lower2 = void 0;
10104     }
10105     if (upper !== void 0) {
10106       upper = toNumber_default(upper);
10107       upper = upper === upper ? upper : 0;
10108     }
10109     if (lower2 !== void 0) {
10110       lower2 = toNumber_default(lower2);
10111       lower2 = lower2 === lower2 ? lower2 : 0;
10112     }
10113     return baseClamp_default(toNumber_default(number3), lower2, upper);
10114   }
10115   var clamp_default;
10116   var init_clamp = __esm({
10117     "node_modules/lodash-es/clamp.js"() {
10118       init_baseClamp();
10119       init_toNumber();
10120       clamp_default = clamp;
10121     }
10122   });
10123
10124   // node_modules/lodash-es/_stackClear.js
10125   function stackClear() {
10126     this.__data__ = new ListCache_default();
10127     this.size = 0;
10128   }
10129   var stackClear_default;
10130   var init_stackClear = __esm({
10131     "node_modules/lodash-es/_stackClear.js"() {
10132       init_ListCache();
10133       stackClear_default = stackClear;
10134     }
10135   });
10136
10137   // node_modules/lodash-es/_stackDelete.js
10138   function stackDelete(key) {
10139     var data = this.__data__, result = data["delete"](key);
10140     this.size = data.size;
10141     return result;
10142   }
10143   var stackDelete_default;
10144   var init_stackDelete = __esm({
10145     "node_modules/lodash-es/_stackDelete.js"() {
10146       stackDelete_default = stackDelete;
10147     }
10148   });
10149
10150   // node_modules/lodash-es/_stackGet.js
10151   function stackGet(key) {
10152     return this.__data__.get(key);
10153   }
10154   var stackGet_default;
10155   var init_stackGet = __esm({
10156     "node_modules/lodash-es/_stackGet.js"() {
10157       stackGet_default = stackGet;
10158     }
10159   });
10160
10161   // node_modules/lodash-es/_stackHas.js
10162   function stackHas(key) {
10163     return this.__data__.has(key);
10164   }
10165   var stackHas_default;
10166   var init_stackHas = __esm({
10167     "node_modules/lodash-es/_stackHas.js"() {
10168       stackHas_default = stackHas;
10169     }
10170   });
10171
10172   // node_modules/lodash-es/_stackSet.js
10173   function stackSet(key, value) {
10174     var data = this.__data__;
10175     if (data instanceof ListCache_default) {
10176       var pairs2 = data.__data__;
10177       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
10178         pairs2.push([key, value]);
10179         this.size = ++data.size;
10180         return this;
10181       }
10182       data = this.__data__ = new MapCache_default(pairs2);
10183     }
10184     data.set(key, value);
10185     this.size = data.size;
10186     return this;
10187   }
10188   var LARGE_ARRAY_SIZE, stackSet_default;
10189   var init_stackSet = __esm({
10190     "node_modules/lodash-es/_stackSet.js"() {
10191       init_ListCache();
10192       init_Map();
10193       init_MapCache();
10194       LARGE_ARRAY_SIZE = 200;
10195       stackSet_default = stackSet;
10196     }
10197   });
10198
10199   // node_modules/lodash-es/_Stack.js
10200   function Stack(entries) {
10201     var data = this.__data__ = new ListCache_default(entries);
10202     this.size = data.size;
10203   }
10204   var Stack_default;
10205   var init_Stack = __esm({
10206     "node_modules/lodash-es/_Stack.js"() {
10207       init_ListCache();
10208       init_stackClear();
10209       init_stackDelete();
10210       init_stackGet();
10211       init_stackHas();
10212       init_stackSet();
10213       Stack.prototype.clear = stackClear_default;
10214       Stack.prototype["delete"] = stackDelete_default;
10215       Stack.prototype.get = stackGet_default;
10216       Stack.prototype.has = stackHas_default;
10217       Stack.prototype.set = stackSet_default;
10218       Stack_default = Stack;
10219     }
10220   });
10221
10222   // node_modules/lodash-es/_baseAssign.js
10223   function baseAssign(object, source) {
10224     return object && copyObject_default(source, keys_default(source), object);
10225   }
10226   var baseAssign_default;
10227   var init_baseAssign = __esm({
10228     "node_modules/lodash-es/_baseAssign.js"() {
10229       init_copyObject();
10230       init_keys();
10231       baseAssign_default = baseAssign;
10232     }
10233   });
10234
10235   // node_modules/lodash-es/_baseAssignIn.js
10236   function baseAssignIn(object, source) {
10237     return object && copyObject_default(source, keysIn_default(source), object);
10238   }
10239   var baseAssignIn_default;
10240   var init_baseAssignIn = __esm({
10241     "node_modules/lodash-es/_baseAssignIn.js"() {
10242       init_copyObject();
10243       init_keysIn();
10244       baseAssignIn_default = baseAssignIn;
10245     }
10246   });
10247
10248   // node_modules/lodash-es/_cloneBuffer.js
10249   function cloneBuffer(buffer, isDeep) {
10250     if (isDeep) {
10251       return buffer.slice();
10252     }
10253     var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
10254     buffer.copy(result);
10255     return result;
10256   }
10257   var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default;
10258   var init_cloneBuffer = __esm({
10259     "node_modules/lodash-es/_cloneBuffer.js"() {
10260       init_root();
10261       freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
10262       freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
10263       moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
10264       Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
10265       allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
10266       cloneBuffer_default = cloneBuffer;
10267     }
10268   });
10269
10270   // node_modules/lodash-es/_arrayFilter.js
10271   function arrayFilter(array2, predicate) {
10272     var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
10273     while (++index < length2) {
10274       var value = array2[index];
10275       if (predicate(value, index, array2)) {
10276         result[resIndex++] = value;
10277       }
10278     }
10279     return result;
10280   }
10281   var arrayFilter_default;
10282   var init_arrayFilter = __esm({
10283     "node_modules/lodash-es/_arrayFilter.js"() {
10284       arrayFilter_default = arrayFilter;
10285     }
10286   });
10287
10288   // node_modules/lodash-es/stubArray.js
10289   function stubArray() {
10290     return [];
10291   }
10292   var stubArray_default;
10293   var init_stubArray = __esm({
10294     "node_modules/lodash-es/stubArray.js"() {
10295       stubArray_default = stubArray;
10296     }
10297   });
10298
10299   // node_modules/lodash-es/_getSymbols.js
10300   var objectProto13, propertyIsEnumerable2, nativeGetSymbols, getSymbols, getSymbols_default;
10301   var init_getSymbols = __esm({
10302     "node_modules/lodash-es/_getSymbols.js"() {
10303       init_arrayFilter();
10304       init_stubArray();
10305       objectProto13 = Object.prototype;
10306       propertyIsEnumerable2 = objectProto13.propertyIsEnumerable;
10307       nativeGetSymbols = Object.getOwnPropertySymbols;
10308       getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
10309         if (object == null) {
10310           return [];
10311         }
10312         object = Object(object);
10313         return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
10314           return propertyIsEnumerable2.call(object, symbol);
10315         });
10316       };
10317       getSymbols_default = getSymbols;
10318     }
10319   });
10320
10321   // node_modules/lodash-es/_copySymbols.js
10322   function copySymbols(source, object) {
10323     return copyObject_default(source, getSymbols_default(source), object);
10324   }
10325   var copySymbols_default;
10326   var init_copySymbols = __esm({
10327     "node_modules/lodash-es/_copySymbols.js"() {
10328       init_copyObject();
10329       init_getSymbols();
10330       copySymbols_default = copySymbols;
10331     }
10332   });
10333
10334   // node_modules/lodash-es/_getSymbolsIn.js
10335   var nativeGetSymbols2, getSymbolsIn, getSymbolsIn_default;
10336   var init_getSymbolsIn = __esm({
10337     "node_modules/lodash-es/_getSymbolsIn.js"() {
10338       init_arrayPush();
10339       init_getPrototype();
10340       init_getSymbols();
10341       init_stubArray();
10342       nativeGetSymbols2 = Object.getOwnPropertySymbols;
10343       getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) {
10344         var result = [];
10345         while (object) {
10346           arrayPush_default(result, getSymbols_default(object));
10347           object = getPrototype_default(object);
10348         }
10349         return result;
10350       };
10351       getSymbolsIn_default = getSymbolsIn;
10352     }
10353   });
10354
10355   // node_modules/lodash-es/_copySymbolsIn.js
10356   function copySymbolsIn(source, object) {
10357     return copyObject_default(source, getSymbolsIn_default(source), object);
10358   }
10359   var copySymbolsIn_default;
10360   var init_copySymbolsIn = __esm({
10361     "node_modules/lodash-es/_copySymbolsIn.js"() {
10362       init_copyObject();
10363       init_getSymbolsIn();
10364       copySymbolsIn_default = copySymbolsIn;
10365     }
10366   });
10367
10368   // node_modules/lodash-es/_baseGetAllKeys.js
10369   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
10370     var result = keysFunc(object);
10371     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
10372   }
10373   var baseGetAllKeys_default;
10374   var init_baseGetAllKeys = __esm({
10375     "node_modules/lodash-es/_baseGetAllKeys.js"() {
10376       init_arrayPush();
10377       init_isArray();
10378       baseGetAllKeys_default = baseGetAllKeys;
10379     }
10380   });
10381
10382   // node_modules/lodash-es/_getAllKeys.js
10383   function getAllKeys(object) {
10384     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
10385   }
10386   var getAllKeys_default;
10387   var init_getAllKeys = __esm({
10388     "node_modules/lodash-es/_getAllKeys.js"() {
10389       init_baseGetAllKeys();
10390       init_getSymbols();
10391       init_keys();
10392       getAllKeys_default = getAllKeys;
10393     }
10394   });
10395
10396   // node_modules/lodash-es/_getAllKeysIn.js
10397   function getAllKeysIn(object) {
10398     return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default);
10399   }
10400   var getAllKeysIn_default;
10401   var init_getAllKeysIn = __esm({
10402     "node_modules/lodash-es/_getAllKeysIn.js"() {
10403       init_baseGetAllKeys();
10404       init_getSymbolsIn();
10405       init_keysIn();
10406       getAllKeysIn_default = getAllKeysIn;
10407     }
10408   });
10409
10410   // node_modules/lodash-es/_DataView.js
10411   var DataView2, DataView_default;
10412   var init_DataView = __esm({
10413     "node_modules/lodash-es/_DataView.js"() {
10414       init_getNative();
10415       init_root();
10416       DataView2 = getNative_default(root_default, "DataView");
10417       DataView_default = DataView2;
10418     }
10419   });
10420
10421   // node_modules/lodash-es/_Promise.js
10422   var Promise2, Promise_default;
10423   var init_Promise = __esm({
10424     "node_modules/lodash-es/_Promise.js"() {
10425       init_getNative();
10426       init_root();
10427       Promise2 = getNative_default(root_default, "Promise");
10428       Promise_default = Promise2;
10429     }
10430   });
10431
10432   // node_modules/lodash-es/_Set.js
10433   var Set2, Set_default;
10434   var init_Set = __esm({
10435     "node_modules/lodash-es/_Set.js"() {
10436       init_getNative();
10437       init_root();
10438       Set2 = getNative_default(root_default, "Set");
10439       Set_default = Set2;
10440     }
10441   });
10442
10443   // node_modules/lodash-es/_getTag.js
10444   var mapTag2, objectTag3, promiseTag, setTag2, weakMapTag2, dataViewTag2, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag, getTag_default;
10445   var init_getTag = __esm({
10446     "node_modules/lodash-es/_getTag.js"() {
10447       init_DataView();
10448       init_Map();
10449       init_Promise();
10450       init_Set();
10451       init_WeakMap();
10452       init_baseGetTag();
10453       init_toSource();
10454       mapTag2 = "[object Map]";
10455       objectTag3 = "[object Object]";
10456       promiseTag = "[object Promise]";
10457       setTag2 = "[object Set]";
10458       weakMapTag2 = "[object WeakMap]";
10459       dataViewTag2 = "[object DataView]";
10460       dataViewCtorString = toSource_default(DataView_default);
10461       mapCtorString = toSource_default(Map_default);
10462       promiseCtorString = toSource_default(Promise_default);
10463       setCtorString = toSource_default(Set_default);
10464       weakMapCtorString = toSource_default(WeakMap_default);
10465       getTag = baseGetTag_default;
10466       if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
10467         getTag = function(value) {
10468           var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
10469           if (ctorString) {
10470             switch (ctorString) {
10471               case dataViewCtorString:
10472                 return dataViewTag2;
10473               case mapCtorString:
10474                 return mapTag2;
10475               case promiseCtorString:
10476                 return promiseTag;
10477               case setCtorString:
10478                 return setTag2;
10479               case weakMapCtorString:
10480                 return weakMapTag2;
10481             }
10482           }
10483           return result;
10484         };
10485       }
10486       getTag_default = getTag;
10487     }
10488   });
10489
10490   // node_modules/lodash-es/_initCloneArray.js
10491   function initCloneArray(array2) {
10492     var length2 = array2.length, result = new array2.constructor(length2);
10493     if (length2 && typeof array2[0] == "string" && hasOwnProperty11.call(array2, "index")) {
10494       result.index = array2.index;
10495       result.input = array2.input;
10496     }
10497     return result;
10498   }
10499   var objectProto14, hasOwnProperty11, initCloneArray_default;
10500   var init_initCloneArray = __esm({
10501     "node_modules/lodash-es/_initCloneArray.js"() {
10502       objectProto14 = Object.prototype;
10503       hasOwnProperty11 = objectProto14.hasOwnProperty;
10504       initCloneArray_default = initCloneArray;
10505     }
10506   });
10507
10508   // node_modules/lodash-es/_Uint8Array.js
10509   var Uint8Array2, Uint8Array_default;
10510   var init_Uint8Array = __esm({
10511     "node_modules/lodash-es/_Uint8Array.js"() {
10512       init_root();
10513       Uint8Array2 = root_default.Uint8Array;
10514       Uint8Array_default = Uint8Array2;
10515     }
10516   });
10517
10518   // node_modules/lodash-es/_cloneArrayBuffer.js
10519   function cloneArrayBuffer(arrayBuffer) {
10520     var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
10521     new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
10522     return result;
10523   }
10524   var cloneArrayBuffer_default;
10525   var init_cloneArrayBuffer = __esm({
10526     "node_modules/lodash-es/_cloneArrayBuffer.js"() {
10527       init_Uint8Array();
10528       cloneArrayBuffer_default = cloneArrayBuffer;
10529     }
10530   });
10531
10532   // node_modules/lodash-es/_cloneDataView.js
10533   function cloneDataView(dataView, isDeep) {
10534     var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
10535     return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
10536   }
10537   var cloneDataView_default;
10538   var init_cloneDataView = __esm({
10539     "node_modules/lodash-es/_cloneDataView.js"() {
10540       init_cloneArrayBuffer();
10541       cloneDataView_default = cloneDataView;
10542     }
10543   });
10544
10545   // node_modules/lodash-es/_cloneRegExp.js
10546   function cloneRegExp(regexp) {
10547     var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
10548     result.lastIndex = regexp.lastIndex;
10549     return result;
10550   }
10551   var reFlags, cloneRegExp_default;
10552   var init_cloneRegExp = __esm({
10553     "node_modules/lodash-es/_cloneRegExp.js"() {
10554       reFlags = /\w*$/;
10555       cloneRegExp_default = cloneRegExp;
10556     }
10557   });
10558
10559   // node_modules/lodash-es/_cloneSymbol.js
10560   function cloneSymbol(symbol) {
10561     return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
10562   }
10563   var symbolProto2, symbolValueOf, cloneSymbol_default;
10564   var init_cloneSymbol = __esm({
10565     "node_modules/lodash-es/_cloneSymbol.js"() {
10566       init_Symbol();
10567       symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
10568       symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
10569       cloneSymbol_default = cloneSymbol;
10570     }
10571   });
10572
10573   // node_modules/lodash-es/_cloneTypedArray.js
10574   function cloneTypedArray(typedArray, isDeep) {
10575     var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
10576     return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
10577   }
10578   var cloneTypedArray_default;
10579   var init_cloneTypedArray = __esm({
10580     "node_modules/lodash-es/_cloneTypedArray.js"() {
10581       init_cloneArrayBuffer();
10582       cloneTypedArray_default = cloneTypedArray;
10583     }
10584   });
10585
10586   // node_modules/lodash-es/_initCloneByTag.js
10587   function initCloneByTag(object, tag, isDeep) {
10588     var Ctor = object.constructor;
10589     switch (tag) {
10590       case arrayBufferTag2:
10591         return cloneArrayBuffer_default(object);
10592       case boolTag2:
10593       case dateTag2:
10594         return new Ctor(+object);
10595       case dataViewTag3:
10596         return cloneDataView_default(object, isDeep);
10597       case float32Tag2:
10598       case float64Tag2:
10599       case int8Tag2:
10600       case int16Tag2:
10601       case int32Tag2:
10602       case uint8Tag2:
10603       case uint8ClampedTag2:
10604       case uint16Tag2:
10605       case uint32Tag2:
10606         return cloneTypedArray_default(object, isDeep);
10607       case mapTag3:
10608         return new Ctor();
10609       case numberTag2:
10610       case stringTag2:
10611         return new Ctor(object);
10612       case regexpTag2:
10613         return cloneRegExp_default(object);
10614       case setTag3:
10615         return new Ctor();
10616       case symbolTag2:
10617         return cloneSymbol_default(object);
10618     }
10619   }
10620   var boolTag2, dateTag2, mapTag3, numberTag2, regexpTag2, setTag3, stringTag2, symbolTag2, arrayBufferTag2, dataViewTag3, float32Tag2, float64Tag2, int8Tag2, int16Tag2, int32Tag2, uint8Tag2, uint8ClampedTag2, uint16Tag2, uint32Tag2, initCloneByTag_default;
10621   var init_initCloneByTag = __esm({
10622     "node_modules/lodash-es/_initCloneByTag.js"() {
10623       init_cloneArrayBuffer();
10624       init_cloneDataView();
10625       init_cloneRegExp();
10626       init_cloneSymbol();
10627       init_cloneTypedArray();
10628       boolTag2 = "[object Boolean]";
10629       dateTag2 = "[object Date]";
10630       mapTag3 = "[object Map]";
10631       numberTag2 = "[object Number]";
10632       regexpTag2 = "[object RegExp]";
10633       setTag3 = "[object Set]";
10634       stringTag2 = "[object String]";
10635       symbolTag2 = "[object Symbol]";
10636       arrayBufferTag2 = "[object ArrayBuffer]";
10637       dataViewTag3 = "[object DataView]";
10638       float32Tag2 = "[object Float32Array]";
10639       float64Tag2 = "[object Float64Array]";
10640       int8Tag2 = "[object Int8Array]";
10641       int16Tag2 = "[object Int16Array]";
10642       int32Tag2 = "[object Int32Array]";
10643       uint8Tag2 = "[object Uint8Array]";
10644       uint8ClampedTag2 = "[object Uint8ClampedArray]";
10645       uint16Tag2 = "[object Uint16Array]";
10646       uint32Tag2 = "[object Uint32Array]";
10647       initCloneByTag_default = initCloneByTag;
10648     }
10649   });
10650
10651   // node_modules/lodash-es/_initCloneObject.js
10652   function initCloneObject(object) {
10653     return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
10654   }
10655   var initCloneObject_default;
10656   var init_initCloneObject = __esm({
10657     "node_modules/lodash-es/_initCloneObject.js"() {
10658       init_baseCreate();
10659       init_getPrototype();
10660       init_isPrototype();
10661       initCloneObject_default = initCloneObject;
10662     }
10663   });
10664
10665   // node_modules/lodash-es/_baseIsMap.js
10666   function baseIsMap(value) {
10667     return isObjectLike_default(value) && getTag_default(value) == mapTag4;
10668   }
10669   var mapTag4, baseIsMap_default;
10670   var init_baseIsMap = __esm({
10671     "node_modules/lodash-es/_baseIsMap.js"() {
10672       init_getTag();
10673       init_isObjectLike();
10674       mapTag4 = "[object Map]";
10675       baseIsMap_default = baseIsMap;
10676     }
10677   });
10678
10679   // node_modules/lodash-es/isMap.js
10680   var nodeIsMap, isMap, isMap_default;
10681   var init_isMap = __esm({
10682     "node_modules/lodash-es/isMap.js"() {
10683       init_baseIsMap();
10684       init_baseUnary();
10685       init_nodeUtil();
10686       nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
10687       isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
10688       isMap_default = isMap;
10689     }
10690   });
10691
10692   // node_modules/lodash-es/_baseIsSet.js
10693   function baseIsSet(value) {
10694     return isObjectLike_default(value) && getTag_default(value) == setTag4;
10695   }
10696   var setTag4, baseIsSet_default;
10697   var init_baseIsSet = __esm({
10698     "node_modules/lodash-es/_baseIsSet.js"() {
10699       init_getTag();
10700       init_isObjectLike();
10701       setTag4 = "[object Set]";
10702       baseIsSet_default = baseIsSet;
10703     }
10704   });
10705
10706   // node_modules/lodash-es/isSet.js
10707   var nodeIsSet, isSet, isSet_default;
10708   var init_isSet = __esm({
10709     "node_modules/lodash-es/isSet.js"() {
10710       init_baseIsSet();
10711       init_baseUnary();
10712       init_nodeUtil();
10713       nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
10714       isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
10715       isSet_default = isSet;
10716     }
10717   });
10718
10719   // node_modules/lodash-es/_baseClone.js
10720   function baseClone(value, bitmask, customizer, key, object, stack) {
10721     var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
10722     if (customizer) {
10723       result = object ? customizer(value, key, object, stack) : customizer(value);
10724     }
10725     if (result !== void 0) {
10726       return result;
10727     }
10728     if (!isObject_default(value)) {
10729       return value;
10730     }
10731     var isArr = isArray_default(value);
10732     if (isArr) {
10733       result = initCloneArray_default(value);
10734       if (!isDeep) {
10735         return copyArray_default(value, result);
10736       }
10737     } else {
10738       var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2;
10739       if (isBuffer_default(value)) {
10740         return cloneBuffer_default(value, isDeep);
10741       }
10742       if (tag == objectTag4 || tag == argsTag3 || isFunc && !object) {
10743         result = isFlat || isFunc ? {} : initCloneObject_default(value);
10744         if (!isDeep) {
10745           return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value));
10746         }
10747       } else {
10748         if (!cloneableTags[tag]) {
10749           return object ? value : {};
10750         }
10751         result = initCloneByTag_default(value, tag, isDeep);
10752       }
10753     }
10754     stack || (stack = new Stack_default());
10755     var stacked = stack.get(value);
10756     if (stacked) {
10757       return stacked;
10758     }
10759     stack.set(value, result);
10760     if (isSet_default(value)) {
10761       value.forEach(function(subValue) {
10762         result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
10763       });
10764     } else if (isMap_default(value)) {
10765       value.forEach(function(subValue, key2) {
10766         result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
10767       });
10768     }
10769     var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
10770     var props = isArr ? void 0 : keysFunc(value);
10771     arrayEach_default(props || value, function(subValue, key2) {
10772       if (props) {
10773         key2 = subValue;
10774         subValue = value[key2];
10775       }
10776       assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
10777     });
10778     return result;
10779   }
10780   var CLONE_DEEP_FLAG, CLONE_FLAT_FLAG, CLONE_SYMBOLS_FLAG, argsTag3, arrayTag2, boolTag3, dateTag3, errorTag2, funcTag3, genTag2, mapTag5, numberTag3, objectTag4, regexpTag3, setTag5, stringTag3, symbolTag3, weakMapTag3, arrayBufferTag3, dataViewTag4, float32Tag3, float64Tag3, int8Tag3, int16Tag3, int32Tag3, uint8Tag3, uint8ClampedTag3, uint16Tag3, uint32Tag3, cloneableTags, baseClone_default;
10781   var init_baseClone = __esm({
10782     "node_modules/lodash-es/_baseClone.js"() {
10783       init_Stack();
10784       init_arrayEach();
10785       init_assignValue();
10786       init_baseAssign();
10787       init_baseAssignIn();
10788       init_cloneBuffer();
10789       init_copyArray();
10790       init_copySymbols();
10791       init_copySymbolsIn();
10792       init_getAllKeys();
10793       init_getAllKeysIn();
10794       init_getTag();
10795       init_initCloneArray();
10796       init_initCloneByTag();
10797       init_initCloneObject();
10798       init_isArray();
10799       init_isBuffer();
10800       init_isMap();
10801       init_isObject();
10802       init_isSet();
10803       init_keys();
10804       init_keysIn();
10805       CLONE_DEEP_FLAG = 1;
10806       CLONE_FLAT_FLAG = 2;
10807       CLONE_SYMBOLS_FLAG = 4;
10808       argsTag3 = "[object Arguments]";
10809       arrayTag2 = "[object Array]";
10810       boolTag3 = "[object Boolean]";
10811       dateTag3 = "[object Date]";
10812       errorTag2 = "[object Error]";
10813       funcTag3 = "[object Function]";
10814       genTag2 = "[object GeneratorFunction]";
10815       mapTag5 = "[object Map]";
10816       numberTag3 = "[object Number]";
10817       objectTag4 = "[object Object]";
10818       regexpTag3 = "[object RegExp]";
10819       setTag5 = "[object Set]";
10820       stringTag3 = "[object String]";
10821       symbolTag3 = "[object Symbol]";
10822       weakMapTag3 = "[object WeakMap]";
10823       arrayBufferTag3 = "[object ArrayBuffer]";
10824       dataViewTag4 = "[object DataView]";
10825       float32Tag3 = "[object Float32Array]";
10826       float64Tag3 = "[object Float64Array]";
10827       int8Tag3 = "[object Int8Array]";
10828       int16Tag3 = "[object Int16Array]";
10829       int32Tag3 = "[object Int32Array]";
10830       uint8Tag3 = "[object Uint8Array]";
10831       uint8ClampedTag3 = "[object Uint8ClampedArray]";
10832       uint16Tag3 = "[object Uint16Array]";
10833       uint32Tag3 = "[object Uint32Array]";
10834       cloneableTags = {};
10835       cloneableTags[argsTag3] = cloneableTags[arrayTag2] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag5] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag5] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
10836       cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
10837       baseClone_default = baseClone;
10838     }
10839   });
10840
10841   // node_modules/lodash-es/_setCacheAdd.js
10842   function setCacheAdd(value) {
10843     this.__data__.set(value, HASH_UNDEFINED3);
10844     return this;
10845   }
10846   var HASH_UNDEFINED3, setCacheAdd_default;
10847   var init_setCacheAdd = __esm({
10848     "node_modules/lodash-es/_setCacheAdd.js"() {
10849       HASH_UNDEFINED3 = "__lodash_hash_undefined__";
10850       setCacheAdd_default = setCacheAdd;
10851     }
10852   });
10853
10854   // node_modules/lodash-es/_setCacheHas.js
10855   function setCacheHas(value) {
10856     return this.__data__.has(value);
10857   }
10858   var setCacheHas_default;
10859   var init_setCacheHas = __esm({
10860     "node_modules/lodash-es/_setCacheHas.js"() {
10861       setCacheHas_default = setCacheHas;
10862     }
10863   });
10864
10865   // node_modules/lodash-es/_SetCache.js
10866   function SetCache(values) {
10867     var index = -1, length2 = values == null ? 0 : values.length;
10868     this.__data__ = new MapCache_default();
10869     while (++index < length2) {
10870       this.add(values[index]);
10871     }
10872   }
10873   var SetCache_default;
10874   var init_SetCache = __esm({
10875     "node_modules/lodash-es/_SetCache.js"() {
10876       init_MapCache();
10877       init_setCacheAdd();
10878       init_setCacheHas();
10879       SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
10880       SetCache.prototype.has = setCacheHas_default;
10881       SetCache_default = SetCache;
10882     }
10883   });
10884
10885   // node_modules/lodash-es/_arraySome.js
10886   function arraySome(array2, predicate) {
10887     var index = -1, length2 = array2 == null ? 0 : array2.length;
10888     while (++index < length2) {
10889       if (predicate(array2[index], index, array2)) {
10890         return true;
10891       }
10892     }
10893     return false;
10894   }
10895   var arraySome_default;
10896   var init_arraySome = __esm({
10897     "node_modules/lodash-es/_arraySome.js"() {
10898       arraySome_default = arraySome;
10899     }
10900   });
10901
10902   // node_modules/lodash-es/_cacheHas.js
10903   function cacheHas(cache, key) {
10904     return cache.has(key);
10905   }
10906   var cacheHas_default;
10907   var init_cacheHas = __esm({
10908     "node_modules/lodash-es/_cacheHas.js"() {
10909       cacheHas_default = cacheHas;
10910     }
10911   });
10912
10913   // node_modules/lodash-es/_equalArrays.js
10914   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
10915     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
10916     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
10917       return false;
10918     }
10919     var arrStacked = stack.get(array2);
10920     var othStacked = stack.get(other);
10921     if (arrStacked && othStacked) {
10922       return arrStacked == other && othStacked == array2;
10923     }
10924     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
10925     stack.set(array2, other);
10926     stack.set(other, array2);
10927     while (++index < arrLength) {
10928       var arrValue = array2[index], othValue = other[index];
10929       if (customizer) {
10930         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
10931       }
10932       if (compared !== void 0) {
10933         if (compared) {
10934           continue;
10935         }
10936         result = false;
10937         break;
10938       }
10939       if (seen) {
10940         if (!arraySome_default(other, function(othValue2, othIndex) {
10941           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
10942             return seen.push(othIndex);
10943           }
10944         })) {
10945           result = false;
10946           break;
10947         }
10948       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
10949         result = false;
10950         break;
10951       }
10952     }
10953     stack["delete"](array2);
10954     stack["delete"](other);
10955     return result;
10956   }
10957   var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default;
10958   var init_equalArrays = __esm({
10959     "node_modules/lodash-es/_equalArrays.js"() {
10960       init_SetCache();
10961       init_arraySome();
10962       init_cacheHas();
10963       COMPARE_PARTIAL_FLAG = 1;
10964       COMPARE_UNORDERED_FLAG = 2;
10965       equalArrays_default = equalArrays;
10966     }
10967   });
10968
10969   // node_modules/lodash-es/_mapToArray.js
10970   function mapToArray(map2) {
10971     var index = -1, result = Array(map2.size);
10972     map2.forEach(function(value, key) {
10973       result[++index] = [key, value];
10974     });
10975     return result;
10976   }
10977   var mapToArray_default;
10978   var init_mapToArray = __esm({
10979     "node_modules/lodash-es/_mapToArray.js"() {
10980       mapToArray_default = mapToArray;
10981     }
10982   });
10983
10984   // node_modules/lodash-es/_setToArray.js
10985   function setToArray(set4) {
10986     var index = -1, result = Array(set4.size);
10987     set4.forEach(function(value) {
10988       result[++index] = value;
10989     });
10990     return result;
10991   }
10992   var setToArray_default;
10993   var init_setToArray = __esm({
10994     "node_modules/lodash-es/_setToArray.js"() {
10995       setToArray_default = setToArray;
10996     }
10997   });
10998
10999   // node_modules/lodash-es/_equalByTag.js
11000   function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
11001     switch (tag) {
11002       case dataViewTag5:
11003         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
11004           return false;
11005         }
11006         object = object.buffer;
11007         other = other.buffer;
11008       case arrayBufferTag4:
11009         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
11010           return false;
11011         }
11012         return true;
11013       case boolTag4:
11014       case dateTag4:
11015       case numberTag4:
11016         return eq_default(+object, +other);
11017       case errorTag3:
11018         return object.name == other.name && object.message == other.message;
11019       case regexpTag4:
11020       case stringTag4:
11021         return object == other + "";
11022       case mapTag6:
11023         var convert = mapToArray_default;
11024       case setTag6:
11025         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
11026         convert || (convert = setToArray_default);
11027         if (object.size != other.size && !isPartial) {
11028           return false;
11029         }
11030         var stacked = stack.get(object);
11031         if (stacked) {
11032           return stacked == other;
11033         }
11034         bitmask |= COMPARE_UNORDERED_FLAG2;
11035         stack.set(object, other);
11036         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
11037         stack["delete"](object);
11038         return result;
11039       case symbolTag4:
11040         if (symbolValueOf2) {
11041           return symbolValueOf2.call(object) == symbolValueOf2.call(other);
11042         }
11043     }
11044     return false;
11045   }
11046   var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag4, dateTag4, errorTag3, mapTag6, numberTag4, regexpTag4, setTag6, stringTag4, symbolTag4, arrayBufferTag4, dataViewTag5, symbolProto3, symbolValueOf2, equalByTag_default;
11047   var init_equalByTag = __esm({
11048     "node_modules/lodash-es/_equalByTag.js"() {
11049       init_Symbol();
11050       init_Uint8Array();
11051       init_eq();
11052       init_equalArrays();
11053       init_mapToArray();
11054       init_setToArray();
11055       COMPARE_PARTIAL_FLAG2 = 1;
11056       COMPARE_UNORDERED_FLAG2 = 2;
11057       boolTag4 = "[object Boolean]";
11058       dateTag4 = "[object Date]";
11059       errorTag3 = "[object Error]";
11060       mapTag6 = "[object Map]";
11061       numberTag4 = "[object Number]";
11062       regexpTag4 = "[object RegExp]";
11063       setTag6 = "[object Set]";
11064       stringTag4 = "[object String]";
11065       symbolTag4 = "[object Symbol]";
11066       arrayBufferTag4 = "[object ArrayBuffer]";
11067       dataViewTag5 = "[object DataView]";
11068       symbolProto3 = Symbol_default ? Symbol_default.prototype : void 0;
11069       symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : void 0;
11070       equalByTag_default = equalByTag;
11071     }
11072   });
11073
11074   // node_modules/lodash-es/_equalObjects.js
11075   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
11076     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
11077     if (objLength != othLength && !isPartial) {
11078       return false;
11079     }
11080     var index = objLength;
11081     while (index--) {
11082       var key = objProps[index];
11083       if (!(isPartial ? key in other : hasOwnProperty12.call(other, key))) {
11084         return false;
11085       }
11086     }
11087     var objStacked = stack.get(object);
11088     var othStacked = stack.get(other);
11089     if (objStacked && othStacked) {
11090       return objStacked == other && othStacked == object;
11091     }
11092     var result = true;
11093     stack.set(object, other);
11094     stack.set(other, object);
11095     var skipCtor = isPartial;
11096     while (++index < objLength) {
11097       key = objProps[index];
11098       var objValue = object[key], othValue = other[key];
11099       if (customizer) {
11100         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
11101       }
11102       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
11103         result = false;
11104         break;
11105       }
11106       skipCtor || (skipCtor = key == "constructor");
11107     }
11108     if (result && !skipCtor) {
11109       var objCtor = object.constructor, othCtor = other.constructor;
11110       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
11111         result = false;
11112       }
11113     }
11114     stack["delete"](object);
11115     stack["delete"](other);
11116     return result;
11117   }
11118   var COMPARE_PARTIAL_FLAG3, objectProto15, hasOwnProperty12, equalObjects_default;
11119   var init_equalObjects = __esm({
11120     "node_modules/lodash-es/_equalObjects.js"() {
11121       init_getAllKeys();
11122       COMPARE_PARTIAL_FLAG3 = 1;
11123       objectProto15 = Object.prototype;
11124       hasOwnProperty12 = objectProto15.hasOwnProperty;
11125       equalObjects_default = equalObjects;
11126     }
11127   });
11128
11129   // node_modules/lodash-es/_baseIsEqualDeep.js
11130   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
11131     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag3 : getTag_default(object), othTag = othIsArr ? arrayTag3 : getTag_default(other);
11132     objTag = objTag == argsTag4 ? objectTag5 : objTag;
11133     othTag = othTag == argsTag4 ? objectTag5 : othTag;
11134     var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
11135     if (isSameTag && isBuffer_default(object)) {
11136       if (!isBuffer_default(other)) {
11137         return false;
11138       }
11139       objIsArr = true;
11140       objIsObj = false;
11141     }
11142     if (isSameTag && !objIsObj) {
11143       stack || (stack = new Stack_default());
11144       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
11145     }
11146     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
11147       var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other, "__wrapped__");
11148       if (objIsWrapped || othIsWrapped) {
11149         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
11150         stack || (stack = new Stack_default());
11151         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
11152       }
11153     }
11154     if (!isSameTag) {
11155       return false;
11156     }
11157     stack || (stack = new Stack_default());
11158     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
11159   }
11160   var COMPARE_PARTIAL_FLAG4, argsTag4, arrayTag3, objectTag5, objectProto16, hasOwnProperty13, baseIsEqualDeep_default;
11161   var init_baseIsEqualDeep = __esm({
11162     "node_modules/lodash-es/_baseIsEqualDeep.js"() {
11163       init_Stack();
11164       init_equalArrays();
11165       init_equalByTag();
11166       init_equalObjects();
11167       init_getTag();
11168       init_isArray();
11169       init_isBuffer();
11170       init_isTypedArray();
11171       COMPARE_PARTIAL_FLAG4 = 1;
11172       argsTag4 = "[object Arguments]";
11173       arrayTag3 = "[object Array]";
11174       objectTag5 = "[object Object]";
11175       objectProto16 = Object.prototype;
11176       hasOwnProperty13 = objectProto16.hasOwnProperty;
11177       baseIsEqualDeep_default = baseIsEqualDeep;
11178     }
11179   });
11180
11181   // node_modules/lodash-es/_baseIsEqual.js
11182   function baseIsEqual(value, other, bitmask, customizer, stack) {
11183     if (value === other) {
11184       return true;
11185     }
11186     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
11187       return value !== value && other !== other;
11188     }
11189     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
11190   }
11191   var baseIsEqual_default;
11192   var init_baseIsEqual = __esm({
11193     "node_modules/lodash-es/_baseIsEqual.js"() {
11194       init_baseIsEqualDeep();
11195       init_isObjectLike();
11196       baseIsEqual_default = baseIsEqual;
11197     }
11198   });
11199
11200   // node_modules/lodash-es/_createBaseFor.js
11201   function createBaseFor(fromRight) {
11202     return function(object, iteratee, keysFunc) {
11203       var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
11204       while (length2--) {
11205         var key = props[fromRight ? length2 : ++index];
11206         if (iteratee(iterable[key], key, iterable) === false) {
11207           break;
11208         }
11209       }
11210       return object;
11211     };
11212   }
11213   var createBaseFor_default;
11214   var init_createBaseFor = __esm({
11215     "node_modules/lodash-es/_createBaseFor.js"() {
11216       createBaseFor_default = createBaseFor;
11217     }
11218   });
11219
11220   // node_modules/lodash-es/_baseFor.js
11221   var baseFor, baseFor_default;
11222   var init_baseFor = __esm({
11223     "node_modules/lodash-es/_baseFor.js"() {
11224       init_createBaseFor();
11225       baseFor = createBaseFor_default();
11226       baseFor_default = baseFor;
11227     }
11228   });
11229
11230   // node_modules/lodash-es/now.js
11231   var now2, now_default;
11232   var init_now = __esm({
11233     "node_modules/lodash-es/now.js"() {
11234       init_root();
11235       now2 = function() {
11236         return root_default.Date.now();
11237       };
11238       now_default = now2;
11239     }
11240   });
11241
11242   // node_modules/lodash-es/debounce.js
11243   function debounce(func, wait, options) {
11244     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11245     if (typeof func != "function") {
11246       throw new TypeError(FUNC_ERROR_TEXT2);
11247     }
11248     wait = toNumber_default(wait) || 0;
11249     if (isObject_default(options)) {
11250       leading = !!options.leading;
11251       maxing = "maxWait" in options;
11252       maxWait = maxing ? nativeMax2(toNumber_default(options.maxWait) || 0, wait) : maxWait;
11253       trailing = "trailing" in options ? !!options.trailing : trailing;
11254     }
11255     function invokeFunc(time) {
11256       var args = lastArgs, thisArg = lastThis;
11257       lastArgs = lastThis = void 0;
11258       lastInvokeTime = time;
11259       result = func.apply(thisArg, args);
11260       return result;
11261     }
11262     function leadingEdge(time) {
11263       lastInvokeTime = time;
11264       timerId = setTimeout(timerExpired, wait);
11265       return leading ? invokeFunc(time) : result;
11266     }
11267     function remainingWait(time) {
11268       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
11269       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
11270     }
11271     function shouldInvoke(time) {
11272       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
11273       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
11274     }
11275     function timerExpired() {
11276       var time = now_default();
11277       if (shouldInvoke(time)) {
11278         return trailingEdge(time);
11279       }
11280       timerId = setTimeout(timerExpired, remainingWait(time));
11281     }
11282     function trailingEdge(time) {
11283       timerId = void 0;
11284       if (trailing && lastArgs) {
11285         return invokeFunc(time);
11286       }
11287       lastArgs = lastThis = void 0;
11288       return result;
11289     }
11290     function cancel() {
11291       if (timerId !== void 0) {
11292         clearTimeout(timerId);
11293       }
11294       lastInvokeTime = 0;
11295       lastArgs = lastCallTime = lastThis = timerId = void 0;
11296     }
11297     function flush() {
11298       return timerId === void 0 ? result : trailingEdge(now_default());
11299     }
11300     function debounced() {
11301       var time = now_default(), isInvoking = shouldInvoke(time);
11302       lastArgs = arguments;
11303       lastThis = this;
11304       lastCallTime = time;
11305       if (isInvoking) {
11306         if (timerId === void 0) {
11307           return leadingEdge(lastCallTime);
11308         }
11309         if (maxing) {
11310           clearTimeout(timerId);
11311           timerId = setTimeout(timerExpired, wait);
11312           return invokeFunc(lastCallTime);
11313         }
11314       }
11315       if (timerId === void 0) {
11316         timerId = setTimeout(timerExpired, wait);
11317       }
11318       return result;
11319     }
11320     debounced.cancel = cancel;
11321     debounced.flush = flush;
11322     return debounced;
11323   }
11324   var FUNC_ERROR_TEXT2, nativeMax2, nativeMin, debounce_default;
11325   var init_debounce = __esm({
11326     "node_modules/lodash-es/debounce.js"() {
11327       init_isObject();
11328       init_now();
11329       init_toNumber();
11330       FUNC_ERROR_TEXT2 = "Expected a function";
11331       nativeMax2 = Math.max;
11332       nativeMin = Math.min;
11333       debounce_default = debounce;
11334     }
11335   });
11336
11337   // node_modules/lodash-es/_assignMergeValue.js
11338   function assignMergeValue(object, key, value) {
11339     if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
11340       baseAssignValue_default(object, key, value);
11341     }
11342   }
11343   var assignMergeValue_default;
11344   var init_assignMergeValue = __esm({
11345     "node_modules/lodash-es/_assignMergeValue.js"() {
11346       init_baseAssignValue();
11347       init_eq();
11348       assignMergeValue_default = assignMergeValue;
11349     }
11350   });
11351
11352   // node_modules/lodash-es/isArrayLikeObject.js
11353   function isArrayLikeObject(value) {
11354     return isObjectLike_default(value) && isArrayLike_default(value);
11355   }
11356   var isArrayLikeObject_default;
11357   var init_isArrayLikeObject = __esm({
11358     "node_modules/lodash-es/isArrayLikeObject.js"() {
11359       init_isArrayLike();
11360       init_isObjectLike();
11361       isArrayLikeObject_default = isArrayLikeObject;
11362     }
11363   });
11364
11365   // node_modules/lodash-es/_safeGet.js
11366   function safeGet(object, key) {
11367     if (key === "constructor" && typeof object[key] === "function") {
11368       return;
11369     }
11370     if (key == "__proto__") {
11371       return;
11372     }
11373     return object[key];
11374   }
11375   var safeGet_default;
11376   var init_safeGet = __esm({
11377     "node_modules/lodash-es/_safeGet.js"() {
11378       safeGet_default = safeGet;
11379     }
11380   });
11381
11382   // node_modules/lodash-es/toPlainObject.js
11383   function toPlainObject(value) {
11384     return copyObject_default(value, keysIn_default(value));
11385   }
11386   var toPlainObject_default;
11387   var init_toPlainObject = __esm({
11388     "node_modules/lodash-es/toPlainObject.js"() {
11389       init_copyObject();
11390       init_keysIn();
11391       toPlainObject_default = toPlainObject;
11392     }
11393   });
11394
11395   // node_modules/lodash-es/_baseMergeDeep.js
11396   function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
11397     var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
11398     if (stacked) {
11399       assignMergeValue_default(object, key, stacked);
11400       return;
11401     }
11402     var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
11403     var isCommon = newValue === void 0;
11404     if (isCommon) {
11405       var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
11406       newValue = srcValue;
11407       if (isArr || isBuff || isTyped) {
11408         if (isArray_default(objValue)) {
11409           newValue = objValue;
11410         } else if (isArrayLikeObject_default(objValue)) {
11411           newValue = copyArray_default(objValue);
11412         } else if (isBuff) {
11413           isCommon = false;
11414           newValue = cloneBuffer_default(srcValue, true);
11415         } else if (isTyped) {
11416           isCommon = false;
11417           newValue = cloneTypedArray_default(srcValue, true);
11418         } else {
11419           newValue = [];
11420         }
11421       } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
11422         newValue = objValue;
11423         if (isArguments_default(objValue)) {
11424           newValue = toPlainObject_default(objValue);
11425         } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
11426           newValue = initCloneObject_default(srcValue);
11427         }
11428       } else {
11429         isCommon = false;
11430       }
11431     }
11432     if (isCommon) {
11433       stack.set(srcValue, newValue);
11434       mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
11435       stack["delete"](srcValue);
11436     }
11437     assignMergeValue_default(object, key, newValue);
11438   }
11439   var baseMergeDeep_default;
11440   var init_baseMergeDeep = __esm({
11441     "node_modules/lodash-es/_baseMergeDeep.js"() {
11442       init_assignMergeValue();
11443       init_cloneBuffer();
11444       init_cloneTypedArray();
11445       init_copyArray();
11446       init_initCloneObject();
11447       init_isArguments();
11448       init_isArray();
11449       init_isArrayLikeObject();
11450       init_isBuffer();
11451       init_isFunction();
11452       init_isObject();
11453       init_isPlainObject();
11454       init_isTypedArray();
11455       init_safeGet();
11456       init_toPlainObject();
11457       baseMergeDeep_default = baseMergeDeep;
11458     }
11459   });
11460
11461   // node_modules/lodash-es/_baseMerge.js
11462   function baseMerge(object, source, srcIndex, customizer, stack) {
11463     if (object === source) {
11464       return;
11465     }
11466     baseFor_default(source, function(srcValue, key) {
11467       stack || (stack = new Stack_default());
11468       if (isObject_default(srcValue)) {
11469         baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
11470       } else {
11471         var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
11472         if (newValue === void 0) {
11473           newValue = srcValue;
11474         }
11475         assignMergeValue_default(object, key, newValue);
11476       }
11477     }, keysIn_default);
11478   }
11479   var baseMerge_default;
11480   var init_baseMerge = __esm({
11481     "node_modules/lodash-es/_baseMerge.js"() {
11482       init_Stack();
11483       init_assignMergeValue();
11484       init_baseFor();
11485       init_baseMergeDeep();
11486       init_isObject();
11487       init_keysIn();
11488       init_safeGet();
11489       baseMerge_default = baseMerge;
11490     }
11491   });
11492
11493   // node_modules/lodash-es/last.js
11494   function last(array2) {
11495     var length2 = array2 == null ? 0 : array2.length;
11496     return length2 ? array2[length2 - 1] : void 0;
11497   }
11498   var last_default;
11499   var init_last = __esm({
11500     "node_modules/lodash-es/last.js"() {
11501       last_default = last;
11502     }
11503   });
11504
11505   // node_modules/lodash-es/_escapeHtmlChar.js
11506   var htmlEscapes, escapeHtmlChar, escapeHtmlChar_default;
11507   var init_escapeHtmlChar = __esm({
11508     "node_modules/lodash-es/_escapeHtmlChar.js"() {
11509       init_basePropertyOf();
11510       htmlEscapes = {
11511         "&": "&amp;",
11512         "<": "&lt;",
11513         ">": "&gt;",
11514         '"': "&quot;",
11515         "'": "&#39;"
11516       };
11517       escapeHtmlChar = basePropertyOf_default(htmlEscapes);
11518       escapeHtmlChar_default = escapeHtmlChar;
11519     }
11520   });
11521
11522   // node_modules/lodash-es/escape.js
11523   function escape2(string) {
11524     string = toString_default(string);
11525     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
11526   }
11527   var reUnescapedHtml, reHasUnescapedHtml, escape_default;
11528   var init_escape = __esm({
11529     "node_modules/lodash-es/escape.js"() {
11530       init_escapeHtmlChar();
11531       init_toString();
11532       reUnescapedHtml = /[&<>"']/g;
11533       reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
11534       escape_default = escape2;
11535     }
11536   });
11537
11538   // node_modules/lodash-es/_parent.js
11539   function parent(object, path) {
11540     return path.length < 2 ? object : baseGet_default(object, baseSlice_default(path, 0, -1));
11541   }
11542   var parent_default;
11543   var init_parent = __esm({
11544     "node_modules/lodash-es/_parent.js"() {
11545       init_baseGet();
11546       init_baseSlice();
11547       parent_default = parent;
11548     }
11549   });
11550
11551   // node_modules/lodash-es/isEmpty.js
11552   function isEmpty(value) {
11553     if (value == null) {
11554       return true;
11555     }
11556     if (isArrayLike_default(value) && (isArray_default(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer_default(value) || isTypedArray_default(value) || isArguments_default(value))) {
11557       return !value.length;
11558     }
11559     var tag = getTag_default(value);
11560     if (tag == mapTag7 || tag == setTag7) {
11561       return !value.size;
11562     }
11563     if (isPrototype_default(value)) {
11564       return !baseKeys_default(value).length;
11565     }
11566     for (var key in value) {
11567       if (hasOwnProperty14.call(value, key)) {
11568         return false;
11569       }
11570     }
11571     return true;
11572   }
11573   var mapTag7, setTag7, objectProto17, hasOwnProperty14, isEmpty_default;
11574   var init_isEmpty = __esm({
11575     "node_modules/lodash-es/isEmpty.js"() {
11576       init_baseKeys();
11577       init_getTag();
11578       init_isArguments();
11579       init_isArray();
11580       init_isArrayLike();
11581       init_isBuffer();
11582       init_isPrototype();
11583       init_isTypedArray();
11584       mapTag7 = "[object Map]";
11585       setTag7 = "[object Set]";
11586       objectProto17 = Object.prototype;
11587       hasOwnProperty14 = objectProto17.hasOwnProperty;
11588       isEmpty_default = isEmpty;
11589     }
11590   });
11591
11592   // node_modules/lodash-es/isEqual.js
11593   function isEqual(value, other) {
11594     return baseIsEqual_default(value, other);
11595   }
11596   var isEqual_default;
11597   var init_isEqual = __esm({
11598     "node_modules/lodash-es/isEqual.js"() {
11599       init_baseIsEqual();
11600       isEqual_default = isEqual;
11601     }
11602   });
11603
11604   // node_modules/lodash-es/isNumber.js
11605   function isNumber(value) {
11606     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag5;
11607   }
11608   var numberTag5, isNumber_default;
11609   var init_isNumber = __esm({
11610     "node_modules/lodash-es/isNumber.js"() {
11611       init_baseGetTag();
11612       init_isObjectLike();
11613       numberTag5 = "[object Number]";
11614       isNumber_default = isNumber;
11615     }
11616   });
11617
11618   // node_modules/lodash-es/merge.js
11619   var merge2, merge_default3;
11620   var init_merge4 = __esm({
11621     "node_modules/lodash-es/merge.js"() {
11622       init_baseMerge();
11623       init_createAssigner();
11624       merge2 = createAssigner_default(function(object, source, srcIndex) {
11625         baseMerge_default(object, source, srcIndex);
11626       });
11627       merge_default3 = merge2;
11628     }
11629   });
11630
11631   // node_modules/lodash-es/_baseUnset.js
11632   function baseUnset(object, path) {
11633     path = castPath_default(path, object);
11634     object = parent_default(object, path);
11635     return object == null || delete object[toKey_default(last_default(path))];
11636   }
11637   var baseUnset_default;
11638   var init_baseUnset = __esm({
11639     "node_modules/lodash-es/_baseUnset.js"() {
11640       init_castPath();
11641       init_last();
11642       init_parent();
11643       init_toKey();
11644       baseUnset_default = baseUnset;
11645     }
11646   });
11647
11648   // node_modules/lodash-es/_customOmitClone.js
11649   function customOmitClone(value) {
11650     return isPlainObject_default(value) ? void 0 : value;
11651   }
11652   var customOmitClone_default;
11653   var init_customOmitClone = __esm({
11654     "node_modules/lodash-es/_customOmitClone.js"() {
11655       init_isPlainObject();
11656       customOmitClone_default = customOmitClone;
11657     }
11658   });
11659
11660   // node_modules/lodash-es/omit.js
11661   var CLONE_DEEP_FLAG2, CLONE_FLAT_FLAG2, CLONE_SYMBOLS_FLAG2, omit, omit_default;
11662   var init_omit = __esm({
11663     "node_modules/lodash-es/omit.js"() {
11664       init_arrayMap();
11665       init_baseClone();
11666       init_baseUnset();
11667       init_castPath();
11668       init_copyObject();
11669       init_customOmitClone();
11670       init_flatRest();
11671       init_getAllKeysIn();
11672       CLONE_DEEP_FLAG2 = 1;
11673       CLONE_FLAT_FLAG2 = 2;
11674       CLONE_SYMBOLS_FLAG2 = 4;
11675       omit = flatRest_default(function(object, paths) {
11676         var result = {};
11677         if (object == null) {
11678           return result;
11679         }
11680         var isDeep = false;
11681         paths = arrayMap_default(paths, function(path) {
11682           path = castPath_default(path, object);
11683           isDeep || (isDeep = path.length > 1);
11684           return path;
11685         });
11686         copyObject_default(object, getAllKeysIn_default(object), result);
11687         if (isDeep) {
11688           result = baseClone_default(result, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone_default);
11689         }
11690         var length2 = paths.length;
11691         while (length2--) {
11692           baseUnset_default(result, paths[length2]);
11693         }
11694         return result;
11695       });
11696       omit_default = omit;
11697     }
11698   });
11699
11700   // node_modules/lodash-es/throttle.js
11701   function throttle(func, wait, options) {
11702     var leading = true, trailing = true;
11703     if (typeof func != "function") {
11704       throw new TypeError(FUNC_ERROR_TEXT3);
11705     }
11706     if (isObject_default(options)) {
11707       leading = "leading" in options ? !!options.leading : leading;
11708       trailing = "trailing" in options ? !!options.trailing : trailing;
11709     }
11710     return debounce_default(func, wait, {
11711       "leading": leading,
11712       "maxWait": wait,
11713       "trailing": trailing
11714     });
11715   }
11716   var FUNC_ERROR_TEXT3, throttle_default;
11717   var init_throttle = __esm({
11718     "node_modules/lodash-es/throttle.js"() {
11719       init_debounce();
11720       init_isObject();
11721       FUNC_ERROR_TEXT3 = "Expected a function";
11722       throttle_default = throttle;
11723     }
11724   });
11725
11726   // node_modules/lodash-es/_unescapeHtmlChar.js
11727   var htmlUnescapes, unescapeHtmlChar, unescapeHtmlChar_default;
11728   var init_unescapeHtmlChar = __esm({
11729     "node_modules/lodash-es/_unescapeHtmlChar.js"() {
11730       init_basePropertyOf();
11731       htmlUnescapes = {
11732         "&amp;": "&",
11733         "&lt;": "<",
11734         "&gt;": ">",
11735         "&quot;": '"',
11736         "&#39;": "'"
11737       };
11738       unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
11739       unescapeHtmlChar_default = unescapeHtmlChar;
11740     }
11741   });
11742
11743   // node_modules/lodash-es/unescape.js
11744   function unescape(string) {
11745     string = toString_default(string);
11746     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
11747   }
11748   var reEscapedHtml, reHasEscapedHtml, unescape_default;
11749   var init_unescape = __esm({
11750     "node_modules/lodash-es/unescape.js"() {
11751       init_toString();
11752       init_unescapeHtmlChar();
11753       reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
11754       reHasEscapedHtml = RegExp(reEscapedHtml.source);
11755       unescape_default = unescape;
11756     }
11757   });
11758
11759   // node_modules/lodash-es/lodash.js
11760   var init_lodash = __esm({
11761     "node_modules/lodash-es/lodash.js"() {
11762       init_clamp();
11763       init_escape();
11764       init_isArray();
11765       init_isEmpty();
11766       init_isEqual();
11767       init_isNumber();
11768       init_merge4();
11769       init_omit();
11770       init_unescape();
11771     }
11772   });
11773
11774   // modules/osm/tags.js
11775   var tags_exports = {};
11776   __export(tags_exports, {
11777     allowUpperCaseTagValues: () => allowUpperCaseTagValues,
11778     isColourValid: () => isColourValid,
11779     osmAreaKeys: () => osmAreaKeys,
11780     osmAreaKeysExceptions: () => osmAreaKeysExceptions,
11781     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
11782     osmIsInterestingTag: () => osmIsInterestingTag,
11783     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
11784     osmLineTags: () => osmLineTags,
11785     osmMutuallyExclusiveTagPairs: () => osmMutuallyExclusiveTagPairs,
11786     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
11787     osmOneWayBackwardTags: () => osmOneWayBackwardTags,
11788     osmOneWayBiDirectionalTags: () => osmOneWayBiDirectionalTags,
11789     osmOneWayForwardTags: () => osmOneWayForwardTags,
11790     osmOneWayTags: () => osmOneWayTags,
11791     osmPathHighwayTagValues: () => osmPathHighwayTagValues,
11792     osmPavedTags: () => osmPavedTags,
11793     osmPointTags: () => osmPointTags,
11794     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
11795     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
11796     osmRightSideIsInsideTags: () => osmRightSideIsInsideTags,
11797     osmRoutableAerowayTags: () => osmRoutableAerowayTags,
11798     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
11799     osmSemipavedTags: () => osmSemipavedTags,
11800     osmSetAreaKeys: () => osmSetAreaKeys,
11801     osmSetLineTags: () => osmSetLineTags,
11802     osmSetPointTags: () => osmSetPointTags,
11803     osmSetVertexTags: () => osmSetVertexTags,
11804     osmShouldRenderDirection: () => osmShouldRenderDirection,
11805     osmSummableTags: () => osmSummableTags,
11806     osmTagSuggestingArea: () => osmTagSuggestingArea,
11807     osmVertexTags: () => osmVertexTags
11808   });
11809   function osmIsInterestingTag(key) {
11810     if (uninterestingKeys.has(key)) return false;
11811     if (uninterestingKeyRegex.test(key)) return false;
11812     return true;
11813   }
11814   function osmRemoveLifecyclePrefix(key) {
11815     const keySegments = key.split(":");
11816     if (keySegments.length === 1) return key;
11817     if (keySegments[0] in osmLifecyclePrefixes) {
11818       return key.slice(keySegments[0].length + 1);
11819     }
11820     return key;
11821   }
11822   function osmSetAreaKeys(value) {
11823     osmAreaKeys = value;
11824   }
11825   function osmTagSuggestingArea(tags) {
11826     if (tags.area === "yes") return { area: "yes" };
11827     if (tags.area === "no") return null;
11828     var returnTags = {};
11829     for (var realKey in tags) {
11830       const key = osmRemoveLifecyclePrefix(realKey);
11831       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
11832         returnTags[realKey] = tags[realKey];
11833         return returnTags;
11834       }
11835       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
11836         returnTags[realKey] = tags[realKey];
11837         return returnTags;
11838       }
11839     }
11840     return null;
11841   }
11842   function osmSetLineTags(value) {
11843     osmLineTags = value;
11844   }
11845   function osmSetPointTags(value) {
11846     osmPointTags = value;
11847   }
11848   function osmSetVertexTags(value) {
11849     osmVertexTags = value;
11850   }
11851   function osmNodeGeometriesForTags(nodeTags) {
11852     var geometries = {};
11853     for (var key in nodeTags) {
11854       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
11855         geometries.point = true;
11856       }
11857       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
11858         geometries.vertex = true;
11859       }
11860       if (geometries.point && geometries.vertex) break;
11861     }
11862     return geometries;
11863   }
11864   function isColourValid(value) {
11865     if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
11866       return false;
11867     }
11868     if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
11869       return false;
11870     }
11871     return true;
11872   }
11873   function osmShouldRenderDirection(vertexTags, wayTags) {
11874     if (vertexTags.highway || vertexTags.traffic_sign || vertexTags.traffic_calming || vertexTags.barrier) {
11875       return !!(wayTags.highway || wayTags.railway);
11876     }
11877     if (vertexTags.railway) return !!wayTags.railway;
11878     if (vertexTags.waterway) return !!wayTags.waterway;
11879     if (vertexTags.cycleway === "asl") return !!wayTags.highway;
11880     return true;
11881   }
11882   var uninterestingKeys, uninterestingKeyRegex, osmLifecyclePrefixes, osmAreaKeys, osmAreaKeysExceptions, osmLineTags, osmPointTags, osmVertexTags, osmOneWayForwardTags, osmOneWayBackwardTags, osmOneWayBiDirectionalTags, osmOneWayTags, osmPavedTags, osmSemipavedTags, osmRightSideIsInsideTags, osmRoutableHighwayTagValues, osmRoutableAerowayTags, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmFlowingWaterwayTagValues, allowUpperCaseTagValues, osmMutuallyExclusiveTagPairs, osmSummableTags;
11883   var init_tags = __esm({
11884     "modules/osm/tags.js"() {
11885       "use strict";
11886       init_lodash();
11887       uninterestingKeys = /* @__PURE__ */ new Set([
11888         "attribution",
11889         "created_by",
11890         "import_uuid",
11891         "geobase:datasetName",
11892         "geobase:uuid",
11893         "KSJ2:curve_id",
11894         "KSJ2:lat",
11895         "KSJ2:long",
11896         "lat",
11897         "latitude",
11898         "lon",
11899         "longitude",
11900         "source",
11901         "source_ref",
11902         "odbl",
11903         "odbl:note"
11904       ]);
11905       uninterestingKeyRegex = /^(source(_ref)?|tiger):/;
11906       osmLifecyclePrefixes = {
11907         // nonexistent, might be built
11908         proposed: true,
11909         planned: true,
11910         // under maintenance or between groundbreaking and opening
11911         construction: true,
11912         // existent but not functional
11913         disused: true,
11914         // dilapidated to nonexistent
11915         abandoned: true,
11916         was: true,
11917         // nonexistent, still may appear in imagery
11918         dismantled: true,
11919         razed: true,
11920         demolished: true,
11921         destroyed: true,
11922         removed: true,
11923         obliterated: true,
11924         // existent occasionally, e.g. stormwater drainage basin
11925         intermittent: true
11926       };
11927       osmAreaKeys = {};
11928       osmAreaKeysExceptions = {
11929         highway: {
11930           elevator: true,
11931           rest_area: true,
11932           services: true
11933         },
11934         public_transport: {
11935           platform: true
11936         },
11937         railway: {
11938           platform: true,
11939           roundhouse: true,
11940           station: true,
11941           traverser: true,
11942           turntable: true,
11943           wash: true,
11944           ventilation_shaft: true
11945         },
11946         waterway: {
11947           dam: true
11948         },
11949         amenity: {
11950           bicycle_parking: true
11951         }
11952       };
11953       osmLineTags = {};
11954       osmPointTags = {};
11955       osmVertexTags = {};
11956       osmOneWayForwardTags = {
11957         "aerialway": {
11958           "chair_lift": true,
11959           "drag_lift": true,
11960           "j-bar": true,
11961           "magic_carpet": true,
11962           "mixed_lift": true,
11963           "platter": true,
11964           "rope_tow": true,
11965           "t-bar": true,
11966           "zip_line": true
11967         },
11968         "conveying": {
11969           "forward": true
11970         },
11971         "highway": {
11972           "motorway": true
11973         },
11974         "junction": {
11975           "circular": true,
11976           "roundabout": true
11977         },
11978         "man_made": {
11979           "goods_conveyor": true,
11980           "piste:halfpipe": true
11981         },
11982         "oneway": {
11983           "yes": true
11984         },
11985         "piste:type": {
11986           "downhill": true,
11987           "sled": true,
11988           "yes": true
11989         },
11990         "seamark:type": {
11991           "two-way_route": true,
11992           "recommended_traffic_lane": true,
11993           "separation_lane": true,
11994           "separation_roundabout": true
11995         },
11996         "waterway": {
11997           "canal": true,
11998           "ditch": true,
11999           "drain": true,
12000           "fish_pass": true,
12001           "flowline": true,
12002           "pressurised": true,
12003           "river": true,
12004           "spillway": true,
12005           "stream": true,
12006           "tidal_channel": true
12007         }
12008       };
12009       osmOneWayBackwardTags = {
12010         "conveying": {
12011           "backward": true
12012         },
12013         "oneway": {
12014           "-1": true
12015         }
12016       };
12017       osmOneWayBiDirectionalTags = {
12018         "conveying": {
12019           "reversible": true
12020         },
12021         "oneway": {
12022           "alternating": true,
12023           "reversible": true
12024         }
12025       };
12026       osmOneWayTags = merge_default3(
12027         osmOneWayForwardTags,
12028         osmOneWayBackwardTags,
12029         osmOneWayBiDirectionalTags
12030       );
12031       osmPavedTags = {
12032         "surface": {
12033           "paved": true,
12034           "asphalt": true,
12035           "concrete": true,
12036           "chipseal": true,
12037           "concrete:lanes": true,
12038           "concrete:plates": true
12039         },
12040         "tracktype": {
12041           "grade1": true
12042         }
12043       };
12044       osmSemipavedTags = {
12045         "surface": {
12046           "cobblestone": true,
12047           "cobblestone:flattened": true,
12048           "unhewn_cobblestone": true,
12049           "sett": true,
12050           "paving_stones": true,
12051           "metal": true,
12052           "wood": true
12053         }
12054       };
12055       osmRightSideIsInsideTags = {
12056         "natural": {
12057           "cliff": true,
12058           "coastline": "coastline"
12059         },
12060         "barrier": {
12061           "retaining_wall": true,
12062           "kerb": true,
12063           "guard_rail": true,
12064           "city_wall": true
12065         },
12066         "man_made": {
12067           "embankment": true,
12068           "quay": true
12069         },
12070         "waterway": {
12071           "weir": true
12072         }
12073       };
12074       osmRoutableHighwayTagValues = {
12075         motorway: true,
12076         trunk: true,
12077         primary: true,
12078         secondary: true,
12079         tertiary: true,
12080         residential: true,
12081         motorway_link: true,
12082         trunk_link: true,
12083         primary_link: true,
12084         secondary_link: true,
12085         tertiary_link: true,
12086         unclassified: true,
12087         road: true,
12088         service: true,
12089         track: true,
12090         living_street: true,
12091         bus_guideway: true,
12092         busway: true,
12093         path: true,
12094         footway: true,
12095         cycleway: true,
12096         bridleway: true,
12097         pedestrian: true,
12098         corridor: true,
12099         steps: true,
12100         ladder: true
12101       };
12102       osmRoutableAerowayTags = {
12103         runway: true,
12104         taxiway: true
12105       };
12106       osmPathHighwayTagValues = {
12107         path: true,
12108         footway: true,
12109         cycleway: true,
12110         bridleway: true,
12111         pedestrian: true,
12112         corridor: true,
12113         steps: true,
12114         ladder: true
12115       };
12116       osmRailwayTrackTagValues = {
12117         rail: true,
12118         light_rail: true,
12119         tram: true,
12120         subway: true,
12121         monorail: true,
12122         funicular: true,
12123         miniature: true,
12124         narrow_gauge: true,
12125         disused: true,
12126         preserved: true
12127       };
12128       osmFlowingWaterwayTagValues = {
12129         canal: true,
12130         ditch: true,
12131         drain: true,
12132         fish_pass: true,
12133         flowline: true,
12134         river: true,
12135         stream: true,
12136         tidal_channel: true
12137       };
12138       allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
12139       osmMutuallyExclusiveTagPairs = [
12140         ["noname", "name"],
12141         ["noref", "ref"],
12142         ["nohousenumber", "addr:housenumber"],
12143         ["noaddress", "addr:housenumber"],
12144         ["noaddress", "addr:housename"],
12145         ["noaddress", "addr:unit"],
12146         ["addr:nostreet", "addr:street"]
12147       ];
12148       osmSummableTags = /* @__PURE__ */ new Set([
12149         "step_count",
12150         "parking:both:capacity",
12151         "parking:left:capacity",
12152         "parking:left:capacity"
12153       ]);
12154     }
12155   });
12156
12157   // modules/util/array.js
12158   var array_exports = {};
12159   __export(array_exports, {
12160     utilArrayChunk: () => utilArrayChunk,
12161     utilArrayDifference: () => utilArrayDifference,
12162     utilArrayFlatten: () => utilArrayFlatten,
12163     utilArrayGroupBy: () => utilArrayGroupBy,
12164     utilArrayIdentical: () => utilArrayIdentical,
12165     utilArrayIntersection: () => utilArrayIntersection,
12166     utilArrayUnion: () => utilArrayUnion,
12167     utilArrayUniq: () => utilArrayUniq,
12168     utilArrayUniqBy: () => utilArrayUniqBy
12169   });
12170   function utilArrayIdentical(a4, b3) {
12171     if (a4 === b3) return true;
12172     var i3 = a4.length;
12173     if (i3 !== b3.length) return false;
12174     while (i3--) {
12175       if (a4[i3] !== b3[i3]) return false;
12176     }
12177     return true;
12178   }
12179   function utilArrayDifference(a4, b3) {
12180     var other = new Set(b3);
12181     return Array.from(new Set(a4)).filter(function(v3) {
12182       return !other.has(v3);
12183     });
12184   }
12185   function utilArrayIntersection(a4, b3) {
12186     var other = new Set(b3);
12187     return Array.from(new Set(a4)).filter(function(v3) {
12188       return other.has(v3);
12189     });
12190   }
12191   function utilArrayUnion(a4, b3) {
12192     var result = new Set(a4);
12193     b3.forEach(function(v3) {
12194       result.add(v3);
12195     });
12196     return Array.from(result);
12197   }
12198   function utilArrayUniq(a4) {
12199     return Array.from(new Set(a4));
12200   }
12201   function utilArrayChunk(a4, chunkSize) {
12202     if (!chunkSize || chunkSize < 0) return [a4.slice()];
12203     var result = new Array(Math.ceil(a4.length / chunkSize));
12204     return Array.from(result, function(item, i3) {
12205       return a4.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
12206     });
12207   }
12208   function utilArrayFlatten(a4) {
12209     return a4.reduce(function(acc, val) {
12210       return acc.concat(val);
12211     }, []);
12212   }
12213   function utilArrayGroupBy(a4, key) {
12214     return a4.reduce(function(acc, item) {
12215       var group = typeof key === "function" ? key(item) : item[key];
12216       (acc[group] = acc[group] || []).push(item);
12217       return acc;
12218     }, {});
12219   }
12220   function utilArrayUniqBy(a4, key) {
12221     var seen = /* @__PURE__ */ new Set();
12222     return a4.reduce(function(acc, item) {
12223       var val = typeof key === "function" ? key(item) : item[key];
12224       if (val && !seen.has(val)) {
12225         seen.add(val);
12226         acc.push(item);
12227       }
12228       return acc;
12229     }, []);
12230   }
12231   var init_array3 = __esm({
12232     "modules/util/array.js"() {
12233       "use strict";
12234     }
12235   });
12236
12237   // node_modules/diacritics/index.js
12238   var require_diacritics = __commonJS({
12239     "node_modules/diacritics/index.js"(exports2) {
12240       exports2.remove = removeDiacritics2;
12241       var replacementList = [
12242         {
12243           base: " ",
12244           chars: "\xA0"
12245         },
12246         {
12247           base: "0",
12248           chars: "\u07C0"
12249         },
12250         {
12251           base: "A",
12252           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"
12253         },
12254         {
12255           base: "AA",
12256           chars: "\uA732"
12257         },
12258         {
12259           base: "AE",
12260           chars: "\xC6\u01FC\u01E2"
12261         },
12262         {
12263           base: "AO",
12264           chars: "\uA734"
12265         },
12266         {
12267           base: "AU",
12268           chars: "\uA736"
12269         },
12270         {
12271           base: "AV",
12272           chars: "\uA738\uA73A"
12273         },
12274         {
12275           base: "AY",
12276           chars: "\uA73C"
12277         },
12278         {
12279           base: "B",
12280           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
12281         },
12282         {
12283           base: "C",
12284           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
12285         },
12286         {
12287           base: "D",
12288           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
12289         },
12290         {
12291           base: "Dh",
12292           chars: "\xD0"
12293         },
12294         {
12295           base: "DZ",
12296           chars: "\u01F1\u01C4"
12297         },
12298         {
12299           base: "Dz",
12300           chars: "\u01F2\u01C5"
12301         },
12302         {
12303           base: "E",
12304           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"
12305         },
12306         {
12307           base: "F",
12308           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
12309         },
12310         {
12311           base: "G",
12312           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
12313         },
12314         {
12315           base: "H",
12316           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
12317         },
12318         {
12319           base: "I",
12320           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
12321         },
12322         {
12323           base: "J",
12324           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
12325         },
12326         {
12327           base: "K",
12328           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
12329         },
12330         {
12331           base: "L",
12332           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
12333         },
12334         {
12335           base: "LJ",
12336           chars: "\u01C7"
12337         },
12338         {
12339           base: "Lj",
12340           chars: "\u01C8"
12341         },
12342         {
12343           base: "M",
12344           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
12345         },
12346         {
12347           base: "N",
12348           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
12349         },
12350         {
12351           base: "NJ",
12352           chars: "\u01CA"
12353         },
12354         {
12355           base: "Nj",
12356           chars: "\u01CB"
12357         },
12358         {
12359           base: "O",
12360           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"
12361         },
12362         {
12363           base: "OE",
12364           chars: "\u0152"
12365         },
12366         {
12367           base: "OI",
12368           chars: "\u01A2"
12369         },
12370         {
12371           base: "OO",
12372           chars: "\uA74E"
12373         },
12374         {
12375           base: "OU",
12376           chars: "\u0222"
12377         },
12378         {
12379           base: "P",
12380           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
12381         },
12382         {
12383           base: "Q",
12384           chars: "\u24C6\uFF31\uA756\uA758\u024A"
12385         },
12386         {
12387           base: "R",
12388           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
12389         },
12390         {
12391           base: "S",
12392           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
12393         },
12394         {
12395           base: "T",
12396           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
12397         },
12398         {
12399           base: "Th",
12400           chars: "\xDE"
12401         },
12402         {
12403           base: "TZ",
12404           chars: "\uA728"
12405         },
12406         {
12407           base: "U",
12408           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"
12409         },
12410         {
12411           base: "V",
12412           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
12413         },
12414         {
12415           base: "VY",
12416           chars: "\uA760"
12417         },
12418         {
12419           base: "W",
12420           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
12421         },
12422         {
12423           base: "X",
12424           chars: "\u24CD\uFF38\u1E8A\u1E8C"
12425         },
12426         {
12427           base: "Y",
12428           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
12429         },
12430         {
12431           base: "Z",
12432           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
12433         },
12434         {
12435           base: "a",
12436           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"
12437         },
12438         {
12439           base: "aa",
12440           chars: "\uA733"
12441         },
12442         {
12443           base: "ae",
12444           chars: "\xE6\u01FD\u01E3"
12445         },
12446         {
12447           base: "ao",
12448           chars: "\uA735"
12449         },
12450         {
12451           base: "au",
12452           chars: "\uA737"
12453         },
12454         {
12455           base: "av",
12456           chars: "\uA739\uA73B"
12457         },
12458         {
12459           base: "ay",
12460           chars: "\uA73D"
12461         },
12462         {
12463           base: "b",
12464           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
12465         },
12466         {
12467           base: "c",
12468           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
12469         },
12470         {
12471           base: "d",
12472           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
12473         },
12474         {
12475           base: "dh",
12476           chars: "\xF0"
12477         },
12478         {
12479           base: "dz",
12480           chars: "\u01F3\u01C6"
12481         },
12482         {
12483           base: "e",
12484           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"
12485         },
12486         {
12487           base: "f",
12488           chars: "\u24D5\uFF46\u1E1F\u0192"
12489         },
12490         {
12491           base: "ff",
12492           chars: "\uFB00"
12493         },
12494         {
12495           base: "fi",
12496           chars: "\uFB01"
12497         },
12498         {
12499           base: "fl",
12500           chars: "\uFB02"
12501         },
12502         {
12503           base: "ffi",
12504           chars: "\uFB03"
12505         },
12506         {
12507           base: "ffl",
12508           chars: "\uFB04"
12509         },
12510         {
12511           base: "g",
12512           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
12513         },
12514         {
12515           base: "h",
12516           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
12517         },
12518         {
12519           base: "hv",
12520           chars: "\u0195"
12521         },
12522         {
12523           base: "i",
12524           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
12525         },
12526         {
12527           base: "j",
12528           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
12529         },
12530         {
12531           base: "k",
12532           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
12533         },
12534         {
12535           base: "l",
12536           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
12537         },
12538         {
12539           base: "lj",
12540           chars: "\u01C9"
12541         },
12542         {
12543           base: "m",
12544           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
12545         },
12546         {
12547           base: "n",
12548           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
12549         },
12550         {
12551           base: "nj",
12552           chars: "\u01CC"
12553         },
12554         {
12555           base: "o",
12556           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"
12557         },
12558         {
12559           base: "oe",
12560           chars: "\u0153"
12561         },
12562         {
12563           base: "oi",
12564           chars: "\u01A3"
12565         },
12566         {
12567           base: "oo",
12568           chars: "\uA74F"
12569         },
12570         {
12571           base: "ou",
12572           chars: "\u0223"
12573         },
12574         {
12575           base: "p",
12576           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
12577         },
12578         {
12579           base: "q",
12580           chars: "\u24E0\uFF51\u024B\uA757\uA759"
12581         },
12582         {
12583           base: "r",
12584           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
12585         },
12586         {
12587           base: "s",
12588           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
12589         },
12590         {
12591           base: "ss",
12592           chars: "\xDF"
12593         },
12594         {
12595           base: "t",
12596           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
12597         },
12598         {
12599           base: "th",
12600           chars: "\xFE"
12601         },
12602         {
12603           base: "tz",
12604           chars: "\uA729"
12605         },
12606         {
12607           base: "u",
12608           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"
12609         },
12610         {
12611           base: "v",
12612           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
12613         },
12614         {
12615           base: "vy",
12616           chars: "\uA761"
12617         },
12618         {
12619           base: "w",
12620           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
12621         },
12622         {
12623           base: "x",
12624           chars: "\u24E7\uFF58\u1E8B\u1E8D"
12625         },
12626         {
12627           base: "y",
12628           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
12629         },
12630         {
12631           base: "z",
12632           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
12633         }
12634       ];
12635       var diacriticsMap = {};
12636       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
12637         chars = replacementList[i3].chars;
12638         for (j3 = 0; j3 < chars.length; j3 += 1) {
12639           diacriticsMap[chars[j3]] = replacementList[i3].base;
12640         }
12641       }
12642       var chars;
12643       var j3;
12644       var i3;
12645       function removeDiacritics2(str) {
12646         return str.replace(/[^\u0000-\u007e]/g, function(c2) {
12647           return diacriticsMap[c2] || c2;
12648         });
12649       }
12650       exports2.replacementList = replacementList;
12651       exports2.diacriticsMap = diacriticsMap;
12652     }
12653   });
12654
12655   // node_modules/alif-toolkit/lib/isArabic.js
12656   var require_isArabic = __commonJS({
12657     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
12658       "use strict";
12659       Object.defineProperty(exports2, "__esModule", { value: true });
12660       exports2.isArabic = isArabic;
12661       exports2.isMath = isMath;
12662       var arabicBlocks = [
12663         [1536, 1791],
12664         // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
12665         [1872, 1919],
12666         // supplement https://www.unicode.org/charts/PDF/U0750.pdf
12667         [2208, 2303],
12668         // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
12669         [64336, 65023],
12670         // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
12671         [65136, 65279],
12672         // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
12673         [69216, 69247],
12674         // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
12675         [126064, 126143],
12676         // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
12677         [126464, 126719]
12678         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
12679       ];
12680       function isArabic(char) {
12681         if (char.length > 1) {
12682           throw new Error("isArabic works on only one-character strings");
12683         }
12684         let code = char.charCodeAt(0);
12685         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
12686           let block = arabicBlocks[i3];
12687           if (code >= block[0] && code <= block[1]) {
12688             return true;
12689           }
12690         }
12691         return false;
12692       }
12693       function isMath(char) {
12694         if (char.length > 2) {
12695           throw new Error("isMath works on only one-character strings");
12696         }
12697         let code = char.charCodeAt(0);
12698         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
12699       }
12700     }
12701   });
12702
12703   // node_modules/alif-toolkit/lib/unicode-arabic.js
12704   var require_unicode_arabic = __commonJS({
12705     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
12706       "use strict";
12707       Object.defineProperty(exports2, "__esModule", { value: true });
12708       var arabicReference = {
12709         "alef": {
12710           "normal": [
12711             "\u0627"
12712           ],
12713           "madda_above": {
12714             "normal": [
12715               "\u0627\u0653",
12716               "\u0622"
12717             ],
12718             "isolated": "\uFE81",
12719             "final": "\uFE82"
12720           },
12721           "hamza_above": {
12722             "normal": [
12723               "\u0627\u0654",
12724               "\u0623"
12725             ],
12726             "isolated": "\uFE83",
12727             "final": "\uFE84"
12728           },
12729           "hamza_below": {
12730             "normal": [
12731               "\u0627\u0655",
12732               "\u0625"
12733             ],
12734             "isolated": "\uFE87",
12735             "final": "\uFE88"
12736           },
12737           "wasla": {
12738             "normal": "\u0671",
12739             "isolated": "\uFB50",
12740             "final": "\uFB51"
12741           },
12742           "wavy_hamza_above": [
12743             "\u0672"
12744           ],
12745           "wavy_hamza_below": [
12746             "\u0627\u065F",
12747             "\u0673"
12748           ],
12749           "high_hamza": [
12750             "\u0675",
12751             "\u0627\u0674"
12752           ],
12753           "indic_two_above": [
12754             "\u0773"
12755           ],
12756           "indic_three_above": [
12757             "\u0774"
12758           ],
12759           "fathatan": {
12760             "normal": [
12761               "\u0627\u064B"
12762             ],
12763             "final": "\uFD3C",
12764             "isolated": "\uFD3D"
12765           },
12766           "isolated": "\uFE8D",
12767           "final": "\uFE8E"
12768         },
12769         "beh": {
12770           "normal": [
12771             "\u0628"
12772           ],
12773           "dotless": [
12774             "\u066E"
12775           ],
12776           "three_dots_horizontally_below": [
12777             "\u0750"
12778           ],
12779           "dot_below_three_dots_above": [
12780             "\u0751"
12781           ],
12782           "three_dots_pointing_upwards_below": [
12783             "\u0752"
12784           ],
12785           "three_dots_pointing_upwards_below_two_dots_above": [
12786             "\u0753"
12787           ],
12788           "two_dots_below_dot_above": [
12789             "\u0754"
12790           ],
12791           "inverted_small_v_below": [
12792             "\u0755"
12793           ],
12794           "small_v": [
12795             "\u0756"
12796           ],
12797           "small_v_below": [
12798             "\u08A0"
12799           ],
12800           "hamza_above": [
12801             "\u08A1"
12802           ],
12803           "small_meem_above": [
12804             "\u08B6"
12805           ],
12806           "isolated": "\uFE8F",
12807           "final": "\uFE90",
12808           "initial": "\uFE91",
12809           "medial": "\uFE92"
12810         },
12811         "teh marbuta": {
12812           "normal": [
12813             "\u0629"
12814           ],
12815           "isolated": "\uFE93",
12816           "final": "\uFE94"
12817         },
12818         "teh": {
12819           "normal": [
12820             "\u062A"
12821           ],
12822           "ring": [
12823             "\u067C"
12824           ],
12825           "three_dots_above_downwards": [
12826             "\u067D"
12827           ],
12828           "small_teh_above": [
12829             "\u08B8"
12830           ],
12831           "isolated": "\uFE95",
12832           "final": "\uFE96",
12833           "initial": "\uFE97",
12834           "medial": "\uFE98"
12835         },
12836         "theh": {
12837           "normal": [
12838             "\u062B"
12839           ],
12840           "isolated": "\uFE99",
12841           "final": "\uFE9A",
12842           "initial": "\uFE9B",
12843           "medial": "\uFE9C"
12844         },
12845         "jeem": {
12846           "normal": [
12847             "\u062C"
12848           ],
12849           "two_dots_above": [
12850             "\u08A2"
12851           ],
12852           "isolated": "\uFE9D",
12853           "final": "\uFE9E",
12854           "initial": "\uFE9F",
12855           "medial": "\uFEA0"
12856         },
12857         "hah": {
12858           "normal": [
12859             "\u062D"
12860           ],
12861           "hamza_above": [
12862             "\u0681"
12863           ],
12864           "two_dots_vertical_above": [
12865             "\u0682"
12866           ],
12867           "three_dots_above": [
12868             "\u0685"
12869           ],
12870           "two_dots_above": [
12871             "\u0757"
12872           ],
12873           "three_dots_pointing_upwards_below": [
12874             "\u0758"
12875           ],
12876           "small_tah_below": [
12877             "\u076E"
12878           ],
12879           "small_tah_two_dots": [
12880             "\u076F"
12881           ],
12882           "small_tah_above": [
12883             "\u0772"
12884           ],
12885           "indic_four_below": [
12886             "\u077C"
12887           ],
12888           "isolated": "\uFEA1",
12889           "final": "\uFEA2",
12890           "initial": "\uFEA3",
12891           "medial": "\uFEA4"
12892         },
12893         "khah": {
12894           "normal": [
12895             "\u062E"
12896           ],
12897           "isolated": "\uFEA5",
12898           "final": "\uFEA6",
12899           "initial": "\uFEA7",
12900           "medial": "\uFEA8"
12901         },
12902         "dal": {
12903           "normal": [
12904             "\u062F"
12905           ],
12906           "ring": [
12907             "\u0689"
12908           ],
12909           "dot_below": [
12910             "\u068A"
12911           ],
12912           "dot_below_small_tah": [
12913             "\u068B"
12914           ],
12915           "three_dots_above_downwards": [
12916             "\u068F"
12917           ],
12918           "four_dots_above": [
12919             "\u0690"
12920           ],
12921           "inverted_v": [
12922             "\u06EE"
12923           ],
12924           "two_dots_vertically_below_small_tah": [
12925             "\u0759"
12926           ],
12927           "inverted_small_v_below": [
12928             "\u075A"
12929           ],
12930           "three_dots_below": [
12931             "\u08AE"
12932           ],
12933           "isolated": "\uFEA9",
12934           "final": "\uFEAA"
12935         },
12936         "thal": {
12937           "normal": [
12938             "\u0630"
12939           ],
12940           "isolated": "\uFEAB",
12941           "final": "\uFEAC"
12942         },
12943         "reh": {
12944           "normal": [
12945             "\u0631"
12946           ],
12947           "small_v": [
12948             "\u0692"
12949           ],
12950           "ring": [
12951             "\u0693"
12952           ],
12953           "dot_below": [
12954             "\u0694"
12955           ],
12956           "small_v_below": [
12957             "\u0695"
12958           ],
12959           "dot_below_dot_above": [
12960             "\u0696"
12961           ],
12962           "two_dots_above": [
12963             "\u0697"
12964           ],
12965           "four_dots_above": [
12966             "\u0699"
12967           ],
12968           "inverted_v": [
12969             "\u06EF"
12970           ],
12971           "stroke": [
12972             "\u075B"
12973           ],
12974           "two_dots_vertically_above": [
12975             "\u076B"
12976           ],
12977           "hamza_above": [
12978             "\u076C"
12979           ],
12980           "small_tah_two_dots": [
12981             "\u0771"
12982           ],
12983           "loop": [
12984             "\u08AA"
12985           ],
12986           "small_noon_above": [
12987             "\u08B9"
12988           ],
12989           "isolated": "\uFEAD",
12990           "final": "\uFEAE"
12991         },
12992         "zain": {
12993           "normal": [
12994             "\u0632"
12995           ],
12996           "inverted_v_above": [
12997             "\u08B2"
12998           ],
12999           "isolated": "\uFEAF",
13000           "final": "\uFEB0"
13001         },
13002         "seen": {
13003           "normal": [
13004             "\u0633"
13005           ],
13006           "dot_below_dot_above": [
13007             "\u069A"
13008           ],
13009           "three_dots_below": [
13010             "\u069B"
13011           ],
13012           "three_dots_below_three_dots_above": [
13013             "\u069C"
13014           ],
13015           "four_dots_above": [
13016             "\u075C"
13017           ],
13018           "two_dots_vertically_above": [
13019             "\u076D"
13020           ],
13021           "small_tah_two_dots": [
13022             "\u0770"
13023           ],
13024           "indic_four_above": [
13025             "\u077D"
13026           ],
13027           "inverted_v": [
13028             "\u077E"
13029           ],
13030           "isolated": "\uFEB1",
13031           "final": "\uFEB2",
13032           "initial": "\uFEB3",
13033           "medial": "\uFEB4"
13034         },
13035         "sheen": {
13036           "normal": [
13037             "\u0634"
13038           ],
13039           "dot_below": [
13040             "\u06FA"
13041           ],
13042           "isolated": "\uFEB5",
13043           "final": "\uFEB6",
13044           "initial": "\uFEB7",
13045           "medial": "\uFEB8"
13046         },
13047         "sad": {
13048           "normal": [
13049             "\u0635"
13050           ],
13051           "two_dots_below": [
13052             "\u069D"
13053           ],
13054           "three_dots_above": [
13055             "\u069E"
13056           ],
13057           "three_dots_below": [
13058             "\u08AF"
13059           ],
13060           "isolated": "\uFEB9",
13061           "final": "\uFEBA",
13062           "initial": "\uFEBB",
13063           "medial": "\uFEBC"
13064         },
13065         "dad": {
13066           "normal": [
13067             "\u0636"
13068           ],
13069           "dot_below": [
13070             "\u06FB"
13071           ],
13072           "isolated": "\uFEBD",
13073           "final": "\uFEBE",
13074           "initial": "\uFEBF",
13075           "medial": "\uFEC0"
13076         },
13077         "tah": {
13078           "normal": [
13079             "\u0637"
13080           ],
13081           "three_dots_above": [
13082             "\u069F"
13083           ],
13084           "two_dots_above": [
13085             "\u08A3"
13086           ],
13087           "isolated": "\uFEC1",
13088           "final": "\uFEC2",
13089           "initial": "\uFEC3",
13090           "medial": "\uFEC4"
13091         },
13092         "zah": {
13093           "normal": [
13094             "\u0638"
13095           ],
13096           "isolated": "\uFEC5",
13097           "final": "\uFEC6",
13098           "initial": "\uFEC7",
13099           "medial": "\uFEC8"
13100         },
13101         "ain": {
13102           "normal": [
13103             "\u0639"
13104           ],
13105           "three_dots_above": [
13106             "\u06A0"
13107           ],
13108           "two_dots_above": [
13109             "\u075D"
13110           ],
13111           "three_dots_pointing_downwards_above": [
13112             "\u075E"
13113           ],
13114           "two_dots_vertically_above": [
13115             "\u075F"
13116           ],
13117           "three_dots_below": [
13118             "\u08B3"
13119           ],
13120           "isolated": "\uFEC9",
13121           "final": "\uFECA",
13122           "initial": "\uFECB",
13123           "medial": "\uFECC"
13124         },
13125         "ghain": {
13126           "normal": [
13127             "\u063A"
13128           ],
13129           "dot_below": [
13130             "\u06FC"
13131           ],
13132           "isolated": "\uFECD",
13133           "final": "\uFECE",
13134           "initial": "\uFECF",
13135           "medial": "\uFED0"
13136         },
13137         "feh": {
13138           "normal": [
13139             "\u0641"
13140           ],
13141           "dotless": [
13142             "\u06A1"
13143           ],
13144           "dot_moved_below": [
13145             "\u06A2"
13146           ],
13147           "dot_below": [
13148             "\u06A3"
13149           ],
13150           "three_dots_below": [
13151             "\u06A5"
13152           ],
13153           "two_dots_below": [
13154             "\u0760"
13155           ],
13156           "three_dots_pointing_upwards_below": [
13157             "\u0761"
13158           ],
13159           "dot_below_three_dots_above": [
13160             "\u08A4"
13161           ],
13162           "isolated": "\uFED1",
13163           "final": "\uFED2",
13164           "initial": "\uFED3",
13165           "medial": "\uFED4"
13166         },
13167         "qaf": {
13168           "normal": [
13169             "\u0642"
13170           ],
13171           "dotless": [
13172             "\u066F"
13173           ],
13174           "dot_above": [
13175             "\u06A7"
13176           ],
13177           "three_dots_above": [
13178             "\u06A8"
13179           ],
13180           "dot_below": [
13181             "\u08A5"
13182           ],
13183           "isolated": "\uFED5",
13184           "final": "\uFED6",
13185           "initial": "\uFED7",
13186           "medial": "\uFED8"
13187         },
13188         "kaf": {
13189           "normal": [
13190             "\u0643"
13191           ],
13192           "swash": [
13193             "\u06AA"
13194           ],
13195           "ring": [
13196             "\u06AB"
13197           ],
13198           "dot_above": [
13199             "\u06AC"
13200           ],
13201           "three_dots_below": [
13202             "\u06AE"
13203           ],
13204           "two_dots_above": [
13205             "\u077F"
13206           ],
13207           "dot_below": [
13208             "\u08B4"
13209           ],
13210           "isolated": "\uFED9",
13211           "final": "\uFEDA",
13212           "initial": "\uFEDB",
13213           "medial": "\uFEDC"
13214         },
13215         "lam": {
13216           "normal": [
13217             "\u0644"
13218           ],
13219           "small_v": [
13220             "\u06B5"
13221           ],
13222           "dot_above": [
13223             "\u06B6"
13224           ],
13225           "three_dots_above": [
13226             "\u06B7"
13227           ],
13228           "three_dots_below": [
13229             "\u06B8"
13230           ],
13231           "bar": [
13232             "\u076A"
13233           ],
13234           "double_bar": [
13235             "\u08A6"
13236           ],
13237           "isolated": "\uFEDD",
13238           "final": "\uFEDE",
13239           "initial": "\uFEDF",
13240           "medial": "\uFEE0"
13241         },
13242         "meem": {
13243           "normal": [
13244             "\u0645"
13245           ],
13246           "dot_above": [
13247             "\u0765"
13248           ],
13249           "dot_below": [
13250             "\u0766"
13251           ],
13252           "three_dots_above": [
13253             "\u08A7"
13254           ],
13255           "isolated": "\uFEE1",
13256           "final": "\uFEE2",
13257           "initial": "\uFEE3",
13258           "medial": "\uFEE4"
13259         },
13260         "noon": {
13261           "normal": [
13262             "\u0646"
13263           ],
13264           "dot_below": [
13265             "\u06B9"
13266           ],
13267           "ring": [
13268             "\u06BC"
13269           ],
13270           "three_dots_above": [
13271             "\u06BD"
13272           ],
13273           "two_dots_below": [
13274             "\u0767"
13275           ],
13276           "small_tah": [
13277             "\u0768"
13278           ],
13279           "small_v": [
13280             "\u0769"
13281           ],
13282           "isolated": "\uFEE5",
13283           "final": "\uFEE6",
13284           "initial": "\uFEE7",
13285           "medial": "\uFEE8"
13286         },
13287         "heh": {
13288           "normal": [
13289             "\u0647"
13290           ],
13291           "isolated": "\uFEE9",
13292           "final": "\uFEEA",
13293           "initial": "\uFEEB",
13294           "medial": "\uFEEC"
13295         },
13296         "waw": {
13297           "normal": [
13298             "\u0648"
13299           ],
13300           "hamza_above": {
13301             "normal": [
13302               "\u0624",
13303               "\u0648\u0654"
13304             ],
13305             "isolated": "\uFE85",
13306             "final": "\uFE86"
13307           },
13308           "high_hamza": [
13309             "\u0676",
13310             "\u0648\u0674"
13311           ],
13312           "ring": [
13313             "\u06C4"
13314           ],
13315           "two_dots_above": [
13316             "\u06CA"
13317           ],
13318           "dot_above": [
13319             "\u06CF"
13320           ],
13321           "indic_two_above": [
13322             "\u0778"
13323           ],
13324           "indic_three_above": [
13325             "\u0779"
13326           ],
13327           "dot_within": [
13328             "\u08AB"
13329           ],
13330           "isolated": "\uFEED",
13331           "final": "\uFEEE"
13332         },
13333         "alef_maksura": {
13334           "normal": [
13335             "\u0649"
13336           ],
13337           "hamza_above": [
13338             "\u0626",
13339             "\u064A\u0654"
13340           ],
13341           "initial": "\uFBE8",
13342           "medial": "\uFBE9",
13343           "isolated": "\uFEEF",
13344           "final": "\uFEF0"
13345         },
13346         "yeh": {
13347           "normal": [
13348             "\u064A"
13349           ],
13350           "hamza_above": {
13351             "normal": [
13352               "\u0626",
13353               "\u0649\u0654"
13354             ],
13355             "isolated": "\uFE89",
13356             "final": "\uFE8A",
13357             "initial": "\uFE8B",
13358             "medial": "\uFE8C"
13359           },
13360           "two_dots_below_hamza_above": [
13361             "\u08A8"
13362           ],
13363           "high_hamza": [
13364             "\u0678",
13365             "\u064A\u0674"
13366           ],
13367           "tail": [
13368             "\u06CD"
13369           ],
13370           "small_v": [
13371             "\u06CE"
13372           ],
13373           "three_dots_below": [
13374             "\u06D1"
13375           ],
13376           "two_dots_below_dot_above": [
13377             "\u08A9"
13378           ],
13379           "two_dots_below_small_noon_above": [
13380             "\u08BA"
13381           ],
13382           "isolated": "\uFEF1",
13383           "final": "\uFEF2",
13384           "initial": "\uFEF3",
13385           "medial": "\uFEF4"
13386         },
13387         "tteh": {
13388           "normal": [
13389             "\u0679"
13390           ],
13391           "isolated": "\uFB66",
13392           "final": "\uFB67",
13393           "initial": "\uFB68",
13394           "medial": "\uFB69"
13395         },
13396         "tteheh": {
13397           "normal": [
13398             "\u067A"
13399           ],
13400           "isolated": "\uFB5E",
13401           "final": "\uFB5F",
13402           "initial": "\uFB60",
13403           "medial": "\uFB61"
13404         },
13405         "beeh": {
13406           "normal": [
13407             "\u067B"
13408           ],
13409           "isolated": "\uFB52",
13410           "final": "\uFB53",
13411           "initial": "\uFB54",
13412           "medial": "\uFB55"
13413         },
13414         "peh": {
13415           "normal": [
13416             "\u067E"
13417           ],
13418           "small_meem_above": [
13419             "\u08B7"
13420           ],
13421           "isolated": "\uFB56",
13422           "final": "\uFB57",
13423           "initial": "\uFB58",
13424           "medial": "\uFB59"
13425         },
13426         "teheh": {
13427           "normal": [
13428             "\u067F"
13429           ],
13430           "isolated": "\uFB62",
13431           "final": "\uFB63",
13432           "initial": "\uFB64",
13433           "medial": "\uFB65"
13434         },
13435         "beheh": {
13436           "normal": [
13437             "\u0680"
13438           ],
13439           "isolated": "\uFB5A",
13440           "final": "\uFB5B",
13441           "initial": "\uFB5C",
13442           "medial": "\uFB5D"
13443         },
13444         "nyeh": {
13445           "normal": [
13446             "\u0683"
13447           ],
13448           "isolated": "\uFB76",
13449           "final": "\uFB77",
13450           "initial": "\uFB78",
13451           "medial": "\uFB79"
13452         },
13453         "dyeh": {
13454           "normal": [
13455             "\u0684"
13456           ],
13457           "isolated": "\uFB72",
13458           "final": "\uFB73",
13459           "initial": "\uFB74",
13460           "medial": "\uFB75"
13461         },
13462         "tcheh": {
13463           "normal": [
13464             "\u0686"
13465           ],
13466           "dot_above": [
13467             "\u06BF"
13468           ],
13469           "isolated": "\uFB7A",
13470           "final": "\uFB7B",
13471           "initial": "\uFB7C",
13472           "medial": "\uFB7D"
13473         },
13474         "tcheheh": {
13475           "normal": [
13476             "\u0687"
13477           ],
13478           "isolated": "\uFB7E",
13479           "final": "\uFB7F",
13480           "initial": "\uFB80",
13481           "medial": "\uFB81"
13482         },
13483         "ddal": {
13484           "normal": [
13485             "\u0688"
13486           ],
13487           "isolated": "\uFB88",
13488           "final": "\uFB89"
13489         },
13490         "dahal": {
13491           "normal": [
13492             "\u068C"
13493           ],
13494           "isolated": "\uFB84",
13495           "final": "\uFB85"
13496         },
13497         "ddahal": {
13498           "normal": [
13499             "\u068D"
13500           ],
13501           "isolated": "\uFB82",
13502           "final": "\uFB83"
13503         },
13504         "dul": {
13505           "normal": [
13506             "\u068F",
13507             "\u068E"
13508           ],
13509           "isolated": "\uFB86",
13510           "final": "\uFB87"
13511         },
13512         "rreh": {
13513           "normal": [
13514             "\u0691"
13515           ],
13516           "isolated": "\uFB8C",
13517           "final": "\uFB8D"
13518         },
13519         "jeh": {
13520           "normal": [
13521             "\u0698"
13522           ],
13523           "isolated": "\uFB8A",
13524           "final": "\uFB8B"
13525         },
13526         "veh": {
13527           "normal": [
13528             "\u06A4"
13529           ],
13530           "isolated": "\uFB6A",
13531           "final": "\uFB6B",
13532           "initial": "\uFB6C",
13533           "medial": "\uFB6D"
13534         },
13535         "peheh": {
13536           "normal": [
13537             "\u06A6"
13538           ],
13539           "isolated": "\uFB6E",
13540           "final": "\uFB6F",
13541           "initial": "\uFB70",
13542           "medial": "\uFB71"
13543         },
13544         "keheh": {
13545           "normal": [
13546             "\u06A9"
13547           ],
13548           "dot_above": [
13549             "\u0762"
13550           ],
13551           "three_dots_above": [
13552             "\u0763"
13553           ],
13554           "three_dots_pointing_upwards_below": [
13555             "\u0764"
13556           ],
13557           "isolated": "\uFB8E",
13558           "final": "\uFB8F",
13559           "initial": "\uFB90",
13560           "medial": "\uFB91"
13561         },
13562         "ng": {
13563           "normal": [
13564             "\u06AD"
13565           ],
13566           "isolated": "\uFBD3",
13567           "final": "\uFBD4",
13568           "initial": "\uFBD5",
13569           "medial": "\uFBD6"
13570         },
13571         "gaf": {
13572           "normal": [
13573             "\u06AF"
13574           ],
13575           "ring": [
13576             "\u06B0"
13577           ],
13578           "two_dots_below": [
13579             "\u06B2"
13580           ],
13581           "three_dots_above": [
13582             "\u06B4"
13583           ],
13584           "inverted_stroke": [
13585             "\u08B0"
13586           ],
13587           "isolated": "\uFB92",
13588           "final": "\uFB93",
13589           "initial": "\uFB94",
13590           "medial": "\uFB95"
13591         },
13592         "ngoeh": {
13593           "normal": [
13594             "\u06B1"
13595           ],
13596           "isolated": "\uFB9A",
13597           "final": "\uFB9B",
13598           "initial": "\uFB9C",
13599           "medial": "\uFB9D"
13600         },
13601         "gueh": {
13602           "normal": [
13603             "\u06B3"
13604           ],
13605           "isolated": "\uFB96",
13606           "final": "\uFB97",
13607           "initial": "\uFB98",
13608           "medial": "\uFB99"
13609         },
13610         "noon ghunna": {
13611           "normal": [
13612             "\u06BA"
13613           ],
13614           "isolated": "\uFB9E",
13615           "final": "\uFB9F"
13616         },
13617         "rnoon": {
13618           "normal": [
13619             "\u06BB"
13620           ],
13621           "isolated": "\uFBA0",
13622           "final": "\uFBA1",
13623           "initial": "\uFBA2",
13624           "medial": "\uFBA3"
13625         },
13626         "heh doachashmee": {
13627           "normal": [
13628             "\u06BE"
13629           ],
13630           "isolated": "\uFBAA",
13631           "final": "\uFBAB",
13632           "initial": "\uFBAC",
13633           "medial": "\uFBAD"
13634         },
13635         "heh goal": {
13636           "normal": [
13637             "\u06C1"
13638           ],
13639           "hamza_above": [
13640             "\u06C1\u0654",
13641             "\u06C2"
13642           ],
13643           "isolated": "\uFBA6",
13644           "final": "\uFBA7",
13645           "initial": "\uFBA8",
13646           "medial": "\uFBA9"
13647         },
13648         "teh marbuta goal": {
13649           "normal": [
13650             "\u06C3"
13651           ]
13652         },
13653         "kirghiz oe": {
13654           "normal": [
13655             "\u06C5"
13656           ],
13657           "isolated": "\uFBE0",
13658           "final": "\uFBE1"
13659         },
13660         "oe": {
13661           "normal": [
13662             "\u06C6"
13663           ],
13664           "isolated": "\uFBD9",
13665           "final": "\uFBDA"
13666         },
13667         "u": {
13668           "normal": [
13669             "\u06C7"
13670           ],
13671           "hamza_above": {
13672             "normal": [
13673               "\u0677",
13674               "\u06C7\u0674"
13675             ],
13676             "isolated": "\uFBDD"
13677           },
13678           "isolated": "\uFBD7",
13679           "final": "\uFBD8"
13680         },
13681         "yu": {
13682           "normal": [
13683             "\u06C8"
13684           ],
13685           "isolated": "\uFBDB",
13686           "final": "\uFBDC"
13687         },
13688         "kirghiz yu": {
13689           "normal": [
13690             "\u06C9"
13691           ],
13692           "isolated": "\uFBE2",
13693           "final": "\uFBE3"
13694         },
13695         "ve": {
13696           "normal": [
13697             "\u06CB"
13698           ],
13699           "isolated": "\uFBDE",
13700           "final": "\uFBDF"
13701         },
13702         "farsi yeh": {
13703           "normal": [
13704             "\u06CC"
13705           ],
13706           "indic_two_above": [
13707             "\u0775"
13708           ],
13709           "indic_three_above": [
13710             "\u0776"
13711           ],
13712           "indic_four_above": [
13713             "\u0777"
13714           ],
13715           "isolated": "\uFBFC",
13716           "final": "\uFBFD",
13717           "initial": "\uFBFE",
13718           "medial": "\uFBFF"
13719         },
13720         "e": {
13721           "normal": [
13722             "\u06D0"
13723           ],
13724           "isolated": "\uFBE4",
13725           "final": "\uFBE5",
13726           "initial": "\uFBE6",
13727           "medial": "\uFBE7"
13728         },
13729         "yeh barree": {
13730           "normal": [
13731             "\u06D2"
13732           ],
13733           "hamza_above": {
13734             "normal": [
13735               "\u06D2\u0654",
13736               "\u06D3"
13737             ],
13738             "isolated": "\uFBB0",
13739             "final": "\uFBB1"
13740           },
13741           "indic_two_above": [
13742             "\u077A"
13743           ],
13744           "indic_three_above": [
13745             "\u077B"
13746           ],
13747           "isolated": "\uFBAE",
13748           "final": "\uFBAF"
13749         },
13750         "ae": {
13751           "normal": [
13752             "\u06D5"
13753           ],
13754           "isolated": "\u06D5",
13755           "final": "\uFEEA",
13756           "yeh_above": {
13757             "normal": [
13758               "\u06C0",
13759               "\u06D5\u0654"
13760             ],
13761             "isolated": "\uFBA4",
13762             "final": "\uFBA5"
13763           }
13764         },
13765         "rohingya yeh": {
13766           "normal": [
13767             "\u08AC"
13768           ]
13769         },
13770         "low alef": {
13771           "normal": [
13772             "\u08AD"
13773           ]
13774         },
13775         "straight waw": {
13776           "normal": [
13777             "\u08B1"
13778           ]
13779         },
13780         "african feh": {
13781           "normal": [
13782             "\u08BB"
13783           ]
13784         },
13785         "african qaf": {
13786           "normal": [
13787             "\u08BC"
13788           ]
13789         },
13790         "african noon": {
13791           "normal": [
13792             "\u08BD"
13793           ]
13794         }
13795       };
13796       exports2.default = arabicReference;
13797     }
13798   });
13799
13800   // node_modules/alif-toolkit/lib/unicode-ligatures.js
13801   var require_unicode_ligatures = __commonJS({
13802     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
13803       "use strict";
13804       Object.defineProperty(exports2, "__esModule", { value: true });
13805       var ligatureReference = {
13806         "\u0626\u0627": {
13807           "isolated": "\uFBEA",
13808           "final": "\uFBEB"
13809         },
13810         "\u0626\u06D5": {
13811           "isolated": "\uFBEC",
13812           "final": "\uFBED"
13813         },
13814         "\u0626\u0648": {
13815           "isolated": "\uFBEE",
13816           "final": "\uFBEF"
13817         },
13818         "\u0626\u06C7": {
13819           "isolated": "\uFBF0",
13820           "final": "\uFBF1"
13821         },
13822         "\u0626\u06C6": {
13823           "isolated": "\uFBF2",
13824           "final": "\uFBF3"
13825         },
13826         "\u0626\u06C8": {
13827           "isolated": "\uFBF4",
13828           "final": "\uFBF5"
13829         },
13830         "\u0626\u06D0": {
13831           "isolated": "\uFBF6",
13832           "final": "\uFBF7",
13833           "initial": "\uFBF8"
13834         },
13835         "\u0626\u0649": {
13836           "uighur_kirghiz": {
13837             "isolated": "\uFBF9",
13838             "final": "\uFBFA",
13839             "initial": "\uFBFB"
13840           },
13841           "isolated": "\uFC03",
13842           "final": "\uFC68"
13843         },
13844         "\u0626\u062C": {
13845           "isolated": "\uFC00",
13846           "initial": "\uFC97"
13847         },
13848         "\u0626\u062D": {
13849           "isolated": "\uFC01",
13850           "initial": "\uFC98"
13851         },
13852         "\u0626\u0645": {
13853           "isolated": "\uFC02",
13854           "final": "\uFC66",
13855           "initial": "\uFC9A",
13856           "medial": "\uFCDF"
13857         },
13858         "\u0626\u064A": {
13859           "isolated": "\uFC04",
13860           "final": "\uFC69"
13861         },
13862         "\u0628\u062C": {
13863           "isolated": "\uFC05",
13864           "initial": "\uFC9C"
13865         },
13866         "\u0628\u062D": {
13867           "isolated": "\uFC06",
13868           "initial": "\uFC9D"
13869         },
13870         "\u0628\u062E": {
13871           "isolated": "\uFC07",
13872           "initial": "\uFC9E"
13873         },
13874         "\u0628\u0645": {
13875           "isolated": "\uFC08",
13876           "final": "\uFC6C",
13877           "initial": "\uFC9F",
13878           "medial": "\uFCE1"
13879         },
13880         "\u0628\u0649": {
13881           "isolated": "\uFC09",
13882           "final": "\uFC6E"
13883         },
13884         "\u0628\u064A": {
13885           "isolated": "\uFC0A",
13886           "final": "\uFC6F"
13887         },
13888         "\u062A\u062C": {
13889           "isolated": "\uFC0B",
13890           "initial": "\uFCA1"
13891         },
13892         "\u062A\u062D": {
13893           "isolated": "\uFC0C",
13894           "initial": "\uFCA2"
13895         },
13896         "\u062A\u062E": {
13897           "isolated": "\uFC0D",
13898           "initial": "\uFCA3"
13899         },
13900         "\u062A\u0645": {
13901           "isolated": "\uFC0E",
13902           "final": "\uFC72",
13903           "initial": "\uFCA4",
13904           "medial": "\uFCE3"
13905         },
13906         "\u062A\u0649": {
13907           "isolated": "\uFC0F",
13908           "final": "\uFC74"
13909         },
13910         "\u062A\u064A": {
13911           "isolated": "\uFC10",
13912           "final": "\uFC75"
13913         },
13914         "\u062B\u062C": {
13915           "isolated": "\uFC11"
13916         },
13917         "\u062B\u0645": {
13918           "isolated": "\uFC12",
13919           "final": "\uFC78",
13920           "initial": "\uFCA6",
13921           "medial": "\uFCE5"
13922         },
13923         "\u062B\u0649": {
13924           "isolated": "\uFC13",
13925           "final": "\uFC7A"
13926         },
13927         "\u062B\u0648": {
13928           "isolated": "\uFC14"
13929         },
13930         "\u062C\u062D": {
13931           "isolated": "\uFC15",
13932           "initial": "\uFCA7"
13933         },
13934         "\u062C\u0645": {
13935           "isolated": "\uFC16",
13936           "initial": "\uFCA8"
13937         },
13938         "\u062D\u062C": {
13939           "isolated": "\uFC17",
13940           "initial": "\uFCA9"
13941         },
13942         "\u062D\u0645": {
13943           "isolated": "\uFC18",
13944           "initial": "\uFCAA"
13945         },
13946         "\u062E\u062C": {
13947           "isolated": "\uFC19",
13948           "initial": "\uFCAB"
13949         },
13950         "\u062E\u062D": {
13951           "isolated": "\uFC1A"
13952         },
13953         "\u062E\u0645": {
13954           "isolated": "\uFC1B",
13955           "initial": "\uFCAC"
13956         },
13957         "\u0633\u062C": {
13958           "isolated": "\uFC1C",
13959           "initial": "\uFCAD",
13960           "medial": "\uFD34"
13961         },
13962         "\u0633\u062D": {
13963           "isolated": "\uFC1D",
13964           "initial": "\uFCAE",
13965           "medial": "\uFD35"
13966         },
13967         "\u0633\u062E": {
13968           "isolated": "\uFC1E",
13969           "initial": "\uFCAF",
13970           "medial": "\uFD36"
13971         },
13972         "\u0633\u0645": {
13973           "isolated": "\uFC1F",
13974           "initial": "\uFCB0",
13975           "medial": "\uFCE7"
13976         },
13977         "\u0635\u062D": {
13978           "isolated": "\uFC20",
13979           "initial": "\uFCB1"
13980         },
13981         "\u0635\u0645": {
13982           "isolated": "\uFC21",
13983           "initial": "\uFCB3"
13984         },
13985         "\u0636\u062C": {
13986           "isolated": "\uFC22",
13987           "initial": "\uFCB4"
13988         },
13989         "\u0636\u062D": {
13990           "isolated": "\uFC23",
13991           "initial": "\uFCB5"
13992         },
13993         "\u0636\u062E": {
13994           "isolated": "\uFC24",
13995           "initial": "\uFCB6"
13996         },
13997         "\u0636\u0645": {
13998           "isolated": "\uFC25",
13999           "initial": "\uFCB7"
14000         },
14001         "\u0637\u062D": {
14002           "isolated": "\uFC26",
14003           "initial": "\uFCB8"
14004         },
14005         "\u0637\u0645": {
14006           "isolated": "\uFC27",
14007           "initial": "\uFD33",
14008           "medial": "\uFD3A"
14009         },
14010         "\u0638\u0645": {
14011           "isolated": "\uFC28",
14012           "initial": "\uFCB9",
14013           "medial": "\uFD3B"
14014         },
14015         "\u0639\u062C": {
14016           "isolated": "\uFC29",
14017           "initial": "\uFCBA"
14018         },
14019         "\u0639\u0645": {
14020           "isolated": "\uFC2A",
14021           "initial": "\uFCBB"
14022         },
14023         "\u063A\u062C": {
14024           "isolated": "\uFC2B",
14025           "initial": "\uFCBC"
14026         },
14027         "\u063A\u0645": {
14028           "isolated": "\uFC2C",
14029           "initial": "\uFCBD"
14030         },
14031         "\u0641\u062C": {
14032           "isolated": "\uFC2D",
14033           "initial": "\uFCBE"
14034         },
14035         "\u0641\u062D": {
14036           "isolated": "\uFC2E",
14037           "initial": "\uFCBF"
14038         },
14039         "\u0641\u062E": {
14040           "isolated": "\uFC2F",
14041           "initial": "\uFCC0"
14042         },
14043         "\u0641\u0645": {
14044           "isolated": "\uFC30",
14045           "initial": "\uFCC1"
14046         },
14047         "\u0641\u0649": {
14048           "isolated": "\uFC31",
14049           "final": "\uFC7C"
14050         },
14051         "\u0641\u064A": {
14052           "isolated": "\uFC32",
14053           "final": "\uFC7D"
14054         },
14055         "\u0642\u062D": {
14056           "isolated": "\uFC33",
14057           "initial": "\uFCC2"
14058         },
14059         "\u0642\u0645": {
14060           "isolated": "\uFC34",
14061           "initial": "\uFCC3"
14062         },
14063         "\u0642\u0649": {
14064           "isolated": "\uFC35",
14065           "final": "\uFC7E"
14066         },
14067         "\u0642\u064A": {
14068           "isolated": "\uFC36",
14069           "final": "\uFC7F"
14070         },
14071         "\u0643\u0627": {
14072           "isolated": "\uFC37",
14073           "final": "\uFC80"
14074         },
14075         "\u0643\u062C": {
14076           "isolated": "\uFC38",
14077           "initial": "\uFCC4"
14078         },
14079         "\u0643\u062D": {
14080           "isolated": "\uFC39",
14081           "initial": "\uFCC5"
14082         },
14083         "\u0643\u062E": {
14084           "isolated": "\uFC3A",
14085           "initial": "\uFCC6"
14086         },
14087         "\u0643\u0644": {
14088           "isolated": "\uFC3B",
14089           "final": "\uFC81",
14090           "initial": "\uFCC7",
14091           "medial": "\uFCEB"
14092         },
14093         "\u0643\u0645": {
14094           "isolated": "\uFC3C",
14095           "final": "\uFC82",
14096           "initial": "\uFCC8",
14097           "medial": "\uFCEC"
14098         },
14099         "\u0643\u0649": {
14100           "isolated": "\uFC3D",
14101           "final": "\uFC83"
14102         },
14103         "\u0643\u064A": {
14104           "isolated": "\uFC3E",
14105           "final": "\uFC84"
14106         },
14107         "\u0644\u062C": {
14108           "isolated": "\uFC3F",
14109           "initial": "\uFCC9"
14110         },
14111         "\u0644\u062D": {
14112           "isolated": "\uFC40",
14113           "initial": "\uFCCA"
14114         },
14115         "\u0644\u062E": {
14116           "isolated": "\uFC41",
14117           "initial": "\uFCCB"
14118         },
14119         "\u0644\u0645": {
14120           "isolated": "\uFC42",
14121           "final": "\uFC85",
14122           "initial": "\uFCCC",
14123           "medial": "\uFCED"
14124         },
14125         "\u0644\u0649": {
14126           "isolated": "\uFC43",
14127           "final": "\uFC86"
14128         },
14129         "\u0644\u064A": {
14130           "isolated": "\uFC44",
14131           "final": "\uFC87"
14132         },
14133         "\u0645\u062C": {
14134           "isolated": "\uFC45",
14135           "initial": "\uFCCE"
14136         },
14137         "\u0645\u062D": {
14138           "isolated": "\uFC46",
14139           "initial": "\uFCCF"
14140         },
14141         "\u0645\u062E": {
14142           "isolated": "\uFC47",
14143           "initial": "\uFCD0"
14144         },
14145         "\u0645\u0645": {
14146           "isolated": "\uFC48",
14147           "final": "\uFC89",
14148           "initial": "\uFCD1"
14149         },
14150         "\u0645\u0649": {
14151           "isolated": "\uFC49"
14152         },
14153         "\u0645\u064A": {
14154           "isolated": "\uFC4A"
14155         },
14156         "\u0646\u062C": {
14157           "isolated": "\uFC4B",
14158           "initial": "\uFCD2"
14159         },
14160         "\u0646\u062D": {
14161           "isolated": "\uFC4C",
14162           "initial": "\uFCD3"
14163         },
14164         "\u0646\u062E": {
14165           "isolated": "\uFC4D",
14166           "initial": "\uFCD4"
14167         },
14168         "\u0646\u0645": {
14169           "isolated": "\uFC4E",
14170           "final": "\uFC8C",
14171           "initial": "\uFCD5",
14172           "medial": "\uFCEE"
14173         },
14174         "\u0646\u0649": {
14175           "isolated": "\uFC4F",
14176           "final": "\uFC8E"
14177         },
14178         "\u0646\u064A": {
14179           "isolated": "\uFC50",
14180           "final": "\uFC8F"
14181         },
14182         "\u0647\u062C": {
14183           "isolated": "\uFC51",
14184           "initial": "\uFCD7"
14185         },
14186         "\u0647\u0645": {
14187           "isolated": "\uFC52",
14188           "initial": "\uFCD8"
14189         },
14190         "\u0647\u0649": {
14191           "isolated": "\uFC53"
14192         },
14193         "\u0647\u064A": {
14194           "isolated": "\uFC54"
14195         },
14196         "\u064A\u062C": {
14197           "isolated": "\uFC55",
14198           "initial": "\uFCDA"
14199         },
14200         "\u064A\u062D": {
14201           "isolated": "\uFC56",
14202           "initial": "\uFCDB"
14203         },
14204         "\u064A\u062E": {
14205           "isolated": "\uFC57",
14206           "initial": "\uFCDC"
14207         },
14208         "\u064A\u0645": {
14209           "isolated": "\uFC58",
14210           "final": "\uFC93",
14211           "initial": "\uFCDD",
14212           "medial": "\uFCF0"
14213         },
14214         "\u064A\u0649": {
14215           "isolated": "\uFC59",
14216           "final": "\uFC95"
14217         },
14218         "\u064A\u064A": {
14219           "isolated": "\uFC5A",
14220           "final": "\uFC96"
14221         },
14222         "\u0630\u0670": {
14223           "isolated": "\uFC5B"
14224         },
14225         "\u0631\u0670": {
14226           "isolated": "\uFC5C"
14227         },
14228         "\u0649\u0670": {
14229           "isolated": "\uFC5D",
14230           "final": "\uFC90"
14231         },
14232         "\u064C\u0651": {
14233           "isolated": "\uFC5E"
14234         },
14235         "\u064D\u0651": {
14236           "isolated": "\uFC5F"
14237         },
14238         "\u064E\u0651": {
14239           "isolated": "\uFC60"
14240         },
14241         "\u064F\u0651": {
14242           "isolated": "\uFC61"
14243         },
14244         "\u0650\u0651": {
14245           "isolated": "\uFC62"
14246         },
14247         "\u0651\u0670": {
14248           "isolated": "\uFC63"
14249         },
14250         "\u0626\u0631": {
14251           "final": "\uFC64"
14252         },
14253         "\u0626\u0632": {
14254           "final": "\uFC65"
14255         },
14256         "\u0626\u0646": {
14257           "final": "\uFC67"
14258         },
14259         "\u0628\u0631": {
14260           "final": "\uFC6A"
14261         },
14262         "\u0628\u0632": {
14263           "final": "\uFC6B"
14264         },
14265         "\u0628\u0646": {
14266           "final": "\uFC6D"
14267         },
14268         "\u062A\u0631": {
14269           "final": "\uFC70"
14270         },
14271         "\u062A\u0632": {
14272           "final": "\uFC71"
14273         },
14274         "\u062A\u0646": {
14275           "final": "\uFC73"
14276         },
14277         "\u062B\u0631": {
14278           "final": "\uFC76"
14279         },
14280         "\u062B\u0632": {
14281           "final": "\uFC77"
14282         },
14283         "\u062B\u0646": {
14284           "final": "\uFC79"
14285         },
14286         "\u062B\u064A": {
14287           "final": "\uFC7B"
14288         },
14289         "\u0645\u0627": {
14290           "final": "\uFC88"
14291         },
14292         "\u0646\u0631": {
14293           "final": "\uFC8A"
14294         },
14295         "\u0646\u0632": {
14296           "final": "\uFC8B"
14297         },
14298         "\u0646\u0646": {
14299           "final": "\uFC8D"
14300         },
14301         "\u064A\u0631": {
14302           "final": "\uFC91"
14303         },
14304         "\u064A\u0632": {
14305           "final": "\uFC92"
14306         },
14307         "\u064A\u0646": {
14308           "final": "\uFC94"
14309         },
14310         "\u0626\u062E": {
14311           "initial": "\uFC99"
14312         },
14313         "\u0626\u0647": {
14314           "initial": "\uFC9B",
14315           "medial": "\uFCE0"
14316         },
14317         "\u0628\u0647": {
14318           "initial": "\uFCA0",
14319           "medial": "\uFCE2"
14320         },
14321         "\u062A\u0647": {
14322           "initial": "\uFCA5",
14323           "medial": "\uFCE4"
14324         },
14325         "\u0635\u062E": {
14326           "initial": "\uFCB2"
14327         },
14328         "\u0644\u0647": {
14329           "initial": "\uFCCD"
14330         },
14331         "\u0646\u0647": {
14332           "initial": "\uFCD6",
14333           "medial": "\uFCEF"
14334         },
14335         "\u0647\u0670": {
14336           "initial": "\uFCD9"
14337         },
14338         "\u064A\u0647": {
14339           "initial": "\uFCDE",
14340           "medial": "\uFCF1"
14341         },
14342         "\u062B\u0647": {
14343           "medial": "\uFCE6"
14344         },
14345         "\u0633\u0647": {
14346           "medial": "\uFCE8",
14347           "initial": "\uFD31"
14348         },
14349         "\u0634\u0645": {
14350           "medial": "\uFCE9",
14351           "isolated": "\uFD0C",
14352           "final": "\uFD28",
14353           "initial": "\uFD30"
14354         },
14355         "\u0634\u0647": {
14356           "medial": "\uFCEA",
14357           "initial": "\uFD32"
14358         },
14359         "\u0640\u064E\u0651": {
14360           "medial": "\uFCF2"
14361         },
14362         "\u0640\u064F\u0651": {
14363           "medial": "\uFCF3"
14364         },
14365         "\u0640\u0650\u0651": {
14366           "medial": "\uFCF4"
14367         },
14368         "\u0637\u0649": {
14369           "isolated": "\uFCF5",
14370           "final": "\uFD11"
14371         },
14372         "\u0637\u064A": {
14373           "isolated": "\uFCF6",
14374           "final": "\uFD12"
14375         },
14376         "\u0639\u0649": {
14377           "isolated": "\uFCF7",
14378           "final": "\uFD13"
14379         },
14380         "\u0639\u064A": {
14381           "isolated": "\uFCF8",
14382           "final": "\uFD14"
14383         },
14384         "\u063A\u0649": {
14385           "isolated": "\uFCF9",
14386           "final": "\uFD15"
14387         },
14388         "\u063A\u064A": {
14389           "isolated": "\uFCFA",
14390           "final": "\uFD16"
14391         },
14392         "\u0633\u0649": {
14393           "isolated": "\uFCFB"
14394         },
14395         "\u0633\u064A": {
14396           "isolated": "\uFCFC",
14397           "final": "\uFD18"
14398         },
14399         "\u0634\u0649": {
14400           "isolated": "\uFCFD",
14401           "final": "\uFD19"
14402         },
14403         "\u0634\u064A": {
14404           "isolated": "\uFCFE",
14405           "final": "\uFD1A"
14406         },
14407         "\u062D\u0649": {
14408           "isolated": "\uFCFF",
14409           "final": "\uFD1B"
14410         },
14411         "\u062D\u064A": {
14412           "isolated": "\uFD00",
14413           "final": "\uFD1C"
14414         },
14415         "\u062C\u0649": {
14416           "isolated": "\uFD01",
14417           "final": "\uFD1D"
14418         },
14419         "\u062C\u064A": {
14420           "isolated": "\uFD02",
14421           "final": "\uFD1E"
14422         },
14423         "\u062E\u0649": {
14424           "isolated": "\uFD03",
14425           "final": "\uFD1F"
14426         },
14427         "\u062E\u064A": {
14428           "isolated": "\uFD04",
14429           "final": "\uFD20"
14430         },
14431         "\u0635\u0649": {
14432           "isolated": "\uFD05",
14433           "final": "\uFD21"
14434         },
14435         "\u0635\u064A": {
14436           "isolated": "\uFD06",
14437           "final": "\uFD22"
14438         },
14439         "\u0636\u0649": {
14440           "isolated": "\uFD07",
14441           "final": "\uFD23"
14442         },
14443         "\u0636\u064A": {
14444           "isolated": "\uFD08",
14445           "final": "\uFD24"
14446         },
14447         "\u0634\u062C": {
14448           "isolated": "\uFD09",
14449           "final": "\uFD25",
14450           "initial": "\uFD2D",
14451           "medial": "\uFD37"
14452         },
14453         "\u0634\u062D": {
14454           "isolated": "\uFD0A",
14455           "final": "\uFD26",
14456           "initial": "\uFD2E",
14457           "medial": "\uFD38"
14458         },
14459         "\u0634\u062E": {
14460           "isolated": "\uFD0B",
14461           "final": "\uFD27",
14462           "initial": "\uFD2F",
14463           "medial": "\uFD39"
14464         },
14465         "\u0634\u0631": {
14466           "isolated": "\uFD0D",
14467           "final": "\uFD29"
14468         },
14469         "\u0633\u0631": {
14470           "isolated": "\uFD0E",
14471           "final": "\uFD2A"
14472         },
14473         "\u0635\u0631": {
14474           "isolated": "\uFD0F",
14475           "final": "\uFD2B"
14476         },
14477         "\u0636\u0631": {
14478           "isolated": "\uFD10",
14479           "final": "\uFD2C"
14480         },
14481         "\u0633\u0639": {
14482           "final": "\uFD17"
14483         },
14484         "\u062A\u062C\u0645": {
14485           "initial": "\uFD50"
14486         },
14487         "\u062A\u062D\u062C": {
14488           "final": "\uFD51",
14489           "initial": "\uFD52"
14490         },
14491         "\u062A\u062D\u0645": {
14492           "initial": "\uFD53"
14493         },
14494         "\u062A\u062E\u0645": {
14495           "initial": "\uFD54"
14496         },
14497         "\u062A\u0645\u062C": {
14498           "initial": "\uFD55"
14499         },
14500         "\u062A\u0645\u062D": {
14501           "initial": "\uFD56"
14502         },
14503         "\u062A\u0645\u062E": {
14504           "initial": "\uFD57"
14505         },
14506         "\u062C\u0645\u062D": {
14507           "final": "\uFD58",
14508           "initial": "\uFD59"
14509         },
14510         "\u062D\u0645\u064A": {
14511           "final": "\uFD5A"
14512         },
14513         "\u062D\u0645\u0649": {
14514           "final": "\uFD5B"
14515         },
14516         "\u0633\u062D\u062C": {
14517           "initial": "\uFD5C"
14518         },
14519         "\u0633\u062C\u062D": {
14520           "initial": "\uFD5D"
14521         },
14522         "\u0633\u062C\u0649": {
14523           "final": "\uFD5E"
14524         },
14525         "\u0633\u0645\u062D": {
14526           "final": "\uFD5F",
14527           "initial": "\uFD60"
14528         },
14529         "\u0633\u0645\u062C": {
14530           "initial": "\uFD61"
14531         },
14532         "\u0633\u0645\u0645": {
14533           "final": "\uFD62",
14534           "initial": "\uFD63"
14535         },
14536         "\u0635\u062D\u062D": {
14537           "final": "\uFD64",
14538           "initial": "\uFD65"
14539         },
14540         "\u0635\u0645\u0645": {
14541           "final": "\uFD66",
14542           "initial": "\uFDC5"
14543         },
14544         "\u0634\u062D\u0645": {
14545           "final": "\uFD67",
14546           "initial": "\uFD68"
14547         },
14548         "\u0634\u062C\u064A": {
14549           "final": "\uFD69"
14550         },
14551         "\u0634\u0645\u062E": {
14552           "final": "\uFD6A",
14553           "initial": "\uFD6B"
14554         },
14555         "\u0634\u0645\u0645": {
14556           "final": "\uFD6C",
14557           "initial": "\uFD6D"
14558         },
14559         "\u0636\u062D\u0649": {
14560           "final": "\uFD6E"
14561         },
14562         "\u0636\u062E\u0645": {
14563           "final": "\uFD6F",
14564           "initial": "\uFD70"
14565         },
14566         "\u0636\u0645\u062D": {
14567           "final": "\uFD71"
14568         },
14569         "\u0637\u0645\u062D": {
14570           "initial": "\uFD72"
14571         },
14572         "\u0637\u0645\u0645": {
14573           "initial": "\uFD73"
14574         },
14575         "\u0637\u0645\u064A": {
14576           "final": "\uFD74"
14577         },
14578         "\u0639\u062C\u0645": {
14579           "final": "\uFD75",
14580           "initial": "\uFDC4"
14581         },
14582         "\u0639\u0645\u0645": {
14583           "final": "\uFD76",
14584           "initial": "\uFD77"
14585         },
14586         "\u0639\u0645\u0649": {
14587           "final": "\uFD78"
14588         },
14589         "\u063A\u0645\u0645": {
14590           "final": "\uFD79"
14591         },
14592         "\u063A\u0645\u064A": {
14593           "final": "\uFD7A"
14594         },
14595         "\u063A\u0645\u0649": {
14596           "final": "\uFD7B"
14597         },
14598         "\u0641\u062E\u0645": {
14599           "final": "\uFD7C",
14600           "initial": "\uFD7D"
14601         },
14602         "\u0642\u0645\u062D": {
14603           "final": "\uFD7E",
14604           "initial": "\uFDB4"
14605         },
14606         "\u0642\u0645\u0645": {
14607           "final": "\uFD7F"
14608         },
14609         "\u0644\u062D\u0645": {
14610           "final": "\uFD80",
14611           "initial": "\uFDB5"
14612         },
14613         "\u0644\u062D\u064A": {
14614           "final": "\uFD81"
14615         },
14616         "\u0644\u062D\u0649": {
14617           "final": "\uFD82"
14618         },
14619         "\u0644\u062C\u062C": {
14620           "initial": "\uFD83",
14621           "final": "\uFD84"
14622         },
14623         "\u0644\u062E\u0645": {
14624           "final": "\uFD85",
14625           "initial": "\uFD86"
14626         },
14627         "\u0644\u0645\u062D": {
14628           "final": "\uFD87",
14629           "initial": "\uFD88"
14630         },
14631         "\u0645\u062D\u062C": {
14632           "initial": "\uFD89"
14633         },
14634         "\u0645\u062D\u0645": {
14635           "initial": "\uFD8A"
14636         },
14637         "\u0645\u062D\u064A": {
14638           "final": "\uFD8B"
14639         },
14640         "\u0645\u062C\u062D": {
14641           "initial": "\uFD8C"
14642         },
14643         "\u0645\u062C\u0645": {
14644           "initial": "\uFD8D"
14645         },
14646         "\u0645\u062E\u062C": {
14647           "initial": "\uFD8E"
14648         },
14649         "\u0645\u062E\u0645": {
14650           "initial": "\uFD8F"
14651         },
14652         "\u0645\u062C\u062E": {
14653           "initial": "\uFD92"
14654         },
14655         "\u0647\u0645\u062C": {
14656           "initial": "\uFD93"
14657         },
14658         "\u0647\u0645\u0645": {
14659           "initial": "\uFD94"
14660         },
14661         "\u0646\u062D\u0645": {
14662           "initial": "\uFD95"
14663         },
14664         "\u0646\u062D\u0649": {
14665           "final": "\uFD96"
14666         },
14667         "\u0646\u062C\u0645": {
14668           "final": "\uFD97",
14669           "initial": "\uFD98"
14670         },
14671         "\u0646\u062C\u0649": {
14672           "final": "\uFD99"
14673         },
14674         "\u0646\u0645\u064A": {
14675           "final": "\uFD9A"
14676         },
14677         "\u0646\u0645\u0649": {
14678           "final": "\uFD9B"
14679         },
14680         "\u064A\u0645\u0645": {
14681           "final": "\uFD9C",
14682           "initial": "\uFD9D"
14683         },
14684         "\u0628\u062E\u064A": {
14685           "final": "\uFD9E"
14686         },
14687         "\u062A\u062C\u064A": {
14688           "final": "\uFD9F"
14689         },
14690         "\u062A\u062C\u0649": {
14691           "final": "\uFDA0"
14692         },
14693         "\u062A\u062E\u064A": {
14694           "final": "\uFDA1"
14695         },
14696         "\u062A\u062E\u0649": {
14697           "final": "\uFDA2"
14698         },
14699         "\u062A\u0645\u064A": {
14700           "final": "\uFDA3"
14701         },
14702         "\u062A\u0645\u0649": {
14703           "final": "\uFDA4"
14704         },
14705         "\u062C\u0645\u064A": {
14706           "final": "\uFDA5"
14707         },
14708         "\u062C\u062D\u0649": {
14709           "final": "\uFDA6"
14710         },
14711         "\u062C\u0645\u0649": {
14712           "final": "\uFDA7"
14713         },
14714         "\u0633\u062E\u0649": {
14715           "final": "\uFDA8"
14716         },
14717         "\u0635\u062D\u064A": {
14718           "final": "\uFDA9"
14719         },
14720         "\u0634\u062D\u064A": {
14721           "final": "\uFDAA"
14722         },
14723         "\u0636\u062D\u064A": {
14724           "final": "\uFDAB"
14725         },
14726         "\u0644\u062C\u064A": {
14727           "final": "\uFDAC"
14728         },
14729         "\u0644\u0645\u064A": {
14730           "final": "\uFDAD"
14731         },
14732         "\u064A\u062D\u064A": {
14733           "final": "\uFDAE"
14734         },
14735         "\u064A\u062C\u064A": {
14736           "final": "\uFDAF"
14737         },
14738         "\u064A\u0645\u064A": {
14739           "final": "\uFDB0"
14740         },
14741         "\u0645\u0645\u064A": {
14742           "final": "\uFDB1"
14743         },
14744         "\u0642\u0645\u064A": {
14745           "final": "\uFDB2"
14746         },
14747         "\u0646\u062D\u064A": {
14748           "final": "\uFDB3"
14749         },
14750         "\u0639\u0645\u064A": {
14751           "final": "\uFDB6"
14752         },
14753         "\u0643\u0645\u064A": {
14754           "final": "\uFDB7"
14755         },
14756         "\u0646\u062C\u062D": {
14757           "initial": "\uFDB8",
14758           "final": "\uFDBD"
14759         },
14760         "\u0645\u062E\u064A": {
14761           "final": "\uFDB9"
14762         },
14763         "\u0644\u062C\u0645": {
14764           "initial": "\uFDBA",
14765           "final": "\uFDBC"
14766         },
14767         "\u0643\u0645\u0645": {
14768           "final": "\uFDBB",
14769           "initial": "\uFDC3"
14770         },
14771         "\u062C\u062D\u064A": {
14772           "final": "\uFDBE"
14773         },
14774         "\u062D\u062C\u064A": {
14775           "final": "\uFDBF"
14776         },
14777         "\u0645\u062C\u064A": {
14778           "final": "\uFDC0"
14779         },
14780         "\u0641\u0645\u064A": {
14781           "final": "\uFDC1"
14782         },
14783         "\u0628\u062D\u064A": {
14784           "final": "\uFDC2"
14785         },
14786         "\u0633\u062E\u064A": {
14787           "final": "\uFDC6"
14788         },
14789         "\u0646\u062C\u064A": {
14790           "final": "\uFDC7"
14791         },
14792         "\u0644\u0622": {
14793           "isolated": "\uFEF5",
14794           "final": "\uFEF6"
14795         },
14796         "\u0644\u0623": {
14797           "isolated": "\uFEF7",
14798           "final": "\uFEF8"
14799         },
14800         "\u0644\u0625": {
14801           "isolated": "\uFEF9",
14802           "final": "\uFEFA"
14803         },
14804         "\u0644\u0627": {
14805           "isolated": "\uFEFB",
14806           "final": "\uFEFC"
14807         },
14808         "words": {
14809           "\u0635\u0644\u06D2": "\uFDF0",
14810           "\u0642\u0644\u06D2": "\uFDF1",
14811           "\u0627\u0644\u0644\u0647": "\uFDF2",
14812           "\u0627\u0643\u0628\u0631": "\uFDF3",
14813           "\u0645\u062D\u0645\u062F": "\uFDF4",
14814           "\u0635\u0644\u0639\u0645": "\uFDF5",
14815           "\u0631\u0633\u0648\u0644": "\uFDF6",
14816           "\u0639\u0644\u064A\u0647": "\uFDF7",
14817           "\u0648\u0633\u0644\u0645": "\uFDF8",
14818           "\u0635\u0644\u0649": "\uFDF9",
14819           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
14820           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
14821           "\u0631\u06CC\u0627\u0644": "\uFDFC"
14822         }
14823       };
14824       exports2.default = ligatureReference;
14825     }
14826   });
14827
14828   // node_modules/alif-toolkit/lib/reference.js
14829   var require_reference = __commonJS({
14830     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
14831       "use strict";
14832       Object.defineProperty(exports2, "__esModule", { value: true });
14833       exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
14834       var unicode_arabic_1 = require_unicode_arabic();
14835       var unicode_ligatures_1 = require_unicode_ligatures();
14836       var letterList = Object.keys(unicode_arabic_1.default);
14837       exports2.letterList = letterList;
14838       var ligatureList = Object.keys(unicode_ligatures_1.default);
14839       exports2.ligatureList = ligatureList;
14840       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
14841       exports2.ligatureWordList = ligatureWordList;
14842       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
14843       exports2.lams = lams;
14844       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
14845       exports2.alefs = alefs;
14846       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
14847       exports2.tashkeel = tashkeel;
14848       function addToTashkeel(start2, finish) {
14849         for (var i3 = start2; i3 <= finish; i3++) {
14850           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
14851         }
14852       }
14853       addToTashkeel(1552, 1562);
14854       addToTashkeel(1611, 1631);
14855       addToTashkeel(1750, 1756);
14856       addToTashkeel(1760, 1764);
14857       addToTashkeel(1770, 1773);
14858       addToTashkeel(2259, 2273);
14859       addToTashkeel(2275, 2303);
14860       addToTashkeel(65136, 65151);
14861       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
14862       exports2.lineBreakers = lineBreakers;
14863       function addToLineBreakers(start2, finish) {
14864         for (var i3 = start2; i3 <= finish; i3++) {
14865           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
14866         }
14867       }
14868       addToLineBreakers(1536, 1567);
14869       addToLineBreakers(1569, 1573);
14870       addToLineBreakers(1583, 1586);
14871       addToLineBreakers(1632, 1645);
14872       addToLineBreakers(1649, 1655);
14873       addToLineBreakers(1672, 1689);
14874       addToLineBreakers(1731, 1739);
14875       addToLineBreakers(1746, 1785);
14876       addToLineBreakers(1881, 1883);
14877       addToLineBreakers(2218, 2222);
14878       addToLineBreakers(64336, 65021);
14879       addToLineBreakers(65152, 65276);
14880       addToLineBreakers(69216, 69247);
14881       addToLineBreakers(126064, 126143);
14882       addToLineBreakers(126464, 126719);
14883     }
14884   });
14885
14886   // node_modules/alif-toolkit/lib/GlyphSplitter.js
14887   var require_GlyphSplitter = __commonJS({
14888     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
14889       "use strict";
14890       Object.defineProperty(exports2, "__esModule", { value: true });
14891       exports2.GlyphSplitter = GlyphSplitter;
14892       var isArabic_1 = require_isArabic();
14893       var reference_1 = require_reference();
14894       function GlyphSplitter(word) {
14895         let letters = [];
14896         let lastLetter = "";
14897         word.split("").forEach((letter) => {
14898           if ((0, isArabic_1.isArabic)(letter)) {
14899             if (reference_1.tashkeel.indexOf(letter) > -1) {
14900               letters[letters.length - 1] += letter;
14901             } 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)) {
14902               letters[letters.length - 1] += letter;
14903             } else {
14904               letters.push(letter);
14905             }
14906           } else {
14907             letters.push(letter);
14908           }
14909           if (reference_1.tashkeel.indexOf(letter) === -1) {
14910             lastLetter = letter;
14911           }
14912         });
14913         return letters;
14914       }
14915     }
14916   });
14917
14918   // node_modules/alif-toolkit/lib/BaselineSplitter.js
14919   var require_BaselineSplitter = __commonJS({
14920     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
14921       "use strict";
14922       Object.defineProperty(exports2, "__esModule", { value: true });
14923       exports2.BaselineSplitter = BaselineSplitter;
14924       var isArabic_1 = require_isArabic();
14925       var reference_1 = require_reference();
14926       function BaselineSplitter(word) {
14927         let letters = [];
14928         let lastLetter = "";
14929         word.split("").forEach((letter) => {
14930           if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
14931             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
14932               letters[letters.length - 1] += letter;
14933             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
14934               letters.push(letter);
14935             } else {
14936               letters[letters.length - 1] += letter;
14937             }
14938           } else {
14939             letters.push(letter);
14940           }
14941           if (reference_1.tashkeel.indexOf(letter) === -1) {
14942             lastLetter = letter;
14943           }
14944         });
14945         return letters;
14946       }
14947     }
14948   });
14949
14950   // node_modules/alif-toolkit/lib/Normalization.js
14951   var require_Normalization = __commonJS({
14952     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
14953       "use strict";
14954       Object.defineProperty(exports2, "__esModule", { value: true });
14955       exports2.Normal = Normal;
14956       var unicode_arabic_1 = require_unicode_arabic();
14957       var unicode_ligatures_1 = require_unicode_ligatures();
14958       var isArabic_1 = require_isArabic();
14959       var reference_1 = require_reference();
14960       function Normal(word, breakPresentationForm) {
14961         if (typeof breakPresentationForm === "undefined") {
14962           breakPresentationForm = true;
14963         }
14964         let returnable = "";
14965         word.split("").forEach((letter) => {
14966           if (!(0, isArabic_1.isArabic)(letter)) {
14967             returnable += letter;
14968             return;
14969           }
14970           for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
14971             let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
14972             let versions = Object.keys(letterForms);
14973             for (let v3 = 0; v3 < versions.length; v3++) {
14974               let localVersion = letterForms[versions[v3]];
14975               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14976                 let embeddedForms = Object.keys(localVersion);
14977                 for (let ef = 0; ef < embeddedForms.length; ef++) {
14978                   let form = localVersion[embeddedForms[ef]];
14979                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14980                     if (form === letter) {
14981                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
14982                         if (typeof localVersion["normal"] === "object") {
14983                           returnable += localVersion["normal"][0];
14984                         } else {
14985                           returnable += localVersion["normal"];
14986                         }
14987                         return;
14988                       }
14989                       returnable += letter;
14990                       return;
14991                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14992                       returnable += form[0];
14993                       return;
14994                     }
14995                   }
14996                 }
14997               } else if (localVersion === letter) {
14998                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v3]) > -1) {
14999                   if (typeof letterForms["normal"] === "object") {
15000                     returnable += letterForms["normal"][0];
15001                   } else {
15002                     returnable += letterForms["normal"];
15003                   }
15004                   return;
15005                 }
15006                 returnable += letter;
15007                 return;
15008               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15009                 returnable += localVersion[0];
15010                 return;
15011               }
15012             }
15013           }
15014           for (let v22 = 0; v22 < reference_1.ligatureList.length; v22++) {
15015             let normalForm = reference_1.ligatureList[v22];
15016             if (normalForm !== "words") {
15017               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
15018               for (let f2 = 0; f2 < ligForms.length; f2++) {
15019                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
15020                   returnable += normalForm;
15021                   return;
15022                 }
15023               }
15024             }
15025           }
15026           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
15027             let normalForm = reference_1.ligatureWordList[v3];
15028             if (unicode_ligatures_1.default.words[normalForm] === letter) {
15029               returnable += normalForm;
15030               return;
15031             }
15032           }
15033           returnable += letter;
15034         });
15035         return returnable;
15036       }
15037     }
15038   });
15039
15040   // node_modules/alif-toolkit/lib/CharShaper.js
15041   var require_CharShaper = __commonJS({
15042     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
15043       "use strict";
15044       Object.defineProperty(exports2, "__esModule", { value: true });
15045       exports2.CharShaper = CharShaper;
15046       var unicode_arabic_1 = require_unicode_arabic();
15047       var isArabic_1 = require_isArabic();
15048       var reference_1 = require_reference();
15049       function CharShaper(letter, form) {
15050         if (!(0, isArabic_1.isArabic)(letter)) {
15051           throw new Error("Not Arabic");
15052         }
15053         if (letter === "\u0621") {
15054           return "\u0621";
15055         }
15056         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15057           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15058           let versions = Object.keys(letterForms);
15059           for (let v3 = 0; v3 < versions.length; v3++) {
15060             let localVersion = letterForms[versions[v3]];
15061             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15062               if (versions.indexOf(form) > -1) {
15063                 return letterForms[form];
15064               }
15065             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15066               let embeddedVersions = Object.keys(localVersion);
15067               for (let ev = 0; ev < embeddedVersions.length; ev++) {
15068                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
15069                   if (embeddedVersions.indexOf(form) > -1) {
15070                     return localVersion[form];
15071                   }
15072                 }
15073               }
15074             }
15075           }
15076         }
15077       }
15078     }
15079   });
15080
15081   // node_modules/alif-toolkit/lib/WordShaper.js
15082   var require_WordShaper = __commonJS({
15083     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
15084       "use strict";
15085       Object.defineProperty(exports2, "__esModule", { value: true });
15086       exports2.WordShaper = WordShaper2;
15087       var isArabic_1 = require_isArabic();
15088       var reference_1 = require_reference();
15089       var CharShaper_1 = require_CharShaper();
15090       var unicode_ligatures_1 = require_unicode_ligatures();
15091       function WordShaper2(word) {
15092         let state = "initial";
15093         let output = "";
15094         for (let w3 = 0; w3 < word.length; w3++) {
15095           let nextLetter = " ";
15096           for (let nxw = w3 + 1; nxw < word.length; nxw++) {
15097             if (!(0, isArabic_1.isArabic)(word[nxw])) {
15098               break;
15099             }
15100             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
15101               nextLetter = word[nxw];
15102               break;
15103             }
15104           }
15105           if (!(0, isArabic_1.isArabic)(word[w3]) || (0, isArabic_1.isMath)(word[w3])) {
15106             output += word[w3];
15107             state = "initial";
15108           } else if (reference_1.tashkeel.indexOf(word[w3]) > -1) {
15109             output += word[w3];
15110           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w3]) > -1) {
15111             output += (0, CharShaper_1.CharShaper)(word[w3], state === "initial" ? "isolated" : "final");
15112             state = "initial";
15113           } else if (reference_1.lams.indexOf(word[w3]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
15114             output += unicode_ligatures_1.default[word[w3] + nextLetter][state === "initial" ? "isolated" : "final"];
15115             while (word[w3] !== nextLetter) {
15116               w3++;
15117             }
15118             state = "initial";
15119           } else {
15120             output += (0, CharShaper_1.CharShaper)(word[w3], state);
15121             state = "medial";
15122           }
15123         }
15124         return output;
15125       }
15126     }
15127   });
15128
15129   // node_modules/alif-toolkit/lib/ParentLetter.js
15130   var require_ParentLetter = __commonJS({
15131     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
15132       "use strict";
15133       Object.defineProperty(exports2, "__esModule", { value: true });
15134       exports2.ParentLetter = ParentLetter;
15135       exports2.GrandparentLetter = GrandparentLetter;
15136       var unicode_arabic_1 = require_unicode_arabic();
15137       var isArabic_1 = require_isArabic();
15138       var reference_1 = require_reference();
15139       function ParentLetter(letter) {
15140         if (!(0, isArabic_1.isArabic)(letter)) {
15141           throw new Error("Not an Arabic letter");
15142         }
15143         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15144           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15145           let versions = Object.keys(letterForms);
15146           for (let v3 = 0; v3 < versions.length; v3++) {
15147             let localVersion = letterForms[versions[v3]];
15148             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15149               let embeddedForms = Object.keys(localVersion);
15150               for (let ef = 0; ef < embeddedForms.length; ef++) {
15151                 let form = localVersion[embeddedForms[ef]];
15152                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
15153                   return localVersion;
15154                 }
15155               }
15156             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15157               return letterForms;
15158             }
15159           }
15160           return null;
15161         }
15162       }
15163       function GrandparentLetter(letter) {
15164         if (!(0, isArabic_1.isArabic)(letter)) {
15165           throw new Error("Not an Arabic letter");
15166         }
15167         for (let w3 = 0; w3 < reference_1.letterList.length; w3++) {
15168           let letterForms = unicode_arabic_1.default[reference_1.letterList[w3]];
15169           let versions = Object.keys(letterForms);
15170           for (let v3 = 0; v3 < versions.length; v3++) {
15171             let localVersion = letterForms[versions[v3]];
15172             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
15173               let embeddedForms = Object.keys(localVersion);
15174               for (let ef = 0; ef < embeddedForms.length; ef++) {
15175                 let form = localVersion[embeddedForms[ef]];
15176                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
15177                   return letterForms;
15178                 }
15179               }
15180             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
15181               return letterForms;
15182             }
15183           }
15184           return null;
15185         }
15186       }
15187     }
15188   });
15189
15190   // node_modules/alif-toolkit/lib/index.js
15191   var require_lib = __commonJS({
15192     "node_modules/alif-toolkit/lib/index.js"(exports2) {
15193       "use strict";
15194       Object.defineProperty(exports2, "__esModule", { value: true });
15195       exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
15196       var isArabic_1 = require_isArabic();
15197       Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
15198         return isArabic_1.isArabic;
15199       } });
15200       var GlyphSplitter_1 = require_GlyphSplitter();
15201       Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
15202         return GlyphSplitter_1.GlyphSplitter;
15203       } });
15204       var BaselineSplitter_1 = require_BaselineSplitter();
15205       Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
15206         return BaselineSplitter_1.BaselineSplitter;
15207       } });
15208       var Normalization_1 = require_Normalization();
15209       Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
15210         return Normalization_1.Normal;
15211       } });
15212       var CharShaper_1 = require_CharShaper();
15213       Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
15214         return CharShaper_1.CharShaper;
15215       } });
15216       var WordShaper_1 = require_WordShaper();
15217       Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
15218         return WordShaper_1.WordShaper;
15219       } });
15220       var ParentLetter_1 = require_ParentLetter();
15221       Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
15222         return ParentLetter_1.ParentLetter;
15223       } });
15224       Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
15225         return ParentLetter_1.GrandparentLetter;
15226       } });
15227     }
15228   });
15229
15230   // modules/util/svg_paths_rtl_fix.js
15231   var svg_paths_rtl_fix_exports = {};
15232   __export(svg_paths_rtl_fix_exports, {
15233     fixRTLTextForSvg: () => fixRTLTextForSvg,
15234     rtlRegex: () => rtlRegex
15235   });
15236   function fixRTLTextForSvg(inputText) {
15237     var ret = "", rtlBuffer = [];
15238     var arabicRegex = /[\u0600-\u06FF]/g;
15239     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
15240     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
15241     var thaanaVowel = /[\u07A6-\u07B0]/;
15242     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
15243     if (arabicRegex.test(inputText)) {
15244       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
15245     }
15246     for (var n3 = 0; n3 < inputText.length; n3++) {
15247       var c2 = inputText[n3];
15248       if (arabicMath.test(c2)) {
15249         ret += rtlBuffer.reverse().join("");
15250         rtlBuffer = [c2];
15251       } else {
15252         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
15253           ret += rtlBuffer.reverse().join("");
15254           rtlBuffer = [];
15255         }
15256         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
15257           rtlBuffer[rtlBuffer.length - 1] += c2;
15258         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
15259           rtlBuffer.push(c2);
15260         } else if (c2 === " " && rtlBuffer.length) {
15261           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
15262         } else {
15263           ret += rtlBuffer.reverse().join("") + c2;
15264           rtlBuffer = [];
15265         }
15266       }
15267     }
15268     ret += rtlBuffer.reverse().join("");
15269     return ret;
15270   }
15271   var import_alif_toolkit, rtlRegex;
15272   var init_svg_paths_rtl_fix = __esm({
15273     "modules/util/svg_paths_rtl_fix.js"() {
15274       "use strict";
15275       import_alif_toolkit = __toESM(require_lib());
15276       rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
15277     }
15278   });
15279
15280   // node_modules/vparse/index.js
15281   var require_vparse = __commonJS({
15282     "node_modules/vparse/index.js"(exports2, module2) {
15283       (function(window2) {
15284         "use strict";
15285         function parseVersion3(v3) {
15286           var m3 = v3.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
15287           v3 = {
15288             major: +m3[0] || 0,
15289             minor: +m3[1] || 0,
15290             patch: +m3[2] || 0,
15291             build: +m3[3] || 0
15292           };
15293           v3.isEmpty = !v3.major && !v3.minor && !v3.patch && !v3.build;
15294           v3.parsed = [v3.major, v3.minor, v3.patch, v3.build];
15295           v3.text = v3.parsed.join(".");
15296           v3.compare = compare2;
15297           return v3;
15298         }
15299         function compare2(v3) {
15300           if (typeof v3 === "string") {
15301             v3 = parseVersion3(v3);
15302           }
15303           for (var i3 = 0; i3 < 4; i3++) {
15304             if (this.parsed[i3] !== v3.parsed[i3]) {
15305               return this.parsed[i3] > v3.parsed[i3] ? 1 : -1;
15306             }
15307           }
15308           return 0;
15309         }
15310         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
15311           module2.exports = parseVersion3;
15312         } else {
15313           window2.parseVersion = parseVersion3;
15314         }
15315       })(exports2);
15316     }
15317   });
15318
15319   // config/id.js
15320   var presetsCdnUrl, ociCdnUrl, wmfSitematrixCdnUrl, nsiCdnUrl, defaultOsmApiConnections, osmApiConnections, taginfoApiUrl, nominatimApiUrl, showDonationMessage;
15321   var init_id = __esm({
15322     "config/id.js"() {
15323       "use strict";
15324       presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
15325       ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
15326       wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
15327       nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
15328       defaultOsmApiConnections = {
15329         live: {
15330           url: "https://www.openstreetmap.org",
15331           apiUrl: "https://api.openstreetmap.org",
15332           client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
15333         },
15334         dev: {
15335           url: "https://api06.dev.openstreetmap.org",
15336           client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
15337         }
15338       };
15339       osmApiConnections = [];
15340       if (false) {
15341         osmApiConnections.push({
15342           url: null,
15343           apiUrl: null,
15344           client_id: null
15345         });
15346       } else if (false) {
15347         osmApiConnections.push(defaultOsmApiConnections[null]);
15348       } else {
15349         osmApiConnections.push(defaultOsmApiConnections.live);
15350         osmApiConnections.push(defaultOsmApiConnections.dev);
15351       }
15352       taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
15353       nominatimApiUrl = "https://nominatim.openstreetmap.org/";
15354       showDonationMessage = true;
15355     }
15356   });
15357
15358   // package.json
15359   var package_default;
15360   var init_package = __esm({
15361     "package.json"() {
15362       package_default = {
15363         name: "iD",
15364         version: "2.35.0",
15365         description: "A friendly editor for OpenStreetMap",
15366         main: "dist/iD.min.js",
15367         repository: "github:openstreetmap/iD",
15368         homepage: "https://github.com/openstreetmap/iD",
15369         bugs: "https://github.com/openstreetmap/iD/issues",
15370         keywords: [
15371           "editor",
15372           "openstreetmap"
15373         ],
15374         license: "ISC",
15375         scripts: {
15376           all: "run-s clean build dist",
15377           build: "run-s build:css build:data build:js",
15378           "build:css": "node scripts/build_css.js",
15379           "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
15380           "build:stats": "node config/esbuild.config.mjs --stats && esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html && shx rm dist/esbuild.json",
15381           "build:js": "node config/esbuild.config.mjs",
15382           "build:js:watch": "node config/esbuild.config.mjs --watch",
15383           clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
15384           dist: "run-p dist:**",
15385           "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
15386           "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
15387           "dist:min": "node config/esbuild.config.min.mjs",
15388           "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
15389           "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',
15390           "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
15391           "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',
15392           "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_signs/*.svg",
15393           "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_objects/*.svg",
15394           "dist:svg:roentgen": 'svg-sprite --shape-id-generator "roentgen-%s" --shape-dim-width 16 --shape-dim-height 16 --symbol --symbol-dest . --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg',
15395           "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg',
15396           imagery: "node scripts/update_imagery.js",
15397           lint: "eslint config scripts test/spec modules",
15398           "lint:fix": "eslint scripts test/spec modules --fix",
15399           start: "run-s start:watch",
15400           "start:single-build": "run-p build:js start:server",
15401           "start:watch": "run-p build:js:watch start:server",
15402           "start:server": "node scripts/server.js",
15403           test: "npm-run-all -s lint build test:spec",
15404           "test:spec": "vitest --no-isolate",
15405           translations: "node scripts/update_locales.js"
15406         },
15407         dependencies: {
15408           "@mapbox/geojson-area": "^0.2.2",
15409           "@mapbox/sexagesimal": "1.2.0",
15410           "@mapbox/vector-tile": "^2.0.4",
15411           "@rapideditor/country-coder": "~5.4.0",
15412           "@rapideditor/location-conflation": "~1.5.0",
15413           "@tmcw/togeojson": "^7.1.2",
15414           "@turf/bbox": "^7.2.0",
15415           "@turf/bbox-clip": "^7.2.0",
15416           "abortcontroller-polyfill": "^1.7.8",
15417           "aes-js": "^3.1.2",
15418           "alif-toolkit": "^1.3.0",
15419           "core-js-bundle": "^3.44.0",
15420           diacritics: "1.3.0",
15421           exifr: "^7.1.3",
15422           "fast-deep-equal": "~3.1.1",
15423           "fast-json-stable-stringify": "2.1.0",
15424           "lodash-es": "~4.17.15",
15425           marked: "~16.0.0",
15426           "node-diff3": "~3.1.0",
15427           "osm-auth": "^3.0.0",
15428           pannellum: "2.5.6",
15429           pbf: "^4.0.1",
15430           "polygon-clipping": "~0.15.7",
15431           rbush: "4.0.1",
15432           vitest: "^3.2.4",
15433           "whatwg-fetch": "^3.6.20",
15434           "which-polygon": "2.2.1"
15435         },
15436         devDependencies: {
15437           "@fortawesome/fontawesome-svg-core": "~6.7.2",
15438           "@fortawesome/free-brands-svg-icons": "~6.7.2",
15439           "@fortawesome/free-regular-svg-icons": "~6.7.2",
15440           "@fortawesome/free-solid-svg-icons": "~6.7.2",
15441           "@mapbox/maki": "^8.2.0",
15442           "@openstreetmap/id-tagging-schema": "^6.11.0",
15443           "@rapideditor/mapillary_sprite_source": "^1.8.0",
15444           "@rapideditor/temaki": "^5.9.0",
15445           "@transifex/api": "^7.1.4",
15446           "@types/chai": "^5.2.2",
15447           "@types/d3": "^7.4.3",
15448           "@types/geojson": "^7946.0.16",
15449           "@types/happen": "^0.3.0",
15450           "@types/lodash-es": "^4.17.12",
15451           "@types/node": "^24.0.10",
15452           "@types/sinon": "^17.0.4",
15453           "@types/sinon-chai": "^4.0.0",
15454           autoprefixer: "^10.4.21",
15455           browserslist: "^4.25.1",
15456           "browserslist-to-esbuild": "^2.1.1",
15457           chai: "^5.2.1",
15458           chalk: "^4.1.2",
15459           "cldr-core": "^47.0.0",
15460           "cldr-localenames-full": "^47.0.0",
15461           "concat-files": "^0.1.1",
15462           d3: "~7.9.0",
15463           dotenv: "^17.2.0",
15464           "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
15465           esbuild: "^0.25.6",
15466           "esbuild-visualizer": "^0.7.0",
15467           eslint: "^9.30.1",
15468           "fetch-mock": "^11.1.1",
15469           gaze: "^1.1.3",
15470           glob: "^11.0.3",
15471           happen: "^0.3.2",
15472           "js-yaml": "^4.0.0",
15473           jsdom: "^26.1.0",
15474           "json-stringify-pretty-compact": "^3.0.0",
15475           "mapillary-js": "4.1.2",
15476           minimist: "^1.2.8",
15477           "name-suggestion-index": "~6.0",
15478           "netlify-cli": "^22.2.2",
15479           nise: "^6.1.1",
15480           "npm-run-all": "^4.0.0",
15481           "osm-community-index": "~5.9.2",
15482           postcss: "^8.5.6",
15483           "postcss-prefix-selector": "^2.1.1",
15484           "serve-handler": "^6.1.6",
15485           shelljs: "^0.10.0",
15486           shx: "^0.4.0",
15487           sinon: "^21.0.0",
15488           "sinon-chai": "^4.0.0",
15489           smash: "0.0",
15490           "svg-sprite": "2.0.4",
15491           vparse: "~1.1.0"
15492         },
15493         engines: {
15494           node: ">=20"
15495         },
15496         browserslist: [
15497           "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
15498         ]
15499       };
15500     }
15501   });
15502
15503   // node_modules/aes-js/index.js
15504   var require_aes_js = __commonJS({
15505     "node_modules/aes-js/index.js"(exports2, module2) {
15506       (function(root3) {
15507         "use strict";
15508         function checkInt(value) {
15509           return parseInt(value) === value;
15510         }
15511         function checkInts(arrayish) {
15512           if (!checkInt(arrayish.length)) {
15513             return false;
15514           }
15515           for (var i3 = 0; i3 < arrayish.length; i3++) {
15516             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
15517               return false;
15518             }
15519           }
15520           return true;
15521         }
15522         function coerceArray(arg, copy2) {
15523           if (arg.buffer && arg.name === "Uint8Array") {
15524             if (copy2) {
15525               if (arg.slice) {
15526                 arg = arg.slice();
15527               } else {
15528                 arg = Array.prototype.slice.call(arg);
15529               }
15530             }
15531             return arg;
15532           }
15533           if (Array.isArray(arg)) {
15534             if (!checkInts(arg)) {
15535               throw new Error("Array contains invalid value: " + arg);
15536             }
15537             return new Uint8Array(arg);
15538           }
15539           if (checkInt(arg.length) && checkInts(arg)) {
15540             return new Uint8Array(arg);
15541           }
15542           throw new Error("unsupported array-like object");
15543         }
15544         function createArray(length2) {
15545           return new Uint8Array(length2);
15546         }
15547         function copyArray2(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
15548           if (sourceStart != null || sourceEnd != null) {
15549             if (sourceArray.slice) {
15550               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
15551             } else {
15552               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
15553             }
15554           }
15555           targetArray.set(sourceArray, targetStart);
15556         }
15557         var convertUtf8 = /* @__PURE__ */ function() {
15558           function toBytes(text) {
15559             var result = [], i3 = 0;
15560             text = encodeURI(text);
15561             while (i3 < text.length) {
15562               var c2 = text.charCodeAt(i3++);
15563               if (c2 === 37) {
15564                 result.push(parseInt(text.substr(i3, 2), 16));
15565                 i3 += 2;
15566               } else {
15567                 result.push(c2);
15568               }
15569             }
15570             return coerceArray(result);
15571           }
15572           function fromBytes(bytes) {
15573             var result = [], i3 = 0;
15574             while (i3 < bytes.length) {
15575               var c2 = bytes[i3];
15576               if (c2 < 128) {
15577                 result.push(String.fromCharCode(c2));
15578                 i3++;
15579               } else if (c2 > 191 && c2 < 224) {
15580                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
15581                 i3 += 2;
15582               } else {
15583                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
15584                 i3 += 3;
15585               }
15586             }
15587             return result.join("");
15588           }
15589           return {
15590             toBytes,
15591             fromBytes
15592           };
15593         }();
15594         var convertHex = /* @__PURE__ */ function() {
15595           function toBytes(text) {
15596             var result = [];
15597             for (var i3 = 0; i3 < text.length; i3 += 2) {
15598               result.push(parseInt(text.substr(i3, 2), 16));
15599             }
15600             return result;
15601           }
15602           var Hex = "0123456789abcdef";
15603           function fromBytes(bytes) {
15604             var result = [];
15605             for (var i3 = 0; i3 < bytes.length; i3++) {
15606               var v3 = bytes[i3];
15607               result.push(Hex[(v3 & 240) >> 4] + Hex[v3 & 15]);
15608             }
15609             return result.join("");
15610           }
15611           return {
15612             toBytes,
15613             fromBytes
15614           };
15615         }();
15616         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
15617         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];
15618         var S3 = [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];
15619         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];
15620         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];
15621         var T22 = [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];
15622         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];
15623         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];
15624         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];
15625         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];
15626         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];
15627         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];
15628         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];
15629         var U22 = [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];
15630         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];
15631         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];
15632         function convertToInt32(bytes) {
15633           var result = [];
15634           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
15635             result.push(
15636               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
15637             );
15638           }
15639           return result;
15640         }
15641         var AES = function(key) {
15642           if (!(this instanceof AES)) {
15643             throw Error("AES must be instanitated with `new`");
15644           }
15645           Object.defineProperty(this, "key", {
15646             value: coerceArray(key, true)
15647           });
15648           this._prepare();
15649         };
15650         AES.prototype._prepare = function() {
15651           var rounds = numberOfRounds[this.key.length];
15652           if (rounds == null) {
15653             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
15654           }
15655           this._Ke = [];
15656           this._Kd = [];
15657           for (var i3 = 0; i3 <= rounds; i3++) {
15658             this._Ke.push([0, 0, 0, 0]);
15659             this._Kd.push([0, 0, 0, 0]);
15660           }
15661           var roundKeyCount = (rounds + 1) * 4;
15662           var KC = this.key.length / 4;
15663           var tk = convertToInt32(this.key);
15664           var index;
15665           for (var i3 = 0; i3 < KC; i3++) {
15666             index = i3 >> 2;
15667             this._Ke[index][i3 % 4] = tk[i3];
15668             this._Kd[rounds - index][i3 % 4] = tk[i3];
15669           }
15670           var rconpointer = 0;
15671           var t2 = KC, tt2;
15672           while (t2 < roundKeyCount) {
15673             tt2 = tk[KC - 1];
15674             tk[0] ^= S3[tt2 >> 16 & 255] << 24 ^ S3[tt2 >> 8 & 255] << 16 ^ S3[tt2 & 255] << 8 ^ S3[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
15675             rconpointer += 1;
15676             if (KC != 8) {
15677               for (var i3 = 1; i3 < KC; i3++) {
15678                 tk[i3] ^= tk[i3 - 1];
15679               }
15680             } else {
15681               for (var i3 = 1; i3 < KC / 2; i3++) {
15682                 tk[i3] ^= tk[i3 - 1];
15683               }
15684               tt2 = tk[KC / 2 - 1];
15685               tk[KC / 2] ^= S3[tt2 & 255] ^ S3[tt2 >> 8 & 255] << 8 ^ S3[tt2 >> 16 & 255] << 16 ^ S3[tt2 >> 24 & 255] << 24;
15686               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
15687                 tk[i3] ^= tk[i3 - 1];
15688               }
15689             }
15690             var i3 = 0, r2, c2;
15691             while (i3 < KC && t2 < roundKeyCount) {
15692               r2 = t2 >> 2;
15693               c2 = t2 % 4;
15694               this._Ke[r2][c2] = tk[i3];
15695               this._Kd[rounds - r2][c2] = tk[i3++];
15696               t2++;
15697             }
15698           }
15699           for (var r2 = 1; r2 < rounds; r2++) {
15700             for (var c2 = 0; c2 < 4; c2++) {
15701               tt2 = this._Kd[r2][c2];
15702               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U22[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
15703             }
15704           }
15705         };
15706         AES.prototype.encrypt = function(plaintext) {
15707           if (plaintext.length != 16) {
15708             throw new Error("invalid plaintext size (must be 16 bytes)");
15709           }
15710           var rounds = this._Ke.length - 1;
15711           var a4 = [0, 0, 0, 0];
15712           var t2 = convertToInt32(plaintext);
15713           for (var i3 = 0; i3 < 4; i3++) {
15714             t2[i3] ^= this._Ke[0][i3];
15715           }
15716           for (var r2 = 1; r2 < rounds; r2++) {
15717             for (var i3 = 0; i3 < 4; i3++) {
15718               a4[i3] = T1[t2[i3] >> 24 & 255] ^ T22[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
15719             }
15720             t2 = a4.slice();
15721           }
15722           var result = createArray(16), tt2;
15723           for (var i3 = 0; i3 < 4; i3++) {
15724             tt2 = this._Ke[rounds][i3];
15725             result[4 * i3] = (S3[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
15726             result[4 * i3 + 1] = (S3[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
15727             result[4 * i3 + 2] = (S3[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
15728             result[4 * i3 + 3] = (S3[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
15729           }
15730           return result;
15731         };
15732         AES.prototype.decrypt = function(ciphertext) {
15733           if (ciphertext.length != 16) {
15734             throw new Error("invalid ciphertext size (must be 16 bytes)");
15735           }
15736           var rounds = this._Kd.length - 1;
15737           var a4 = [0, 0, 0, 0];
15738           var t2 = convertToInt32(ciphertext);
15739           for (var i3 = 0; i3 < 4; i3++) {
15740             t2[i3] ^= this._Kd[0][i3];
15741           }
15742           for (var r2 = 1; r2 < rounds; r2++) {
15743             for (var i3 = 0; i3 < 4; i3++) {
15744               a4[i3] = T5[t2[i3] >> 24 & 255] ^ T6[t2[(i3 + 3) % 4] >> 16 & 255] ^ T7[t2[(i3 + 2) % 4] >> 8 & 255] ^ T8[t2[(i3 + 1) % 4] & 255] ^ this._Kd[r2][i3];
15745             }
15746             t2 = a4.slice();
15747           }
15748           var result = createArray(16), tt2;
15749           for (var i3 = 0; i3 < 4; i3++) {
15750             tt2 = this._Kd[rounds][i3];
15751             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
15752             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
15753             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
15754             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
15755           }
15756           return result;
15757         };
15758         var ModeOfOperationECB = function(key) {
15759           if (!(this instanceof ModeOfOperationECB)) {
15760             throw Error("AES must be instanitated with `new`");
15761           }
15762           this.description = "Electronic Code Block";
15763           this.name = "ecb";
15764           this._aes = new AES(key);
15765         };
15766         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
15767           plaintext = coerceArray(plaintext);
15768           if (plaintext.length % 16 !== 0) {
15769             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
15770           }
15771           var ciphertext = createArray(plaintext.length);
15772           var block = createArray(16);
15773           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
15774             copyArray2(plaintext, block, 0, i3, i3 + 16);
15775             block = this._aes.encrypt(block);
15776             copyArray2(block, ciphertext, i3);
15777           }
15778           return ciphertext;
15779         };
15780         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
15781           ciphertext = coerceArray(ciphertext);
15782           if (ciphertext.length % 16 !== 0) {
15783             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
15784           }
15785           var plaintext = createArray(ciphertext.length);
15786           var block = createArray(16);
15787           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
15788             copyArray2(ciphertext, block, 0, i3, i3 + 16);
15789             block = this._aes.decrypt(block);
15790             copyArray2(block, plaintext, i3);
15791           }
15792           return plaintext;
15793         };
15794         var ModeOfOperationCBC = function(key, iv) {
15795           if (!(this instanceof ModeOfOperationCBC)) {
15796             throw Error("AES must be instanitated with `new`");
15797           }
15798           this.description = "Cipher Block Chaining";
15799           this.name = "cbc";
15800           if (!iv) {
15801             iv = createArray(16);
15802           } else if (iv.length != 16) {
15803             throw new Error("invalid initialation vector size (must be 16 bytes)");
15804           }
15805           this._lastCipherblock = coerceArray(iv, true);
15806           this._aes = new AES(key);
15807         };
15808         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
15809           plaintext = coerceArray(plaintext);
15810           if (plaintext.length % 16 !== 0) {
15811             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
15812           }
15813           var ciphertext = createArray(plaintext.length);
15814           var block = createArray(16);
15815           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
15816             copyArray2(plaintext, block, 0, i3, i3 + 16);
15817             for (var j3 = 0; j3 < 16; j3++) {
15818               block[j3] ^= this._lastCipherblock[j3];
15819             }
15820             this._lastCipherblock = this._aes.encrypt(block);
15821             copyArray2(this._lastCipherblock, ciphertext, i3);
15822           }
15823           return ciphertext;
15824         };
15825         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
15826           ciphertext = coerceArray(ciphertext);
15827           if (ciphertext.length % 16 !== 0) {
15828             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
15829           }
15830           var plaintext = createArray(ciphertext.length);
15831           var block = createArray(16);
15832           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
15833             copyArray2(ciphertext, block, 0, i3, i3 + 16);
15834             block = this._aes.decrypt(block);
15835             for (var j3 = 0; j3 < 16; j3++) {
15836               plaintext[i3 + j3] = block[j3] ^ this._lastCipherblock[j3];
15837             }
15838             copyArray2(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
15839           }
15840           return plaintext;
15841         };
15842         var ModeOfOperationCFB = function(key, iv, segmentSize) {
15843           if (!(this instanceof ModeOfOperationCFB)) {
15844             throw Error("AES must be instanitated with `new`");
15845           }
15846           this.description = "Cipher Feedback";
15847           this.name = "cfb";
15848           if (!iv) {
15849             iv = createArray(16);
15850           } else if (iv.length != 16) {
15851             throw new Error("invalid initialation vector size (must be 16 size)");
15852           }
15853           if (!segmentSize) {
15854             segmentSize = 1;
15855           }
15856           this.segmentSize = segmentSize;
15857           this._shiftRegister = coerceArray(iv, true);
15858           this._aes = new AES(key);
15859         };
15860         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
15861           if (plaintext.length % this.segmentSize != 0) {
15862             throw new Error("invalid plaintext size (must be segmentSize bytes)");
15863           }
15864           var encrypted = coerceArray(plaintext, true);
15865           var xorSegment;
15866           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
15867             xorSegment = this._aes.encrypt(this._shiftRegister);
15868             for (var j3 = 0; j3 < this.segmentSize; j3++) {
15869               encrypted[i3 + j3] ^= xorSegment[j3];
15870             }
15871             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15872             copyArray2(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15873           }
15874           return encrypted;
15875         };
15876         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
15877           if (ciphertext.length % this.segmentSize != 0) {
15878             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
15879           }
15880           var plaintext = coerceArray(ciphertext, true);
15881           var xorSegment;
15882           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
15883             xorSegment = this._aes.encrypt(this._shiftRegister);
15884             for (var j3 = 0; j3 < this.segmentSize; j3++) {
15885               plaintext[i3 + j3] ^= xorSegment[j3];
15886             }
15887             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15888             copyArray2(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15889           }
15890           return plaintext;
15891         };
15892         var ModeOfOperationOFB = function(key, iv) {
15893           if (!(this instanceof ModeOfOperationOFB)) {
15894             throw Error("AES must be instanitated with `new`");
15895           }
15896           this.description = "Output Feedback";
15897           this.name = "ofb";
15898           if (!iv) {
15899             iv = createArray(16);
15900           } else if (iv.length != 16) {
15901             throw new Error("invalid initialation vector size (must be 16 bytes)");
15902           }
15903           this._lastPrecipher = coerceArray(iv, true);
15904           this._lastPrecipherIndex = 16;
15905           this._aes = new AES(key);
15906         };
15907         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
15908           var encrypted = coerceArray(plaintext, true);
15909           for (var i3 = 0; i3 < encrypted.length; i3++) {
15910             if (this._lastPrecipherIndex === 16) {
15911               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
15912               this._lastPrecipherIndex = 0;
15913             }
15914             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
15915           }
15916           return encrypted;
15917         };
15918         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
15919         var Counter = function(initialValue) {
15920           if (!(this instanceof Counter)) {
15921             throw Error("Counter must be instanitated with `new`");
15922           }
15923           if (initialValue !== 0 && !initialValue) {
15924             initialValue = 1;
15925           }
15926           if (typeof initialValue === "number") {
15927             this._counter = createArray(16);
15928             this.setValue(initialValue);
15929           } else {
15930             this.setBytes(initialValue);
15931           }
15932         };
15933         Counter.prototype.setValue = function(value) {
15934           if (typeof value !== "number" || parseInt(value) != value) {
15935             throw new Error("invalid counter value (must be an integer)");
15936           }
15937           if (value > Number.MAX_SAFE_INTEGER) {
15938             throw new Error("integer value out of safe range");
15939           }
15940           for (var index = 15; index >= 0; --index) {
15941             this._counter[index] = value % 256;
15942             value = parseInt(value / 256);
15943           }
15944         };
15945         Counter.prototype.setBytes = function(bytes) {
15946           bytes = coerceArray(bytes, true);
15947           if (bytes.length != 16) {
15948             throw new Error("invalid counter bytes size (must be 16 bytes)");
15949           }
15950           this._counter = bytes;
15951         };
15952         Counter.prototype.increment = function() {
15953           for (var i3 = 15; i3 >= 0; i3--) {
15954             if (this._counter[i3] === 255) {
15955               this._counter[i3] = 0;
15956             } else {
15957               this._counter[i3]++;
15958               break;
15959             }
15960           }
15961         };
15962         var ModeOfOperationCTR = function(key, counter) {
15963           if (!(this instanceof ModeOfOperationCTR)) {
15964             throw Error("AES must be instanitated with `new`");
15965           }
15966           this.description = "Counter";
15967           this.name = "ctr";
15968           if (!(counter instanceof Counter)) {
15969             counter = new Counter(counter);
15970           }
15971           this._counter = counter;
15972           this._remainingCounter = null;
15973           this._remainingCounterIndex = 16;
15974           this._aes = new AES(key);
15975         };
15976         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
15977           var encrypted = coerceArray(plaintext, true);
15978           for (var i3 = 0; i3 < encrypted.length; i3++) {
15979             if (this._remainingCounterIndex === 16) {
15980               this._remainingCounter = this._aes.encrypt(this._counter._counter);
15981               this._remainingCounterIndex = 0;
15982               this._counter.increment();
15983             }
15984             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
15985           }
15986           return encrypted;
15987         };
15988         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
15989         function pkcs7pad(data) {
15990           data = coerceArray(data, true);
15991           var padder = 16 - data.length % 16;
15992           var result = createArray(data.length + padder);
15993           copyArray2(data, result);
15994           for (var i3 = data.length; i3 < result.length; i3++) {
15995             result[i3] = padder;
15996           }
15997           return result;
15998         }
15999         function pkcs7strip(data) {
16000           data = coerceArray(data, true);
16001           if (data.length < 16) {
16002             throw new Error("PKCS#7 invalid length");
16003           }
16004           var padder = data[data.length - 1];
16005           if (padder > 16) {
16006             throw new Error("PKCS#7 padding byte out of range");
16007           }
16008           var length2 = data.length - padder;
16009           for (var i3 = 0; i3 < padder; i3++) {
16010             if (data[length2 + i3] !== padder) {
16011               throw new Error("PKCS#7 invalid padding byte");
16012             }
16013           }
16014           var result = createArray(length2);
16015           copyArray2(data, result, 0, 0, length2);
16016           return result;
16017         }
16018         var aesjs2 = {
16019           AES,
16020           Counter,
16021           ModeOfOperation: {
16022             ecb: ModeOfOperationECB,
16023             cbc: ModeOfOperationCBC,
16024             cfb: ModeOfOperationCFB,
16025             ofb: ModeOfOperationOFB,
16026             ctr: ModeOfOperationCTR
16027           },
16028           utils: {
16029             hex: convertHex,
16030             utf8: convertUtf8
16031           },
16032           padding: {
16033             pkcs7: {
16034               pad: pkcs7pad,
16035               strip: pkcs7strip
16036             }
16037           },
16038           _arrayTest: {
16039             coerceArray,
16040             createArray,
16041             copyArray: copyArray2
16042           }
16043         };
16044         if (typeof exports2 !== "undefined") {
16045           module2.exports = aesjs2;
16046         } else if (typeof define === "function" && define.amd) {
16047           define([], function() {
16048             return aesjs2;
16049           });
16050         } else {
16051           if (root3.aesjs) {
16052             aesjs2._aesjs = root3.aesjs;
16053           }
16054           root3.aesjs = aesjs2;
16055         }
16056       })(exports2);
16057     }
16058   });
16059
16060   // modules/util/aes.js
16061   var aes_exports = {};
16062   __export(aes_exports, {
16063     utilAesDecrypt: () => utilAesDecrypt,
16064     utilAesEncrypt: () => utilAesEncrypt
16065   });
16066   function utilAesEncrypt(text, key) {
16067     key = key || DEFAULT_128;
16068     const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
16069     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
16070     const encryptedBytes = aesCtr.encrypt(textBytes);
16071     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
16072     return encryptedHex;
16073   }
16074   function utilAesDecrypt(encryptedHex, key) {
16075     key = key || DEFAULT_128;
16076     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
16077     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
16078     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
16079     const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
16080     return text;
16081   }
16082   var import_aes_js, DEFAULT_128;
16083   var init_aes = __esm({
16084     "modules/util/aes.js"() {
16085       "use strict";
16086       import_aes_js = __toESM(require_aes_js());
16087       DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
16088     }
16089   });
16090
16091   // modules/util/clean_tags.js
16092   var clean_tags_exports = {};
16093   __export(clean_tags_exports, {
16094     utilCleanTags: () => utilCleanTags
16095   });
16096   function utilCleanTags(tags) {
16097     var out = {};
16098     for (var k3 in tags) {
16099       if (!k3) continue;
16100       var v3 = tags[k3];
16101       if (v3 !== void 0) {
16102         out[k3] = cleanValue(k3, v3);
16103       }
16104     }
16105     return out;
16106     function cleanValue(k4, v4) {
16107       function keepSpaces(k5) {
16108         return /_hours|_times|:conditional$/.test(k5);
16109       }
16110       function skip(k5) {
16111         return /^(description|note|fixme|inscription)$/.test(k5);
16112       }
16113       if (skip(k4)) return v4;
16114       var cleaned = v4.split(";").map(function(s2) {
16115         return s2.trim();
16116       }).join(keepSpaces(k4) ? "; " : ";");
16117       if (k4.indexOf("website") !== -1 || k4.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
16118         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
16119       }
16120       return cleaned;
16121     }
16122   }
16123   var init_clean_tags = __esm({
16124     "modules/util/clean_tags.js"() {
16125       "use strict";
16126     }
16127   });
16128
16129   // modules/util/detect.js
16130   var detect_exports = {};
16131   __export(detect_exports, {
16132     utilDetect: () => utilDetect
16133   });
16134   function utilDetect(refresh2) {
16135     if (_detected && !refresh2) return _detected;
16136     _detected = {};
16137     const ua = navigator.userAgent;
16138     let m3 = null;
16139     m3 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
16140     if (m3 !== null) {
16141       _detected.browser = m3[1];
16142       _detected.version = m3[2];
16143     }
16144     if (!_detected.browser) {
16145       m3 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
16146       if (m3 !== null) {
16147         _detected.browser = "msie";
16148         _detected.version = m3[1];
16149       }
16150     }
16151     if (!_detected.browser) {
16152       m3 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
16153       if (m3 !== null) {
16154         _detected.browser = "Opera";
16155         _detected.version = m3[2];
16156       }
16157     }
16158     if (!_detected.browser) {
16159       m3 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
16160       if (m3 !== null) {
16161         _detected.browser = m3[1];
16162         _detected.version = m3[2];
16163         m3 = ua.match(/version\/([\.\d]+)/i);
16164         if (m3 !== null) _detected.version = m3[1];
16165       }
16166     }
16167     if (!_detected.browser) {
16168       _detected.browser = navigator.appName;
16169       _detected.version = navigator.appVersion;
16170     }
16171     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
16172     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
16173     if (_detected.browser.toLowerCase() === "msie") {
16174       _detected.ie = true;
16175       _detected.browser = "Internet Explorer";
16176       _detected.support = false;
16177     } else {
16178       _detected.ie = false;
16179       _detected.support = true;
16180     }
16181     _detected.filedrop = window.FileReader && "ondrop" in window;
16182     if (/Win/.test(ua)) {
16183       _detected.os = "win";
16184       _detected.platform = "Windows";
16185     } else if (/Mac/.test(ua)) {
16186       _detected.os = "mac";
16187       _detected.platform = "Macintosh";
16188     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
16189       _detected.os = "linux";
16190       _detected.platform = "Linux";
16191     } else {
16192       _detected.os = "win";
16193       _detected.platform = "Unknown";
16194     }
16195     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
16196     // so assume any "mac" with multitouch is actually iOS
16197     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
16198     _detected.browserLocales = Array.from(new Set(
16199       // remove duplicates
16200       [navigator.language].concat(navigator.languages || []).concat([
16201         // old property for backwards compatibility
16202         navigator.userLanguage
16203       ]).filter(Boolean)
16204     ));
16205     let loc;
16206     try {
16207       loc = window.top.location;
16208     } catch {
16209       loc = window.location;
16210     }
16211     _detected.host = loc.origin + loc.pathname;
16212     return _detected;
16213   }
16214   var _detected;
16215   var init_detect = __esm({
16216     "modules/util/detect.js"() {
16217       "use strict";
16218     }
16219   });
16220
16221   // modules/util/get_set_value.js
16222   var get_set_value_exports = {};
16223   __export(get_set_value_exports, {
16224     utilGetSetValue: () => utilGetSetValue
16225   });
16226   function utilGetSetValue(selection2, value, shouldUpdate) {
16227     function setValue(value2, shouldUpdate2) {
16228       function valueNull() {
16229         delete this.value;
16230       }
16231       function valueConstant() {
16232         if (shouldUpdate2(this.value, value2)) {
16233           this.value = value2;
16234         }
16235       }
16236       function valueFunction() {
16237         var x2 = value2.apply(this, arguments);
16238         if (x2 === null || x2 === void 0) {
16239           delete this.value;
16240         } else if (shouldUpdate2(this.value, x2)) {
16241           this.value = x2;
16242         }
16243       }
16244       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
16245     }
16246     if (arguments.length === 1) {
16247       return selection2.property("value");
16248     }
16249     if (shouldUpdate === void 0) {
16250       shouldUpdate = (a4, b3) => a4 !== b3;
16251     }
16252     return selection2.each(setValue(value, shouldUpdate));
16253   }
16254   var init_get_set_value = __esm({
16255     "modules/util/get_set_value.js"() {
16256       "use strict";
16257     }
16258   });
16259
16260   // modules/util/keybinding.js
16261   var keybinding_exports = {};
16262   __export(keybinding_exports, {
16263     utilKeybinding: () => utilKeybinding
16264   });
16265   function utilKeybinding(namespace) {
16266     var _keybindings = {};
16267     function testBindings(d3_event, isCapturing) {
16268       var didMatch = false;
16269       var bindings = Object.keys(_keybindings).map(function(id2) {
16270         return _keybindings[id2];
16271       });
16272       for (const binding of bindings) {
16273         if (!binding.event.modifiers.shiftKey) continue;
16274         if (!!binding.capture !== isCapturing) continue;
16275         if (matches(d3_event, binding, true)) {
16276           binding.callback(d3_event);
16277           didMatch = true;
16278           break;
16279         }
16280       }
16281       if (didMatch) return;
16282       for (const binding of bindings) {
16283         if (binding.event.modifiers.shiftKey) continue;
16284         if (!!binding.capture !== isCapturing) continue;
16285         if (matches(d3_event, binding, false)) {
16286           binding.callback(d3_event);
16287           break;
16288         }
16289       }
16290       function matches(d3_event2, binding, testShift) {
16291         var event = d3_event2;
16292         var isMatch = false;
16293         var tryKeyCode = true;
16294         if (event.key !== void 0) {
16295           tryKeyCode = event.key.charCodeAt(0) > 127;
16296           isMatch = true;
16297           if (binding.event.key === void 0) {
16298             isMatch = false;
16299           } else if (Array.isArray(binding.event.key)) {
16300             if (binding.event.key.map(function(s2) {
16301               return s2.toLowerCase();
16302             }).indexOf(event.key.toLowerCase()) === -1) {
16303               isMatch = false;
16304             }
16305           } else {
16306             if (event.key.toLowerCase() !== binding.event.key.toLowerCase()) {
16307               isMatch = false;
16308             }
16309           }
16310         }
16311         if (!isMatch && (tryKeyCode || binding.event.modifiers.altKey)) {
16312           isMatch = event.keyCode === binding.event.keyCode;
16313         }
16314         if (!isMatch) return false;
16315         if (!(event.ctrlKey && event.altKey)) {
16316           if (event.ctrlKey !== binding.event.modifiers.ctrlKey) return false;
16317           if (event.altKey !== binding.event.modifiers.altKey) return false;
16318         }
16319         if (event.metaKey !== binding.event.modifiers.metaKey) return false;
16320         if (testShift && event.shiftKey !== binding.event.modifiers.shiftKey) return false;
16321         return true;
16322       }
16323     }
16324     function capture(d3_event) {
16325       testBindings(d3_event, true);
16326     }
16327     function bubble(d3_event) {
16328       var tagName = select_default2(d3_event.target).node().tagName;
16329       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
16330         return;
16331       }
16332       testBindings(d3_event, false);
16333     }
16334     function keybinding(selection2) {
16335       selection2 = selection2 || select_default2(document);
16336       selection2.on("keydown.capture." + namespace, capture, true);
16337       selection2.on("keydown.bubble." + namespace, bubble, false);
16338       return keybinding;
16339     }
16340     keybinding.unbind = function(selection2) {
16341       _keybindings = [];
16342       selection2 = selection2 || select_default2(document);
16343       selection2.on("keydown.capture." + namespace, null);
16344       selection2.on("keydown.bubble." + namespace, null);
16345       return keybinding;
16346     };
16347     keybinding.clear = function() {
16348       _keybindings = {};
16349       return keybinding;
16350     };
16351     keybinding.off = function(codes, capture2) {
16352       var arr = utilArrayUniq([].concat(codes));
16353       for (var i3 = 0; i3 < arr.length; i3++) {
16354         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
16355         delete _keybindings[id2];
16356       }
16357       return keybinding;
16358     };
16359     keybinding.on = function(codes, callback, capture2) {
16360       if (typeof callback !== "function") {
16361         return keybinding.off(codes, capture2);
16362       }
16363       var arr = utilArrayUniq([].concat(codes));
16364       for (var i3 = 0; i3 < arr.length; i3++) {
16365         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
16366         var binding = {
16367           id: id2,
16368           capture: capture2,
16369           callback,
16370           event: {
16371             key: void 0,
16372             // preferred
16373             keyCode: 0,
16374             // fallback
16375             modifiers: {
16376               shiftKey: false,
16377               ctrlKey: false,
16378               altKey: false,
16379               metaKey: false
16380             }
16381           }
16382         };
16383         if (_keybindings[id2]) {
16384           console.warn('warning: duplicate keybinding for "' + id2 + '"');
16385         }
16386         _keybindings[id2] = binding;
16387         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
16388         for (var j3 = 0; j3 < matches.length; j3++) {
16389           if (matches[j3] === "++") matches[j3] = "+";
16390           if (matches[j3] in utilKeybinding.modifierCodes) {
16391             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j3]]];
16392             binding.event.modifiers[prop] = true;
16393           } else {
16394             binding.event.key = utilKeybinding.keys[matches[j3]] || matches[j3];
16395             if (matches[j3] in utilKeybinding.keyCodes) {
16396               binding.event.keyCode = utilKeybinding.keyCodes[matches[j3]];
16397             }
16398           }
16399         }
16400       }
16401       return keybinding;
16402     };
16403     return keybinding;
16404   }
16405   var i, n;
16406   var init_keybinding = __esm({
16407     "modules/util/keybinding.js"() {
16408       "use strict";
16409       init_src5();
16410       init_array3();
16411       utilKeybinding.modifierCodes = {
16412         // Shift key, ⇧
16413         "\u21E7": 16,
16414         shift: 16,
16415         // CTRL key, on Mac: ⌃
16416         "\u2303": 17,
16417         ctrl: 17,
16418         // ALT key, on Mac: ⌥ (Alt)
16419         "\u2325": 18,
16420         alt: 18,
16421         option: 18,
16422         // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
16423         "\u2318": 91,
16424         meta: 91,
16425         cmd: 91,
16426         "super": 91,
16427         win: 91
16428       };
16429       utilKeybinding.modifierProperties = {
16430         16: "shiftKey",
16431         17: "ctrlKey",
16432         18: "altKey",
16433         91: "metaKey"
16434       };
16435       utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
16436       utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
16437       utilKeybinding.keys = {
16438         // Backspace key, on Mac: ⌫ (Backspace)
16439         "\u232B": "Backspace",
16440         backspace: "Backspace",
16441         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
16442         "\u21E5": "Tab",
16443         "\u21C6": "Tab",
16444         tab: "Tab",
16445         // Return key, ↩
16446         "\u21A9": "Enter",
16447         "\u21B5": "Enter",
16448         "\u23CE": "Enter",
16449         "return": "Enter",
16450         enter: "Enter",
16451         "\u2305": "Enter",
16452         // Pause/Break key
16453         "pause": "Pause",
16454         "pause-break": "Pause",
16455         // Caps Lock key, ⇪
16456         "\u21EA": "CapsLock",
16457         caps: "CapsLock",
16458         "caps-lock": "CapsLock",
16459         // Escape key, on Mac: ⎋, on Windows: Esc
16460         "\u238B": ["Escape", "Esc"],
16461         escape: ["Escape", "Esc"],
16462         esc: ["Escape", "Esc"],
16463         // Space key
16464         space: [" ", "Spacebar"],
16465         // Page-Up key, or pgup, on Mac: ↖
16466         "\u2196": "PageUp",
16467         pgup: "PageUp",
16468         "page-up": "PageUp",
16469         // Page-Down key, or pgdown, on Mac: ↘
16470         "\u2198": "PageDown",
16471         pgdown: "PageDown",
16472         "page-down": "PageDown",
16473         // END key, on Mac: ⇟
16474         "\u21DF": "End",
16475         end: "End",
16476         // HOME key, on Mac: ⇞
16477         "\u21DE": "Home",
16478         home: "Home",
16479         // Insert key, or ins
16480         ins: "Insert",
16481         insert: "Insert",
16482         // Delete key, on Mac: ⌦ (Delete)
16483         "\u2326": ["Delete", "Del"],
16484         del: ["Delete", "Del"],
16485         "delete": ["Delete", "Del"],
16486         // Left Arrow Key, or ←
16487         "\u2190": ["ArrowLeft", "Left"],
16488         left: ["ArrowLeft", "Left"],
16489         "arrow-left": ["ArrowLeft", "Left"],
16490         // Up Arrow Key, or ↑
16491         "\u2191": ["ArrowUp", "Up"],
16492         up: ["ArrowUp", "Up"],
16493         "arrow-up": ["ArrowUp", "Up"],
16494         // Right Arrow Key, or →
16495         "\u2192": ["ArrowRight", "Right"],
16496         right: ["ArrowRight", "Right"],
16497         "arrow-right": ["ArrowRight", "Right"],
16498         // Up Arrow Key, or ↓
16499         "\u2193": ["ArrowDown", "Down"],
16500         down: ["ArrowDown", "Down"],
16501         "arrow-down": ["ArrowDown", "Down"],
16502         // odities, stuff for backward compatibility (browsers and code):
16503         // Num-Multiply, or *
16504         "*": ["*", "Multiply"],
16505         star: ["*", "Multiply"],
16506         asterisk: ["*", "Multiply"],
16507         multiply: ["*", "Multiply"],
16508         // Num-Plus or +
16509         "+": ["+", "Add"],
16510         "plus": ["+", "Add"],
16511         // Num-Subtract, or -
16512         "-": ["-", "Subtract"],
16513         subtract: ["-", "Subtract"],
16514         "dash": ["-", "Subtract"],
16515         // Semicolon
16516         semicolon: ";",
16517         // = or equals
16518         equals: "=",
16519         // Comma, or ,
16520         comma: ",",
16521         // Period, or ., or full-stop
16522         period: ".",
16523         "full-stop": ".",
16524         // Slash, or /, or forward-slash
16525         slash: "/",
16526         "forward-slash": "/",
16527         // Tick, or `, or back-quote
16528         tick: "`",
16529         "back-quote": "`",
16530         // Open bracket, or [
16531         "open-bracket": "[",
16532         // Back slash, or \
16533         "back-slash": "\\",
16534         // Close bracket, or ]
16535         "close-bracket": "]",
16536         // Apostrophe, or Quote, or '
16537         quote: "'",
16538         apostrophe: "'",
16539         // NUMPAD 0-9
16540         "num-0": "0",
16541         "num-1": "1",
16542         "num-2": "2",
16543         "num-3": "3",
16544         "num-4": "4",
16545         "num-5": "5",
16546         "num-6": "6",
16547         "num-7": "7",
16548         "num-8": "8",
16549         "num-9": "9",
16550         // F1-F25
16551         f1: "F1",
16552         f2: "F2",
16553         f3: "F3",
16554         f4: "F4",
16555         f5: "F5",
16556         f6: "F6",
16557         f7: "F7",
16558         f8: "F8",
16559         f9: "F9",
16560         f10: "F10",
16561         f11: "F11",
16562         f12: "F12",
16563         f13: "F13",
16564         f14: "F14",
16565         f15: "F15",
16566         f16: "F16",
16567         f17: "F17",
16568         f18: "F18",
16569         f19: "F19",
16570         f20: "F20",
16571         f21: "F21",
16572         f22: "F22",
16573         f23: "F23",
16574         f24: "F24",
16575         f25: "F25"
16576       };
16577       utilKeybinding.keyCodes = {
16578         // Backspace key, on Mac: ⌫ (Backspace)
16579         "\u232B": 8,
16580         backspace: 8,
16581         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
16582         "\u21E5": 9,
16583         "\u21C6": 9,
16584         tab: 9,
16585         // Return key, ↩
16586         "\u21A9": 13,
16587         "\u21B5": 13,
16588         "\u23CE": 13,
16589         "return": 13,
16590         enter: 13,
16591         "\u2305": 13,
16592         // Pause/Break key
16593         "pause": 19,
16594         "pause-break": 19,
16595         // Caps Lock key, ⇪
16596         "\u21EA": 20,
16597         caps: 20,
16598         "caps-lock": 20,
16599         // Escape key, on Mac: ⎋, on Windows: Esc
16600         "\u238B": 27,
16601         escape: 27,
16602         esc: 27,
16603         // Space key
16604         space: 32,
16605         // Page-Up key, or pgup, on Mac: ↖
16606         "\u2196": 33,
16607         pgup: 33,
16608         "page-up": 33,
16609         // Page-Down key, or pgdown, on Mac: ↘
16610         "\u2198": 34,
16611         pgdown: 34,
16612         "page-down": 34,
16613         // END key, on Mac: ⇟
16614         "\u21DF": 35,
16615         end: 35,
16616         // HOME key, on Mac: ⇞
16617         "\u21DE": 36,
16618         home: 36,
16619         // Insert key, or ins
16620         ins: 45,
16621         insert: 45,
16622         // Delete key, on Mac: ⌦ (Delete)
16623         "\u2326": 46,
16624         del: 46,
16625         "delete": 46,
16626         // Left Arrow Key, or ←
16627         "\u2190": 37,
16628         left: 37,
16629         "arrow-left": 37,
16630         // Up Arrow Key, or ↑
16631         "\u2191": 38,
16632         up: 38,
16633         "arrow-up": 38,
16634         // Right Arrow Key, or →
16635         "\u2192": 39,
16636         right: 39,
16637         "arrow-right": 39,
16638         // Up Arrow Key, or ↓
16639         "\u2193": 40,
16640         down: 40,
16641         "arrow-down": 40,
16642         // odities, printing characters that come out wrong:
16643         // Firefox Equals
16644         "ffequals": 61,
16645         // Num-Multiply, or *
16646         "*": 106,
16647         star: 106,
16648         asterisk: 106,
16649         multiply: 106,
16650         // Num-Plus or +
16651         "+": 107,
16652         "plus": 107,
16653         // Num-Subtract, or -
16654         "-": 109,
16655         subtract: 109,
16656         // Vertical Bar / Pipe
16657         "|": 124,
16658         // Firefox Plus
16659         "ffplus": 171,
16660         // Firefox Minus
16661         "ffminus": 173,
16662         // Semicolon
16663         ";": 186,
16664         semicolon: 186,
16665         // = or equals
16666         "=": 187,
16667         "equals": 187,
16668         // Comma, or ,
16669         ",": 188,
16670         comma: 188,
16671         // Dash / Underscore key
16672         "dash": 189,
16673         // Period, or ., or full-stop
16674         ".": 190,
16675         period: 190,
16676         "full-stop": 190,
16677         // Slash, or /, or forward-slash
16678         "/": 191,
16679         slash: 191,
16680         "forward-slash": 191,
16681         // Tick, or `, or back-quote
16682         "`": 192,
16683         tick: 192,
16684         "back-quote": 192,
16685         // Open bracket, or [
16686         "[": 219,
16687         "open-bracket": 219,
16688         // Back slash, or \
16689         "\\": 220,
16690         "back-slash": 220,
16691         // Close bracket, or ]
16692         "]": 221,
16693         "close-bracket": 221,
16694         // Apostrophe, or Quote, or '
16695         "'": 222,
16696         quote: 222,
16697         apostrophe: 222
16698       };
16699       i = 95;
16700       n = 0;
16701       while (++i < 106) {
16702         utilKeybinding.keyCodes["num-" + n] = i;
16703         ++n;
16704       }
16705       i = 47;
16706       n = 0;
16707       while (++i < 58) {
16708         utilKeybinding.keyCodes[n] = i;
16709         ++n;
16710       }
16711       i = 111;
16712       n = 1;
16713       while (++i < 136) {
16714         utilKeybinding.keyCodes["f" + n] = i;
16715         ++n;
16716       }
16717       i = 64;
16718       while (++i < 91) {
16719         utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
16720       }
16721     }
16722   });
16723
16724   // modules/util/object.js
16725   var object_exports = {};
16726   __export(object_exports, {
16727     utilCheckTagDictionary: () => utilCheckTagDictionary,
16728     utilObjectOmit: () => utilObjectOmit
16729   });
16730   function utilObjectOmit(obj, omitKeys) {
16731     return Object.keys(obj).reduce(function(result, key) {
16732       if (omitKeys.indexOf(key) === -1) {
16733         result[key] = obj[key];
16734       }
16735       return result;
16736     }, {});
16737   }
16738   function utilCheckTagDictionary(tags, tagDictionary) {
16739     for (const key in tags) {
16740       const value = tags[key];
16741       if (tagDictionary[key] && value in tagDictionary[key]) {
16742         return tagDictionary[key][value];
16743       }
16744     }
16745     return void 0;
16746   }
16747   var init_object2 = __esm({
16748     "modules/util/object.js"() {
16749       "use strict";
16750     }
16751   });
16752
16753   // modules/util/rebind.js
16754   var rebind_exports = {};
16755   __export(rebind_exports, {
16756     utilRebind: () => utilRebind
16757   });
16758   function utilRebind(target, source, ...args) {
16759     for (const method of args) {
16760       target[method] = d3_rebind(target, source, source[method]);
16761     }
16762     return target;
16763   }
16764   function d3_rebind(target, source, method) {
16765     return function() {
16766       var value = method.apply(source, arguments);
16767       return value === source ? target : value;
16768     };
16769   }
16770   var init_rebind = __esm({
16771     "modules/util/rebind.js"() {
16772       "use strict";
16773     }
16774   });
16775
16776   // modules/util/session_mutex.js
16777   var session_mutex_exports = {};
16778   __export(session_mutex_exports, {
16779     utilSessionMutex: () => utilSessionMutex
16780   });
16781   function utilSessionMutex(name) {
16782     var mutex = {};
16783     var intervalID;
16784     function renew() {
16785       if (typeof window === "undefined") return;
16786       var expires = /* @__PURE__ */ new Date();
16787       expires.setSeconds(expires.getSeconds() + 5);
16788       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
16789     }
16790     mutex.lock = function() {
16791       if (intervalID) return true;
16792       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
16793       if (cookie) return false;
16794       renew();
16795       intervalID = window.setInterval(renew, 4e3);
16796       return true;
16797     };
16798     mutex.unlock = function() {
16799       if (!intervalID) return;
16800       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
16801       clearInterval(intervalID);
16802       intervalID = null;
16803     };
16804     mutex.locked = function() {
16805       return !!intervalID;
16806     };
16807     return mutex;
16808   }
16809   var init_session_mutex = __esm({
16810     "modules/util/session_mutex.js"() {
16811       "use strict";
16812     }
16813   });
16814
16815   // modules/util/tiler.js
16816   var tiler_exports = {};
16817   __export(tiler_exports, {
16818     utilTiler: () => utilTiler
16819   });
16820   function utilTiler() {
16821     var _size = [256, 256];
16822     var _scale = 256;
16823     var _tileSize = 256;
16824     var _zoomExtent = [0, 20];
16825     var _translate = [_size[0] / 2, _size[1] / 2];
16826     var _margin = 0;
16827     var _skipNullIsland = false;
16828     function nearNullIsland(tile) {
16829       var x2 = tile[0];
16830       var y2 = tile[1];
16831       var z3 = tile[2];
16832       if (z3 >= 7) {
16833         var center = Math.pow(2, z3 - 1);
16834         var width = Math.pow(2, z3 - 6);
16835         var min3 = center - width / 2;
16836         var max3 = center + width / 2 - 1;
16837         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
16838       }
16839       return false;
16840     }
16841     function tiler8() {
16842       var z3 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
16843       var z0 = clamp_default(Math.round(z3), _zoomExtent[0], _zoomExtent[1]);
16844       var tileMin = 0;
16845       var tileMax = Math.pow(2, z0) - 1;
16846       var log2ts = Math.log(_tileSize) * Math.LOG2E;
16847       var k3 = Math.pow(2, z3 - z0 + log2ts);
16848       var origin = [
16849         (_translate[0] - _scale / 2) / k3,
16850         (_translate[1] - _scale / 2) / k3
16851       ];
16852       var cols = range(
16853         clamp_default(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
16854         clamp_default(Math.ceil(_size[0] / k3 - origin[0]) + _margin, tileMin, tileMax + 1)
16855       );
16856       var rows = range(
16857         clamp_default(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
16858         clamp_default(Math.ceil(_size[1] / k3 - origin[1]) + _margin, tileMin, tileMax + 1)
16859       );
16860       var tiles = [];
16861       for (var i3 = 0; i3 < rows.length; i3++) {
16862         var y2 = rows[i3];
16863         for (var j3 = 0; j3 < cols.length; j3++) {
16864           var x2 = cols[j3];
16865           if (i3 >= _margin && i3 <= rows.length - _margin && j3 >= _margin && j3 <= cols.length - _margin) {
16866             tiles.unshift([x2, y2, z0]);
16867           } else {
16868             tiles.push([x2, y2, z0]);
16869           }
16870         }
16871       }
16872       tiles.translate = origin;
16873       tiles.scale = k3;
16874       return tiles;
16875     }
16876     tiler8.getTiles = function(projection2) {
16877       var origin = [
16878         projection2.scale() * Math.PI - projection2.translate()[0],
16879         projection2.scale() * Math.PI - projection2.translate()[1]
16880       ];
16881       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
16882       var tiles = tiler8();
16883       var ts = tiles.scale;
16884       return tiles.map(function(tile) {
16885         if (_skipNullIsland && nearNullIsland(tile)) {
16886           return false;
16887         }
16888         var x2 = tile[0] * ts - origin[0];
16889         var y2 = tile[1] * ts - origin[1];
16890         return {
16891           id: tile.toString(),
16892           xyz: tile,
16893           extent: geoExtent(
16894             projection2.invert([x2, y2 + ts]),
16895             projection2.invert([x2 + ts, y2])
16896           )
16897         };
16898       }).filter(Boolean);
16899     };
16900     tiler8.getGeoJSON = function(projection2) {
16901       var features = tiler8.getTiles(projection2).map(function(tile) {
16902         return {
16903           type: "Feature",
16904           properties: {
16905             id: tile.id,
16906             name: tile.id
16907           },
16908           geometry: {
16909             type: "Polygon",
16910             coordinates: [tile.extent.polygon()]
16911           }
16912         };
16913       });
16914       return {
16915         type: "FeatureCollection",
16916         features
16917       };
16918     };
16919     tiler8.tileSize = function(val) {
16920       if (!arguments.length) return _tileSize;
16921       _tileSize = val;
16922       return tiler8;
16923     };
16924     tiler8.zoomExtent = function(val) {
16925       if (!arguments.length) return _zoomExtent;
16926       _zoomExtent = val;
16927       return tiler8;
16928     };
16929     tiler8.size = function(val) {
16930       if (!arguments.length) return _size;
16931       _size = val;
16932       return tiler8;
16933     };
16934     tiler8.scale = function(val) {
16935       if (!arguments.length) return _scale;
16936       _scale = val;
16937       return tiler8;
16938     };
16939     tiler8.translate = function(val) {
16940       if (!arguments.length) return _translate;
16941       _translate = val;
16942       return tiler8;
16943     };
16944     tiler8.margin = function(val) {
16945       if (!arguments.length) return _margin;
16946       _margin = +val;
16947       return tiler8;
16948     };
16949     tiler8.skipNullIsland = function(val) {
16950       if (!arguments.length) return _skipNullIsland;
16951       _skipNullIsland = val;
16952       return tiler8;
16953     };
16954     return tiler8;
16955   }
16956   var init_tiler = __esm({
16957     "modules/util/tiler.js"() {
16958       "use strict";
16959       init_src();
16960       init_lodash();
16961       init_geo2();
16962     }
16963   });
16964
16965   // modules/util/trigger_event.js
16966   var trigger_event_exports = {};
16967   __export(trigger_event_exports, {
16968     utilTriggerEvent: () => utilTriggerEvent
16969   });
16970   function utilTriggerEvent(target, type2, eventProperties) {
16971     target.each(function() {
16972       var evt = document.createEvent("HTMLEvents");
16973       evt.initEvent(type2, true, true);
16974       for (var prop in eventProperties) {
16975         evt[prop] = eventProperties[prop];
16976       }
16977       this.dispatchEvent(evt);
16978     });
16979   }
16980   var init_trigger_event = __esm({
16981     "modules/util/trigger_event.js"() {
16982       "use strict";
16983     }
16984   });
16985
16986   // modules/util/units.js
16987   var units_exports = {};
16988   __export(units_exports, {
16989     decimalCoordinatePair: () => decimalCoordinatePair,
16990     displayArea: () => displayArea,
16991     displayLength: () => displayLength,
16992     dmsCoordinatePair: () => dmsCoordinatePair,
16993     dmsMatcher: () => dmsMatcher
16994   });
16995   function displayLength(m3, isImperial) {
16996     var d2 = m3 * (isImperial ? 3.28084 : 1);
16997     var unit2;
16998     if (isImperial) {
16999       if (d2 >= 5280) {
17000         d2 /= 5280;
17001         unit2 = "miles";
17002       } else {
17003         unit2 = "feet";
17004       }
17005     } else {
17006       if (d2 >= 1e3) {
17007         d2 /= 1e3;
17008         unit2 = "kilometers";
17009       } else {
17010         unit2 = "meters";
17011       }
17012     }
17013     return _t("units." + unit2, {
17014       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
17015         maximumSignificantDigits: 4
17016       })
17017     });
17018   }
17019   function displayArea(m22, isImperial) {
17020     var locale3 = _mainLocalizer.localeCode();
17021     var d2 = m22 * (isImperial ? 10.7639111056 : 1);
17022     var d1, d22, area;
17023     var unit1 = "";
17024     var unit2 = "";
17025     if (isImperial) {
17026       if (d2 >= 6969600) {
17027         d1 = d2 / 27878400;
17028         unit1 = "square_miles";
17029       } else {
17030         d1 = d2;
17031         unit1 = "square_feet";
17032       }
17033       if (d2 > 4356 && d2 < 4356e4) {
17034         d22 = d2 / 43560;
17035         unit2 = "acres";
17036       }
17037     } else {
17038       if (d2 >= 25e4) {
17039         d1 = d2 / 1e6;
17040         unit1 = "square_kilometers";
17041       } else {
17042         d1 = d2;
17043         unit1 = "square_meters";
17044       }
17045       if (d2 > 1e3 && d2 < 1e7) {
17046         d22 = d2 / 1e4;
17047         unit2 = "hectares";
17048       }
17049     }
17050     area = _t("units." + unit1, {
17051       quantity: d1.toLocaleString(locale3, {
17052         maximumSignificantDigits: 4
17053       })
17054     });
17055     if (d22) {
17056       return _t("units.area_pair", {
17057         area1: area,
17058         area2: _t("units." + unit2, {
17059           quantity: d22.toLocaleString(locale3, {
17060             maximumSignificantDigits: 2
17061           })
17062         })
17063       });
17064     } else {
17065       return area;
17066     }
17067   }
17068   function wrap(x2, min3, max3) {
17069     var d2 = max3 - min3;
17070     return ((x2 - min3) % d2 + d2) % d2 + min3;
17071   }
17072   function roundToDecimal(target, decimalPlace) {
17073     target = Number(target);
17074     decimalPlace = Number(decimalPlace);
17075     const factor = Math.pow(10, decimalPlace);
17076     return Math.round(target * factor) / factor;
17077   }
17078   function displayCoordinate(deg, pos, neg) {
17079     var displayCoordinate2;
17080     var locale3 = _mainLocalizer.localeCode();
17081     var degreesFloor = Math.floor(Math.abs(deg));
17082     var min3 = (Math.abs(deg) - degreesFloor) * 60;
17083     var minFloor = Math.floor(min3);
17084     var sec = (min3 - minFloor) * 60;
17085     var fix = roundToDecimal(sec, 8);
17086     var secRounded = roundToDecimal(fix, 0);
17087     if (secRounded === 60) {
17088       secRounded = 0;
17089       minFloor += 1;
17090       if (minFloor === 60) {
17091         minFloor = 0;
17092         degreesFloor += 1;
17093       }
17094     }
17095     displayCoordinate2 = _t("units.arcdegrees", {
17096       quantity: degreesFloor.toLocaleString(locale3)
17097     }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
17098       quantity: minFloor.toLocaleString(locale3)
17099     }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
17100       quantity: secRounded.toLocaleString(locale3)
17101     }) : "");
17102     if (deg === 0) {
17103       return displayCoordinate2;
17104     } else {
17105       return _t("units.coordinate", {
17106         coordinate: displayCoordinate2,
17107         direction: _t("units." + (deg > 0 ? pos : neg))
17108       });
17109     }
17110   }
17111   function dmsCoordinatePair(coord2) {
17112     return _t("units.coordinate_pair", {
17113       latitude: displayCoordinate(clamp_default(coord2[1], -90, 90), "north", "south"),
17114       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
17115     });
17116   }
17117   function decimalCoordinatePair(coord2) {
17118     return _t("units.coordinate_pair", {
17119       latitude: clamp_default(coord2[1], -90, 90).toFixed(OSM_PRECISION),
17120       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
17121     });
17122   }
17123   function dmsMatcher(q3, _localeCode = void 0) {
17124     const matchers = [
17125       // D M SS , D M SS  ex: 35 11 10.1 , 136 49 53.8
17126       {
17127         condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
17128         parser: function(q4) {
17129           const match = this.condition.exec(q4);
17130           const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
17131           const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
17132           const isNegLat = match[1] === "-" ? -lat : lat;
17133           const isNegLng = match[5] === "-" ? -lng : lng;
17134           return [isNegLat, isNegLng];
17135         }
17136       },
17137       // D MM , D MM ex: 35 11.1683 , 136 49.8966
17138       {
17139         condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
17140         parser: function(q4) {
17141           const match = this.condition.exec(q4);
17142           const lat = +match[2] + +match[3] / 60;
17143           const lng = +match[5] + +match[6] / 60;
17144           const isNegLat = match[1] === "-" ? -lat : lat;
17145           const isNegLng = match[4] === "-" ? -lng : lng;
17146           return [isNegLat, isNegLng];
17147         }
17148       },
17149       // D/D ex: 46.112785/72.921033
17150       {
17151         condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
17152         parser: function(q4) {
17153           const match = this.condition.exec(q4);
17154           return [+match[1], +match[2]];
17155         }
17156       },
17157       // zoom/x/y ex: 2/1.23/34.44
17158       {
17159         condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
17160         parser: function(q4) {
17161           const match = this.condition.exec(q4);
17162           const lat = +match[2];
17163           const lng = +match[3];
17164           const zoom = +match[1];
17165           return [lat, lng, zoom];
17166         }
17167       },
17168       // x/y , x, y , x y  where x and y are localized floats, e.g. in German locale: 49,4109399, 8,7147086
17169       {
17170         condition: { test: (q4) => !!localizedNumberCoordsParser(q4) },
17171         parser: localizedNumberCoordsParser
17172       }
17173     ];
17174     function localizedNumberCoordsParser(q4) {
17175       const parseLocaleFloat = _mainLocalizer.floatParser(_localeCode || _mainLocalizer.localeCode());
17176       let parts = q4.split(/,?\s+|\s*[\/\\]\s*/);
17177       if (parts.length !== 2) return false;
17178       const lat = parseLocaleFloat(parts[0]);
17179       const lng = parseLocaleFloat(parts[1]);
17180       if (isNaN(lat) || isNaN(lng)) return false;
17181       return [lat, lng];
17182     }
17183     for (const matcher of matchers) {
17184       if (matcher.condition.test(q3)) {
17185         return matcher.parser(q3);
17186       }
17187     }
17188     return null;
17189   }
17190   var OSM_PRECISION;
17191   var init_units = __esm({
17192     "modules/util/units.js"() {
17193       "use strict";
17194       init_lodash();
17195       init_localizer();
17196       OSM_PRECISION = 7;
17197     }
17198   });
17199
17200   // modules/util/index.js
17201   var util_exports = {};
17202   __export(util_exports, {
17203     dmsCoordinatePair: () => dmsCoordinatePair,
17204     dmsMatcher: () => dmsMatcher,
17205     utilAesDecrypt: () => utilAesDecrypt,
17206     utilAesEncrypt: () => utilAesEncrypt,
17207     utilArrayChunk: () => utilArrayChunk,
17208     utilArrayDifference: () => utilArrayDifference,
17209     utilArrayFlatten: () => utilArrayFlatten,
17210     utilArrayGroupBy: () => utilArrayGroupBy,
17211     utilArrayIdentical: () => utilArrayIdentical,
17212     utilArrayIntersection: () => utilArrayIntersection,
17213     utilArrayUnion: () => utilArrayUnion,
17214     utilArrayUniq: () => utilArrayUniq,
17215     utilArrayUniqBy: () => utilArrayUniqBy,
17216     utilAsyncMap: () => utilAsyncMap,
17217     utilCheckTagDictionary: () => utilCheckTagDictionary,
17218     utilCleanOsmString: () => utilCleanOsmString,
17219     utilCleanTags: () => utilCleanTags,
17220     utilCombinedTags: () => utilCombinedTags,
17221     utilCompareIDs: () => utilCompareIDs,
17222     utilDeepMemberSelector: () => utilDeepMemberSelector,
17223     utilDetect: () => utilDetect,
17224     utilDisplayName: () => utilDisplayName,
17225     utilDisplayNameForPath: () => utilDisplayNameForPath,
17226     utilDisplayType: () => utilDisplayType,
17227     utilEditDistance: () => utilEditDistance,
17228     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
17229     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
17230     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
17231     utilEntityRoot: () => utilEntityRoot,
17232     utilEntitySelector: () => utilEntitySelector,
17233     utilFastMouse: () => utilFastMouse,
17234     utilFunctor: () => utilFunctor,
17235     utilGetAllNodes: () => utilGetAllNodes,
17236     utilGetSetValue: () => utilGetSetValue,
17237     utilHashcode: () => utilHashcode,
17238     utilHighlightEntities: () => utilHighlightEntities,
17239     utilKeybinding: () => utilKeybinding,
17240     utilNoAuto: () => utilNoAuto,
17241     utilObjectOmit: () => utilObjectOmit,
17242     utilOldestID: () => utilOldestID,
17243     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
17244     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
17245     utilQsString: () => utilQsString,
17246     utilRebind: () => utilRebind,
17247     utilSafeClassName: () => utilSafeClassName,
17248     utilSessionMutex: () => utilSessionMutex,
17249     utilSetTransform: () => utilSetTransform,
17250     utilStringQs: () => utilStringQs,
17251     utilTagDiff: () => utilTagDiff,
17252     utilTagText: () => utilTagText,
17253     utilTiler: () => utilTiler,
17254     utilTotalExtent: () => utilTotalExtent,
17255     utilTriggerEvent: () => utilTriggerEvent,
17256     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
17257     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
17258     utilUniqueDomId: () => utilUniqueDomId,
17259     utilWrap: () => utilWrap
17260   });
17261   var init_util = __esm({
17262     "modules/util/index.js"() {
17263       "use strict";
17264       init_aes();
17265       init_aes();
17266       init_array3();
17267       init_array3();
17268       init_array3();
17269       init_array3();
17270       init_array3();
17271       init_array3();
17272       init_array3();
17273       init_array3();
17274       init_array3();
17275       init_util2();
17276       init_clean_tags();
17277       init_util2();
17278       init_util2();
17279       init_detect();
17280       init_util2();
17281       init_util2();
17282       init_util2();
17283       init_util2();
17284       init_util2();
17285       init_util2();
17286       init_util2();
17287       init_util2();
17288       init_util2();
17289       init_util2();
17290       init_util2();
17291       init_util2();
17292       init_get_set_value();
17293       init_util2();
17294       init_util2();
17295       init_keybinding();
17296       init_util2();
17297       init_object2();
17298       init_util2();
17299       init_util2();
17300       init_util2();
17301       init_util2();
17302       init_util2();
17303       init_rebind();
17304       init_util2();
17305       init_util2();
17306       init_session_mutex();
17307       init_util2();
17308       init_util2();
17309       init_util2();
17310       init_tiler();
17311       init_util2();
17312       init_trigger_event();
17313       init_util2();
17314       init_util2();
17315       init_util2();
17316       init_util2();
17317       init_util2();
17318       init_units();
17319       init_units();
17320     }
17321   });
17322
17323   // modules/actions/add_midpoint.js
17324   var add_midpoint_exports = {};
17325   __export(add_midpoint_exports, {
17326     actionAddMidpoint: () => actionAddMidpoint
17327   });
17328   function actionAddMidpoint(midpoint, node) {
17329     return function(graph) {
17330       graph = graph.replace(node.move(midpoint.loc));
17331       var parents = utilArrayIntersection(
17332         graph.parentWays(graph.entity(midpoint.edge[0])),
17333         graph.parentWays(graph.entity(midpoint.edge[1]))
17334       );
17335       parents.forEach(function(way) {
17336         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
17337           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
17338             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
17339             return;
17340           }
17341         }
17342       });
17343       return graph;
17344     };
17345   }
17346   var init_add_midpoint = __esm({
17347     "modules/actions/add_midpoint.js"() {
17348       "use strict";
17349       init_geo2();
17350       init_util();
17351     }
17352   });
17353
17354   // modules/actions/add_vertex.js
17355   var add_vertex_exports = {};
17356   __export(add_vertex_exports, {
17357     actionAddVertex: () => actionAddVertex
17358   });
17359   function actionAddVertex(wayId, nodeId, index) {
17360     return function(graph) {
17361       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
17362     };
17363   }
17364   var init_add_vertex = __esm({
17365     "modules/actions/add_vertex.js"() {
17366       "use strict";
17367     }
17368   });
17369
17370   // modules/actions/change_member.js
17371   var change_member_exports = {};
17372   __export(change_member_exports, {
17373     actionChangeMember: () => actionChangeMember
17374   });
17375   function actionChangeMember(relationId, member, memberIndex) {
17376     return function(graph) {
17377       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
17378     };
17379   }
17380   var init_change_member = __esm({
17381     "modules/actions/change_member.js"() {
17382       "use strict";
17383     }
17384   });
17385
17386   // modules/actions/change_preset.js
17387   var change_preset_exports = {};
17388   __export(change_preset_exports, {
17389     actionChangePreset: () => actionChangePreset
17390   });
17391   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
17392     return function action(graph) {
17393       var entity = graph.entity(entityID);
17394       var geometry = entity.geometry(graph);
17395       var tags = entity.tags;
17396       const loc = entity.extent(graph).center();
17397       var preserveKeys;
17398       if (newPreset) {
17399         preserveKeys = [];
17400         if (newPreset.addTags) {
17401           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
17402         }
17403         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
17404           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
17405         }
17406       }
17407       if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
17408       if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
17409       return graph.replace(entity.update({ tags }));
17410     };
17411   }
17412   var init_change_preset = __esm({
17413     "modules/actions/change_preset.js"() {
17414       "use strict";
17415     }
17416   });
17417
17418   // modules/actions/change_tags.js
17419   var change_tags_exports = {};
17420   __export(change_tags_exports, {
17421     actionChangeTags: () => actionChangeTags
17422   });
17423   function actionChangeTags(entityId, tags) {
17424     return function(graph) {
17425       var entity = graph.entity(entityId);
17426       return graph.replace(entity.update({ tags }));
17427     };
17428   }
17429   var init_change_tags = __esm({
17430     "modules/actions/change_tags.js"() {
17431       "use strict";
17432     }
17433   });
17434
17435   // modules/osm/node.js
17436   var node_exports = {};
17437   __export(node_exports, {
17438     cardinal: () => cardinal,
17439     osmNode: () => osmNode
17440   });
17441   function osmNode() {
17442     if (!(this instanceof osmNode)) {
17443       return new osmNode().initialize(arguments);
17444     } else if (arguments.length) {
17445       this.initialize(arguments);
17446     }
17447   }
17448   var cardinal, prototype;
17449   var init_node2 = __esm({
17450     "modules/osm/node.js"() {
17451       "use strict";
17452       init_entity();
17453       init_geo2();
17454       init_util();
17455       init_tags();
17456       cardinal = {
17457         north: 0,
17458         n: 0,
17459         northnortheast: 22,
17460         nne: 22,
17461         northeast: 45,
17462         ne: 45,
17463         eastnortheast: 67,
17464         ene: 67,
17465         east: 90,
17466         e: 90,
17467         eastsoutheast: 112,
17468         ese: 112,
17469         southeast: 135,
17470         se: 135,
17471         southsoutheast: 157,
17472         sse: 157,
17473         south: 180,
17474         s: 180,
17475         southsouthwest: 202,
17476         ssw: 202,
17477         southwest: 225,
17478         sw: 225,
17479         westsouthwest: 247,
17480         wsw: 247,
17481         west: 270,
17482         w: 270,
17483         westnorthwest: 292,
17484         wnw: 292,
17485         northwest: 315,
17486         nw: 315,
17487         northnorthwest: 337,
17488         nnw: 337
17489       };
17490       osmEntity.node = osmNode;
17491       osmNode.prototype = Object.create(osmEntity.prototype);
17492       prototype = {
17493         type: "node",
17494         loc: [9999, 9999],
17495         extent: function() {
17496           return new geoExtent(this.loc);
17497         },
17498         geometry: function(graph) {
17499           return graph.transient(this, "geometry", function() {
17500             return graph.isPoi(this) ? "point" : "vertex";
17501           });
17502         },
17503         move: function(loc) {
17504           return this.update({ loc });
17505         },
17506         isDegenerate: function() {
17507           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);
17508         },
17509         // Inspect tags and geometry to determine which direction(s) this node/vertex points
17510         directions: function(resolver, projection2) {
17511           var val;
17512           var i3;
17513           if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
17514             val = "all";
17515           } else {
17516             val = (this.tags.direction || "").toLowerCase();
17517             var re4 = /:direction$/i;
17518             var keys2 = Object.keys(this.tags);
17519             for (i3 = 0; i3 < keys2.length; i3++) {
17520               if (re4.test(keys2[i3])) {
17521                 val = this.tags[keys2[i3]].toLowerCase();
17522                 break;
17523               }
17524             }
17525           }
17526           if (val === "") return [];
17527           var values = val.split(";");
17528           var results = [];
17529           values.forEach(function(v3) {
17530             if (cardinal[v3] !== void 0) {
17531               v3 = cardinal[v3];
17532             }
17533             if (v3 !== "" && !isNaN(+v3)) {
17534               results.push(+v3);
17535               return;
17536             }
17537             var lookBackward = this.tags["traffic_sign:backward"] || v3 === "backward" || v3 === "both" || v3 === "all";
17538             var lookForward = this.tags["traffic_sign:forward"] || v3 === "forward" || v3 === "both" || v3 === "all";
17539             if (!lookForward && !lookBackward) return;
17540             var nodeIds = {};
17541             resolver.parentWays(this).filter((way) => osmShouldRenderDirection(this.tags, way.tags)).forEach(function(parent2) {
17542               var nodes = parent2.nodes;
17543               for (i3 = 0; i3 < nodes.length; i3++) {
17544                 if (nodes[i3] === this.id) {
17545                   if (lookForward && i3 > 0) {
17546                     nodeIds[nodes[i3 - 1]] = true;
17547                   }
17548                   if (lookBackward && i3 < nodes.length - 1) {
17549                     nodeIds[nodes[i3 + 1]] = true;
17550                   }
17551                 }
17552               }
17553             }, this);
17554             Object.keys(nodeIds).forEach(function(nodeId) {
17555               results.push(
17556                 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
17557               );
17558             }, this);
17559           }, this);
17560           return utilArrayUniq(results);
17561         },
17562         isCrossing: function() {
17563           return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
17564         },
17565         isEndpoint: function(resolver) {
17566           return resolver.transient(this, "isEndpoint", function() {
17567             var id2 = this.id;
17568             return resolver.parentWays(this).filter(function(parent2) {
17569               return !parent2.isClosed() && !!parent2.affix(id2);
17570             }).length > 0;
17571           });
17572         },
17573         isConnected: function(resolver) {
17574           return resolver.transient(this, "isConnected", function() {
17575             var parents = resolver.parentWays(this);
17576             if (parents.length > 1) {
17577               for (var i3 in parents) {
17578                 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
17579               }
17580             } else if (parents.length === 1) {
17581               var way = parents[0];
17582               var nodes = way.nodes.slice();
17583               if (way.isClosed()) {
17584                 nodes.pop();
17585               }
17586               return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
17587             }
17588             return false;
17589           });
17590         },
17591         parentIntersectionWays: function(resolver) {
17592           return resolver.transient(this, "parentIntersectionWays", function() {
17593             return resolver.parentWays(this).filter(function(parent2) {
17594               return (parent2.tags.highway || parent2.tags.waterway || parent2.tags.railway || parent2.tags.aeroway) && parent2.geometry(resolver) === "line";
17595             });
17596           });
17597         },
17598         isIntersection: function(resolver) {
17599           return this.parentIntersectionWays(resolver).length > 1;
17600         },
17601         isHighwayIntersection: function(resolver) {
17602           return resolver.transient(this, "isHighwayIntersection", function() {
17603             return resolver.parentWays(this).filter(function(parent2) {
17604               return parent2.tags.highway && parent2.geometry(resolver) === "line";
17605             }).length > 1;
17606           });
17607         },
17608         isOnAddressLine: function(resolver) {
17609           return resolver.transient(this, "isOnAddressLine", function() {
17610             return resolver.parentWays(this).filter(function(parent2) {
17611               return parent2.tags.hasOwnProperty("addr:interpolation") && parent2.geometry(resolver) === "line";
17612             }).length > 0;
17613           });
17614         },
17615         asJXON: function(changeset_id) {
17616           var r2 = {
17617             node: {
17618               "@id": this.osmId(),
17619               "@lon": this.loc[0],
17620               "@lat": this.loc[1],
17621               "@version": this.version || 0,
17622               tag: Object.keys(this.tags).map(function(k3) {
17623                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
17624               }, this)
17625             }
17626           };
17627           if (changeset_id) r2.node["@changeset"] = changeset_id;
17628           return r2;
17629         },
17630         asGeoJSON: function() {
17631           return {
17632             type: "Point",
17633             coordinates: this.loc
17634           };
17635         }
17636       };
17637       Object.assign(osmNode.prototype, prototype);
17638     }
17639   });
17640
17641   // modules/actions/circularize.js
17642   var circularize_exports = {};
17643   __export(circularize_exports, {
17644     actionCircularize: () => actionCircularize
17645   });
17646   function actionCircularize(wayId, projection2, maxAngle) {
17647     maxAngle = (maxAngle || 20) * Math.PI / 180;
17648     var action = function(graph, t2) {
17649       if (t2 === null || !isFinite(t2)) t2 = 1;
17650       t2 = Math.min(Math.max(+t2, 0), 1);
17651       var way = graph.entity(wayId);
17652       var origNodes = {};
17653       graph.childNodes(way).forEach(function(node2) {
17654         if (!origNodes[node2.id]) origNodes[node2.id] = node2;
17655       });
17656       if (!way.isConvex(graph)) {
17657         graph = action.makeConvex(graph);
17658       }
17659       var nodes = utilArrayUniq(graph.childNodes(way));
17660       var keyNodes = nodes.filter(function(n3) {
17661         return graph.parentWays(n3).length !== 1;
17662       });
17663       var points = nodes.map(function(n3) {
17664         return projection2(n3.loc);
17665       });
17666       var keyPoints = keyNodes.map(function(n3) {
17667         return projection2(n3.loc);
17668       });
17669       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
17670       var radius = median(points, function(p2) {
17671         return geoVecLength(centroid, p2);
17672       });
17673       var sign2 = area_default3(points) > 0 ? 1 : -1;
17674       var ids, i3, j3, k3;
17675       if (!keyNodes.length) {
17676         keyNodes = [nodes[0]];
17677         keyPoints = [points[0]];
17678       }
17679       if (keyNodes.length === 1) {
17680         var index = nodes.indexOf(keyNodes[0]);
17681         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
17682         keyNodes.push(nodes[oppositeIndex]);
17683         keyPoints.push(points[oppositeIndex]);
17684       }
17685       for (i3 = 0; i3 < keyPoints.length; i3++) {
17686         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
17687         var startNode = keyNodes[i3];
17688         var endNode = keyNodes[nextKeyNodeIndex];
17689         var startNodeIndex = nodes.indexOf(startNode);
17690         var endNodeIndex = nodes.indexOf(endNode);
17691         var numberNewPoints = -1;
17692         var indexRange = endNodeIndex - startNodeIndex;
17693         var nearNodes = {};
17694         var inBetweenNodes = [];
17695         var startAngle, endAngle, totalAngle, eachAngle;
17696         var angle2, loc, node, origNode;
17697         if (indexRange < 0) {
17698           indexRange += nodes.length;
17699         }
17700         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
17701         keyPoints[i3] = [
17702           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
17703           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
17704         ];
17705         loc = projection2.invert(keyPoints[i3]);
17706         node = keyNodes[i3];
17707         origNode = origNodes[node.id];
17708         node = node.move(geoVecInterp(origNode.loc, loc, t2));
17709         graph = graph.replace(node);
17710         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
17711         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
17712         totalAngle = endAngle - startAngle;
17713         if (totalAngle * sign2 > 0) {
17714           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
17715         }
17716         do {
17717           numberNewPoints++;
17718           eachAngle = totalAngle / (indexRange + numberNewPoints);
17719         } while (Math.abs(eachAngle) > maxAngle);
17720         for (j3 = 1; j3 < indexRange; j3++) {
17721           angle2 = startAngle + j3 * eachAngle;
17722           loc = projection2.invert([
17723             centroid[0] + Math.cos(angle2) * radius,
17724             centroid[1] + Math.sin(angle2) * radius
17725           ]);
17726           node = nodes[(j3 + startNodeIndex) % nodes.length];
17727           origNode = origNodes[node.id];
17728           nearNodes[node.id] = angle2;
17729           node = node.move(geoVecInterp(origNode.loc, loc, t2));
17730           graph = graph.replace(node);
17731         }
17732         for (j3 = 0; j3 < numberNewPoints; j3++) {
17733           angle2 = startAngle + (indexRange + j3) * eachAngle;
17734           loc = projection2.invert([
17735             centroid[0] + Math.cos(angle2) * radius,
17736             centroid[1] + Math.sin(angle2) * radius
17737           ]);
17738           var min3 = Infinity;
17739           for (var nodeId in nearNodes) {
17740             var nearAngle = nearNodes[nodeId];
17741             var dist = Math.abs(nearAngle - angle2);
17742             if (dist < min3) {
17743               min3 = dist;
17744               origNode = origNodes[nodeId];
17745             }
17746           }
17747           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
17748           graph = graph.replace(node);
17749           nodes.splice(endNodeIndex + j3, 0, node);
17750           inBetweenNodes.push(node.id);
17751         }
17752         if (indexRange === 1 && inBetweenNodes.length) {
17753           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
17754           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
17755           var wayDirection1 = endIndex1 - startIndex1;
17756           if (wayDirection1 < -1) {
17757             wayDirection1 = 1;
17758           }
17759           var parentWays = graph.parentWays(keyNodes[i3]);
17760           for (j3 = 0; j3 < parentWays.length; j3++) {
17761             var sharedWay = parentWays[j3];
17762             if (sharedWay === way) continue;
17763             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
17764               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
17765               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
17766               var wayDirection2 = endIndex2 - startIndex2;
17767               var insertAt = endIndex2;
17768               if (wayDirection2 < -1) {
17769                 wayDirection2 = 1;
17770               }
17771               if (wayDirection1 !== wayDirection2) {
17772                 inBetweenNodes.reverse();
17773                 insertAt = startIndex2;
17774               }
17775               for (k3 = 0; k3 < inBetweenNodes.length; k3++) {
17776                 sharedWay = sharedWay.addNode(inBetweenNodes[k3], insertAt + k3);
17777               }
17778               graph = graph.replace(sharedWay);
17779             }
17780           }
17781         }
17782       }
17783       ids = nodes.map(function(n3) {
17784         return n3.id;
17785       });
17786       ids.push(ids[0]);
17787       way = way.update({ nodes: ids });
17788       graph = graph.replace(way);
17789       return graph;
17790     };
17791     action.makeConvex = function(graph) {
17792       var way = graph.entity(wayId);
17793       var nodes = utilArrayUniq(graph.childNodes(way));
17794       var points = nodes.map(function(n3) {
17795         return projection2(n3.loc);
17796       });
17797       var sign2 = area_default3(points) > 0 ? 1 : -1;
17798       var hull = hull_default(points);
17799       var i3, j3;
17800       if (sign2 === -1) {
17801         nodes.reverse();
17802         points.reverse();
17803       }
17804       for (i3 = 0; i3 < hull.length - 1; i3++) {
17805         var startIndex = points.indexOf(hull[i3]);
17806         var endIndex = points.indexOf(hull[i3 + 1]);
17807         var indexRange = endIndex - startIndex;
17808         if (indexRange < 0) {
17809           indexRange += nodes.length;
17810         }
17811         for (j3 = 1; j3 < indexRange; j3++) {
17812           var point = geoVecInterp(hull[i3], hull[i3 + 1], j3 / indexRange);
17813           var node = nodes[(j3 + startIndex) % nodes.length].move(projection2.invert(point));
17814           graph = graph.replace(node);
17815         }
17816       }
17817       return graph;
17818     };
17819     action.disabled = function(graph) {
17820       if (!graph.entity(wayId).isClosed()) {
17821         return "not_closed";
17822       }
17823       var way = graph.entity(wayId);
17824       var nodes = utilArrayUniq(graph.childNodes(way));
17825       var points = nodes.map(function(n3) {
17826         return projection2(n3.loc);
17827       });
17828       var hull = hull_default(points);
17829       var epsilonAngle = Math.PI / 180;
17830       if (hull.length !== points.length || hull.length < 3) {
17831         return false;
17832       }
17833       var centroid = centroid_default2(points);
17834       var radius = geoVecLengthSquare(centroid, points[0]);
17835       var i3, actualPoint;
17836       for (i3 = 0; i3 < hull.length; i3++) {
17837         actualPoint = hull[i3];
17838         var actualDist = geoVecLengthSquare(actualPoint, centroid);
17839         var diff = Math.abs(actualDist - radius);
17840         if (diff > 0.05 * radius) {
17841           return false;
17842         }
17843       }
17844       for (i3 = 0; i3 < hull.length; i3++) {
17845         actualPoint = hull[i3];
17846         var nextPoint = hull[(i3 + 1) % hull.length];
17847         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
17848         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
17849         var angle2 = endAngle - startAngle;
17850         if (angle2 < 0) {
17851           angle2 = -angle2;
17852         }
17853         if (angle2 > Math.PI) {
17854           angle2 = 2 * Math.PI - angle2;
17855         }
17856         if (angle2 > maxAngle + epsilonAngle) {
17857           return false;
17858         }
17859       }
17860       return "already_circular";
17861     };
17862     action.transitionable = true;
17863     return action;
17864   }
17865   var init_circularize = __esm({
17866     "modules/actions/circularize.js"() {
17867       "use strict";
17868       init_src();
17869       init_src3();
17870       init_geo2();
17871       init_node2();
17872       init_util();
17873       init_vector();
17874     }
17875   });
17876
17877   // modules/actions/delete_way.js
17878   var delete_way_exports = {};
17879   __export(delete_way_exports, {
17880     actionDeleteWay: () => actionDeleteWay
17881   });
17882   function actionDeleteWay(wayID) {
17883     function canDeleteNode(node, graph) {
17884       if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
17885       var geometries = osmNodeGeometriesForTags(node.tags);
17886       if (geometries.point) return false;
17887       if (geometries.vertex) return true;
17888       return !node.hasInterestingTags();
17889     }
17890     var action = function(graph) {
17891       var way = graph.entity(wayID);
17892       graph.parentRelations(way).forEach(function(parent2) {
17893         parent2 = parent2.removeMembersWithID(wayID);
17894         graph = graph.replace(parent2);
17895         if (parent2.isDegenerate()) {
17896           graph = actionDeleteRelation(parent2.id)(graph);
17897         }
17898       });
17899       new Set(way.nodes).forEach(function(nodeID) {
17900         graph = graph.replace(way.removeNode(nodeID));
17901         var node = graph.entity(nodeID);
17902         if (canDeleteNode(node, graph)) {
17903           graph = graph.remove(node);
17904         }
17905       });
17906       return graph.remove(way);
17907     };
17908     return action;
17909   }
17910   var init_delete_way = __esm({
17911     "modules/actions/delete_way.js"() {
17912       "use strict";
17913       init_tags();
17914       init_delete_relation();
17915     }
17916   });
17917
17918   // modules/actions/delete_multiple.js
17919   var delete_multiple_exports = {};
17920   __export(delete_multiple_exports, {
17921     actionDeleteMultiple: () => actionDeleteMultiple
17922   });
17923   function actionDeleteMultiple(ids) {
17924     var actions = {
17925       way: actionDeleteWay,
17926       node: actionDeleteNode,
17927       relation: actionDeleteRelation
17928     };
17929     var action = function(graph) {
17930       ids.forEach(function(id2) {
17931         if (graph.hasEntity(id2)) {
17932           graph = actions[graph.entity(id2).type](id2)(graph);
17933         }
17934       });
17935       return graph;
17936     };
17937     return action;
17938   }
17939   var init_delete_multiple = __esm({
17940     "modules/actions/delete_multiple.js"() {
17941       "use strict";
17942       init_delete_node();
17943       init_delete_relation();
17944       init_delete_way();
17945     }
17946   });
17947
17948   // modules/actions/delete_relation.js
17949   var delete_relation_exports = {};
17950   __export(delete_relation_exports, {
17951     actionDeleteRelation: () => actionDeleteRelation
17952   });
17953   function actionDeleteRelation(relationID, allowUntaggedMembers) {
17954     function canDeleteEntity(entity, graph) {
17955       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
17956     }
17957     var action = function(graph) {
17958       var relation = graph.entity(relationID);
17959       graph.parentRelations(relation).forEach(function(parent2) {
17960         parent2 = parent2.removeMembersWithID(relationID);
17961         graph = graph.replace(parent2);
17962         if (parent2.isDegenerate()) {
17963           graph = actionDeleteRelation(parent2.id)(graph);
17964         }
17965       });
17966       var memberIDs = utilArrayUniq(relation.members.map(function(m3) {
17967         return m3.id;
17968       }));
17969       memberIDs.forEach(function(memberID) {
17970         graph = graph.replace(relation.removeMembersWithID(memberID));
17971         var entity = graph.entity(memberID);
17972         if (canDeleteEntity(entity, graph)) {
17973           graph = actionDeleteMultiple([memberID])(graph);
17974         }
17975       });
17976       return graph.remove(relation);
17977     };
17978     return action;
17979   }
17980   var init_delete_relation = __esm({
17981     "modules/actions/delete_relation.js"() {
17982       "use strict";
17983       init_delete_multiple();
17984       init_util();
17985     }
17986   });
17987
17988   // modules/actions/delete_node.js
17989   var delete_node_exports = {};
17990   __export(delete_node_exports, {
17991     actionDeleteNode: () => actionDeleteNode
17992   });
17993   function actionDeleteNode(nodeId) {
17994     var action = function(graph) {
17995       var node = graph.entity(nodeId);
17996       graph.parentWays(node).forEach(function(parent2) {
17997         parent2 = parent2.removeNode(nodeId);
17998         graph = graph.replace(parent2);
17999         if (parent2.isDegenerate()) {
18000           graph = actionDeleteWay(parent2.id)(graph);
18001         }
18002       });
18003       graph.parentRelations(node).forEach(function(parent2) {
18004         parent2 = parent2.removeMembersWithID(nodeId);
18005         graph = graph.replace(parent2);
18006         if (parent2.isDegenerate()) {
18007           graph = actionDeleteRelation(parent2.id)(graph);
18008         }
18009       });
18010       return graph.remove(node);
18011     };
18012     return action;
18013   }
18014   var init_delete_node = __esm({
18015     "modules/actions/delete_node.js"() {
18016       "use strict";
18017       init_delete_relation();
18018       init_delete_way();
18019     }
18020   });
18021
18022   // modules/actions/connect.js
18023   var connect_exports = {};
18024   __export(connect_exports, {
18025     actionConnect: () => actionConnect
18026   });
18027   function actionConnect(nodeIDs) {
18028     var action = function(graph) {
18029       var survivor;
18030       var node;
18031       var parents;
18032       var i3, j3;
18033       nodeIDs.reverse();
18034       var interestingIDs = [];
18035       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18036         node = graph.entity(nodeIDs[i3]);
18037         if (node.hasInterestingTags()) {
18038           if (!node.isNew()) {
18039             interestingIDs.push(node.id);
18040           }
18041         }
18042       }
18043       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
18044       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18045         node = graph.entity(nodeIDs[i3]);
18046         if (node.id === survivor.id) continue;
18047         parents = graph.parentWays(node);
18048         for (j3 = 0; j3 < parents.length; j3++) {
18049           graph = graph.replace(parents[j3].replaceNode(node.id, survivor.id));
18050         }
18051         parents = graph.parentRelations(node);
18052         for (j3 = 0; j3 < parents.length; j3++) {
18053           graph = graph.replace(parents[j3].replaceMember(node, survivor));
18054         }
18055         survivor = survivor.mergeTags(node.tags);
18056         graph = actionDeleteNode(node.id)(graph);
18057       }
18058       graph = graph.replace(survivor);
18059       parents = graph.parentWays(survivor);
18060       for (i3 = 0; i3 < parents.length; i3++) {
18061         if (parents[i3].isDegenerate()) {
18062           graph = actionDeleteWay(parents[i3].id)(graph);
18063         }
18064       }
18065       return graph;
18066     };
18067     action.disabled = function(graph) {
18068       var seen = {};
18069       var restrictionIDs = [];
18070       var survivor;
18071       var node, way;
18072       var relations, relation, role;
18073       var i3, j3, k3;
18074       survivor = graph.entity(utilOldestID(nodeIDs));
18075       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18076         node = graph.entity(nodeIDs[i3]);
18077         relations = graph.parentRelations(node);
18078         for (j3 = 0; j3 < relations.length; j3++) {
18079           relation = relations[j3];
18080           role = relation.memberById(node.id).role || "";
18081           if (relation.hasFromViaTo()) {
18082             restrictionIDs.push(relation.id);
18083           }
18084           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
18085             return "relation";
18086           } else {
18087             seen[relation.id] = role;
18088           }
18089         }
18090       }
18091       for (i3 = 0; i3 < nodeIDs.length; i3++) {
18092         node = graph.entity(nodeIDs[i3]);
18093         var parents = graph.parentWays(node);
18094         for (j3 = 0; j3 < parents.length; j3++) {
18095           var parent2 = parents[j3];
18096           relations = graph.parentRelations(parent2);
18097           for (k3 = 0; k3 < relations.length; k3++) {
18098             relation = relations[k3];
18099             if (relation.hasFromViaTo()) {
18100               restrictionIDs.push(relation.id);
18101             }
18102           }
18103         }
18104       }
18105       restrictionIDs = utilArrayUniq(restrictionIDs);
18106       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
18107         relation = graph.entity(restrictionIDs[i3]);
18108         if (!relation.isComplete(graph)) continue;
18109         var memberWays = relation.members.filter(function(m3) {
18110           return m3.type === "way";
18111         }).map(function(m3) {
18112           return graph.entity(m3.id);
18113         });
18114         memberWays = utilArrayUniq(memberWays);
18115         var f2 = relation.memberByRole("from");
18116         var t2 = relation.memberByRole("to");
18117         var isUturn = f2.id === t2.id;
18118         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
18119         for (j3 = 0; j3 < relation.members.length; j3++) {
18120           collectNodes(relation.members[j3], nodes);
18121         }
18122         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
18123         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
18124         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
18125         nodes.from = nodes.from.filter(filter2);
18126         nodes.via = nodes.via.filter(filter2);
18127         nodes.to = nodes.to.filter(filter2);
18128         var connectFrom = false;
18129         var connectVia = false;
18130         var connectTo = false;
18131         var connectKeyFrom = false;
18132         var connectKeyTo = false;
18133         for (j3 = 0; j3 < nodeIDs.length; j3++) {
18134           var n3 = nodeIDs[j3];
18135           if (nodes.from.indexOf(n3) !== -1) {
18136             connectFrom = true;
18137           }
18138           if (nodes.via.indexOf(n3) !== -1) {
18139             connectVia = true;
18140           }
18141           if (nodes.to.indexOf(n3) !== -1) {
18142             connectTo = true;
18143           }
18144           if (nodes.keyfrom.indexOf(n3) !== -1) {
18145             connectKeyFrom = true;
18146           }
18147           if (nodes.keyto.indexOf(n3) !== -1) {
18148             connectKeyTo = true;
18149           }
18150         }
18151         if (connectFrom && connectTo && !isUturn) {
18152           return "restriction";
18153         }
18154         if (connectFrom && connectVia) {
18155           return "restriction";
18156         }
18157         if (connectTo && connectVia) {
18158           return "restriction";
18159         }
18160         if (connectKeyFrom || connectKeyTo) {
18161           if (nodeIDs.length !== 2) {
18162             return "restriction";
18163           }
18164           var n0 = null;
18165           var n1 = null;
18166           for (j3 = 0; j3 < memberWays.length; j3++) {
18167             way = memberWays[j3];
18168             if (way.contains(nodeIDs[0])) {
18169               n0 = nodeIDs[0];
18170             }
18171             if (way.contains(nodeIDs[1])) {
18172               n1 = nodeIDs[1];
18173             }
18174           }
18175           if (n0 && n1) {
18176             var ok = false;
18177             for (j3 = 0; j3 < memberWays.length; j3++) {
18178               way = memberWays[j3];
18179               if (way.areAdjacent(n0, n1)) {
18180                 ok = true;
18181                 break;
18182               }
18183             }
18184             if (!ok) {
18185               return "restriction";
18186             }
18187           }
18188         }
18189         for (j3 = 0; j3 < memberWays.length; j3++) {
18190           way = memberWays[j3].update({});
18191           for (k3 = 0; k3 < nodeIDs.length; k3++) {
18192             if (nodeIDs[k3] === survivor.id) continue;
18193             if (way.areAdjacent(nodeIDs[k3], survivor.id)) {
18194               way = way.removeNode(nodeIDs[k3]);
18195             } else {
18196               way = way.replaceNode(nodeIDs[k3], survivor.id);
18197             }
18198           }
18199           if (way.isDegenerate()) {
18200             return "restriction";
18201           }
18202         }
18203       }
18204       return false;
18205       function hasDuplicates(n4, i4, arr) {
18206         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
18207       }
18208       function keyNodeFilter(froms, tos) {
18209         return function(n4) {
18210           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
18211         };
18212       }
18213       function collectNodes(member, collection) {
18214         var entity = graph.hasEntity(member.id);
18215         if (!entity) return;
18216         var role2 = member.role || "";
18217         if (!collection[role2]) {
18218           collection[role2] = [];
18219         }
18220         if (member.type === "node") {
18221           collection[role2].push(member.id);
18222           if (role2 === "via") {
18223             collection.keyfrom.push(member.id);
18224             collection.keyto.push(member.id);
18225           }
18226         } else if (member.type === "way") {
18227           collection[role2].push.apply(collection[role2], entity.nodes);
18228           if (role2 === "from" || role2 === "via") {
18229             collection.keyfrom.push(entity.first());
18230             collection.keyfrom.push(entity.last());
18231           }
18232           if (role2 === "to" || role2 === "via") {
18233             collection.keyto.push(entity.first());
18234             collection.keyto.push(entity.last());
18235           }
18236         }
18237       }
18238     };
18239     return action;
18240   }
18241   var init_connect = __esm({
18242     "modules/actions/connect.js"() {
18243       "use strict";
18244       init_delete_node();
18245       init_delete_way();
18246       init_util();
18247     }
18248   });
18249
18250   // modules/actions/copy_entities.js
18251   var copy_entities_exports = {};
18252   __export(copy_entities_exports, {
18253     actionCopyEntities: () => actionCopyEntities
18254   });
18255   function actionCopyEntities(ids, fromGraph) {
18256     var _copies = {};
18257     var action = function(graph) {
18258       ids.forEach(function(id3) {
18259         fromGraph.entity(id3).copy(fromGraph, _copies);
18260       });
18261       for (var id2 in _copies) {
18262         graph = graph.replace(_copies[id2]);
18263       }
18264       return graph;
18265     };
18266     action.copies = function() {
18267       return _copies;
18268     };
18269     return action;
18270   }
18271   var init_copy_entities = __esm({
18272     "modules/actions/copy_entities.js"() {
18273       "use strict";
18274     }
18275   });
18276
18277   // modules/actions/delete_member.js
18278   var delete_member_exports = {};
18279   __export(delete_member_exports, {
18280     actionDeleteMember: () => actionDeleteMember
18281   });
18282   function actionDeleteMember(relationId, memberIndex) {
18283     return function(graph) {
18284       var relation = graph.entity(relationId).removeMember(memberIndex);
18285       graph = graph.replace(relation);
18286       if (relation.isDegenerate()) {
18287         graph = actionDeleteRelation(relation.id)(graph);
18288       }
18289       return graph;
18290     };
18291   }
18292   var init_delete_member = __esm({
18293     "modules/actions/delete_member.js"() {
18294       "use strict";
18295       init_delete_relation();
18296     }
18297   });
18298
18299   // modules/actions/delete_members.js
18300   var delete_members_exports = {};
18301   __export(delete_members_exports, {
18302     actionDeleteMembers: () => actionDeleteMembers
18303   });
18304   function actionDeleteMembers(relationId, memberIndexes) {
18305     return function(graph) {
18306       memberIndexes.sort((a4, b3) => b3 - a4);
18307       for (var i3 in memberIndexes) {
18308         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
18309       }
18310       return graph;
18311     };
18312   }
18313   var init_delete_members = __esm({
18314     "modules/actions/delete_members.js"() {
18315       "use strict";
18316       init_delete_member();
18317     }
18318   });
18319
18320   // modules/actions/discard_tags.js
18321   var discard_tags_exports = {};
18322   __export(discard_tags_exports, {
18323     actionDiscardTags: () => actionDiscardTags
18324   });
18325   function actionDiscardTags(difference2, discardTags) {
18326     discardTags = discardTags || {};
18327     return (graph) => {
18328       difference2.modified().forEach(checkTags);
18329       difference2.created().forEach(checkTags);
18330       return graph;
18331       function checkTags(entity) {
18332         const keys2 = Object.keys(entity.tags);
18333         let didDiscard = false;
18334         let tags = {};
18335         for (let i3 = 0; i3 < keys2.length; i3++) {
18336           const k3 = keys2[i3];
18337           if (discardTags[k3] || !entity.tags[k3]) {
18338             didDiscard = true;
18339           } else {
18340             tags[k3] = entity.tags[k3];
18341           }
18342         }
18343         if (didDiscard) {
18344           graph = graph.replace(entity.update({ tags }));
18345         }
18346       }
18347     };
18348   }
18349   var init_discard_tags = __esm({
18350     "modules/actions/discard_tags.js"() {
18351       "use strict";
18352     }
18353   });
18354
18355   // modules/actions/disconnect.js
18356   var disconnect_exports = {};
18357   __export(disconnect_exports, {
18358     actionDisconnect: () => actionDisconnect
18359   });
18360   function actionDisconnect(nodeId, newNodeId) {
18361     var wayIds;
18362     var disconnectableRelationTypes = {
18363       "associatedStreet": true,
18364       "enforcement": true,
18365       "site": true
18366     };
18367     var action = function(graph) {
18368       var node = graph.entity(nodeId);
18369       var connections = action.connections(graph);
18370       connections.forEach(function(connection) {
18371         var way = graph.entity(connection.wayID);
18372         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
18373         graph = graph.replace(newNode);
18374         if (connection.index === 0 && way.isArea()) {
18375           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
18376         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
18377           graph = graph.replace(way.unclose().addNode(newNode.id));
18378         } else {
18379           graph = graph.replace(way.updateNode(newNode.id, connection.index));
18380         }
18381       });
18382       return graph;
18383     };
18384     action.connections = function(graph) {
18385       var candidates = [];
18386       var keeping = false;
18387       var parentWays = graph.parentWays(graph.entity(nodeId));
18388       var way, waynode;
18389       for (var i3 = 0; i3 < parentWays.length; i3++) {
18390         way = parentWays[i3];
18391         if (wayIds && wayIds.indexOf(way.id) === -1) {
18392           keeping = true;
18393           continue;
18394         }
18395         if (way.isArea() && way.nodes[0] === nodeId) {
18396           candidates.push({ wayID: way.id, index: 0 });
18397         } else {
18398           for (var j3 = 0; j3 < way.nodes.length; j3++) {
18399             waynode = way.nodes[j3];
18400             if (waynode === nodeId) {
18401               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j3 === way.nodes.length - 1) {
18402                 continue;
18403               }
18404               candidates.push({ wayID: way.id, index: j3 });
18405             }
18406           }
18407         }
18408       }
18409       return keeping ? candidates : candidates.slice(1);
18410     };
18411     action.disabled = function(graph) {
18412       var connections = action.connections(graph);
18413       if (connections.length === 0) return "not_connected";
18414       var parentWays = graph.parentWays(graph.entity(nodeId));
18415       var seenRelationIds = {};
18416       var sharedRelation;
18417       parentWays.forEach(function(way) {
18418         var relations = graph.parentRelations(way);
18419         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
18420           if (relation.id in seenRelationIds) {
18421             if (wayIds) {
18422               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
18423                 sharedRelation = relation;
18424               }
18425             } else {
18426               sharedRelation = relation;
18427             }
18428           } else {
18429             seenRelationIds[relation.id] = way.id;
18430           }
18431         });
18432       });
18433       if (sharedRelation) return "relation";
18434     };
18435     action.limitWays = function(val) {
18436       if (!arguments.length) return wayIds;
18437       wayIds = val;
18438       return action;
18439     };
18440     return action;
18441   }
18442   var init_disconnect = __esm({
18443     "modules/actions/disconnect.js"() {
18444       "use strict";
18445       init_node2();
18446     }
18447   });
18448
18449   // modules/actions/extract.js
18450   var extract_exports = {};
18451   __export(extract_exports, {
18452     actionExtract: () => actionExtract
18453   });
18454   function actionExtract(entityID, projection2) {
18455     var extractedNodeID;
18456     var action = function(graph, shiftKeyPressed) {
18457       var entity = graph.entity(entityID);
18458       if (entity.type === "node") {
18459         return extractFromNode(entity, graph, shiftKeyPressed);
18460       }
18461       return extractFromWayOrRelation(entity, graph);
18462     };
18463     function extractFromNode(node, graph, shiftKeyPressed) {
18464       extractedNodeID = node.id;
18465       var replacement = osmNode({ loc: node.loc });
18466       graph = graph.replace(replacement);
18467       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
18468         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
18469       }, graph);
18470       if (!shiftKeyPressed) return graph;
18471       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
18472         return accGraph.replace(parentRel.replaceMember(node, replacement));
18473       }, graph);
18474     }
18475     function extractFromWayOrRelation(entity, graph) {
18476       var fromGeometry = entity.geometry(graph);
18477       var keysToCopyAndRetain = ["source", "wheelchair"];
18478       var keysToRetain = ["area"];
18479       var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
18480       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
18481       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
18482       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
18483         extractedLoc = entity.extent(graph).center();
18484       }
18485       var indoorAreaValues = {
18486         area: true,
18487         corridor: true,
18488         elevator: true,
18489         level: true,
18490         room: true
18491       };
18492       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
18493       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
18494       var entityTags = Object.assign({}, entity.tags);
18495       var pointTags = {};
18496       for (var key in entityTags) {
18497         if (entity.type === "relation" && key === "type") {
18498           continue;
18499         }
18500         if (keysToRetain.indexOf(key) !== -1) {
18501           continue;
18502         }
18503         if (isBuilding) {
18504           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
18505         }
18506         if (isIndoorArea && key === "indoor") {
18507           continue;
18508         }
18509         pointTags[key] = entityTags[key];
18510         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
18511           continue;
18512         } else if (isIndoorArea && key === "level") {
18513           continue;
18514         }
18515         delete entityTags[key];
18516       }
18517       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
18518         entityTags.area = "yes";
18519       }
18520       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
18521       graph = graph.replace(replacement);
18522       extractedNodeID = replacement.id;
18523       return graph.replace(entity.update({ tags: entityTags }));
18524     }
18525     action.getExtractedNodeID = function() {
18526       return extractedNodeID;
18527     };
18528     return action;
18529   }
18530   var init_extract = __esm({
18531     "modules/actions/extract.js"() {
18532       "use strict";
18533       init_src2();
18534       init_node2();
18535     }
18536   });
18537
18538   // modules/actions/join.js
18539   var join_exports = {};
18540   __export(join_exports, {
18541     actionJoin: () => actionJoin
18542   });
18543   function actionJoin(ids) {
18544     function groupEntitiesByGeometry(graph) {
18545       var entities = ids.map(function(id2) {
18546         return graph.entity(id2);
18547       });
18548       return Object.assign(
18549         { line: [] },
18550         utilArrayGroupBy(entities, function(entity) {
18551           return entity.geometry(graph);
18552         })
18553       );
18554     }
18555     var action = function(graph) {
18556       var ways = ids.map(graph.entity, graph);
18557       var survivorID = utilOldestID(ways.map((way) => way.id));
18558       ways.sort(function(a4, b3) {
18559         var aSided = a4.isSided();
18560         var bSided = b3.isSided();
18561         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
18562       });
18563       var sequences = osmJoinWays(ways, graph);
18564       var joined = sequences[0];
18565       graph = sequences.actions.reduce(function(g3, action2) {
18566         return action2(g3);
18567       }, graph);
18568       var survivor = graph.entity(survivorID);
18569       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
18570         return n3.id;
18571       }) });
18572       graph = graph.replace(survivor);
18573       joined.forEach(function(way) {
18574         if (way.id === survivorID) return;
18575         graph.parentRelations(way).forEach(function(parent2) {
18576           graph = graph.replace(parent2.replaceMember(way, survivor));
18577         });
18578         const summedTags = {};
18579         for (const key in way.tags) {
18580           if (!canSumTags(key, way.tags, survivor.tags)) continue;
18581           summedTags[key] = (+way.tags[key] + +survivor.tags[key]).toString();
18582         }
18583         survivor = survivor.mergeTags(way.tags, summedTags);
18584         graph = graph.replace(survivor);
18585         graph = actionDeleteWay(way.id)(graph);
18586       });
18587       function checkForSimpleMultipolygon() {
18588         if (!survivor.isClosed()) return;
18589         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
18590           return multipolygon2.members.length === 1;
18591         });
18592         if (multipolygons.length !== 1) return;
18593         var multipolygon = multipolygons[0];
18594         for (var key in survivor.tags) {
18595           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
18596           multipolygon.tags[key] !== survivor.tags[key]) return;
18597         }
18598         survivor = survivor.mergeTags(multipolygon.tags);
18599         graph = graph.replace(survivor);
18600         graph = actionDeleteRelation(
18601           multipolygon.id,
18602           true
18603           /* allow untagged members */
18604         )(graph);
18605         var tags = Object.assign({}, survivor.tags);
18606         if (survivor.geometry(graph) !== "area") {
18607           tags.area = "yes";
18608         }
18609         delete tags.type;
18610         survivor = survivor.update({ tags });
18611         graph = graph.replace(survivor);
18612       }
18613       checkForSimpleMultipolygon();
18614       return graph;
18615     };
18616     action.resultingWayNodesLength = function(graph) {
18617       return ids.reduce(function(count, id2) {
18618         return count + graph.entity(id2).nodes.length;
18619       }, 0) - ids.length - 1;
18620     };
18621     action.disabled = function(graph) {
18622       var geometries = groupEntitiesByGeometry(graph);
18623       if (ids.length < 2 || ids.length !== geometries.line.length) {
18624         return "not_eligible";
18625       }
18626       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
18627       if (joined.length > 1) {
18628         return "not_adjacent";
18629       }
18630       var i3;
18631       var sortedParentRelations = function(id2) {
18632         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a4, b3) => a4.id.localeCompare(b3.id));
18633       };
18634       var relsA = sortedParentRelations(ids[0]);
18635       for (i3 = 1; i3 < ids.length; i3++) {
18636         var relsB = sortedParentRelations(ids[i3]);
18637         if (!utilArrayIdentical(relsA, relsB)) {
18638           return "conflicting_relations";
18639         }
18640       }
18641       for (i3 = 0; i3 < ids.length - 1; i3++) {
18642         for (var j3 = i3 + 1; j3 < ids.length; j3++) {
18643           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
18644             return e3.loc;
18645           });
18646           var path2 = graph.childNodes(graph.entity(ids[j3])).map(function(e3) {
18647             return e3.loc;
18648           });
18649           var intersections = geoPathIntersections(path1, path2);
18650           var common = utilArrayIntersection(
18651             joined[0].nodes.map(function(n3) {
18652               return n3.loc.toString();
18653             }),
18654             intersections.map(function(n3) {
18655               return n3.toString();
18656             })
18657           );
18658           if (common.length !== intersections.length) {
18659             return "paths_intersect";
18660           }
18661         }
18662       }
18663       var nodeIds = joined[0].nodes.map(function(n3) {
18664         return n3.id;
18665       }).slice(1, -1);
18666       var relation;
18667       var tags = {};
18668       var conflicting = false;
18669       joined[0].forEach(function(way) {
18670         var parents = graph.parentRelations(way);
18671         parents.forEach(function(parent2) {
18672           if ((parent2.isRestriction() || parent2.isConnectivity()) && parent2.members.some(function(m3) {
18673             return nodeIds.indexOf(m3.id) >= 0;
18674           })) {
18675             relation = parent2;
18676           }
18677         });
18678         for (var k3 in way.tags) {
18679           if (!(k3 in tags)) {
18680             tags[k3] = way.tags[k3];
18681           } else if (canSumTags(k3, tags, way.tags)) {
18682             tags[k3] = (+tags[k3] + +way.tags[k3]).toString();
18683           } else if (tags[k3] && osmIsInterestingTag(k3) && tags[k3] !== way.tags[k3]) {
18684             conflicting = true;
18685           }
18686         }
18687       });
18688       if (relation) {
18689         return relation.isRestriction() ? "restriction" : "connectivity";
18690       }
18691       if (conflicting) {
18692         return "conflicting_tags";
18693       }
18694     };
18695     function canSumTags(key, tagsA, tagsB) {
18696       return osmSummableTags.has(key) && isFinite(tagsA[key] && isFinite(tagsB[key]));
18697     }
18698     return action;
18699   }
18700   var init_join2 = __esm({
18701     "modules/actions/join.js"() {
18702       "use strict";
18703       init_delete_relation();
18704       init_delete_way();
18705       init_tags();
18706       init_multipolygon();
18707       init_geo2();
18708       init_util();
18709     }
18710   });
18711
18712   // modules/actions/merge.js
18713   var merge_exports = {};
18714   __export(merge_exports, {
18715     actionMerge: () => actionMerge
18716   });
18717   function actionMerge(ids) {
18718     function groupEntitiesByGeometry(graph) {
18719       var entities = ids.map(function(id2) {
18720         return graph.entity(id2);
18721       });
18722       return Object.assign(
18723         { point: [], area: [], line: [], relation: [] },
18724         utilArrayGroupBy(entities, function(entity) {
18725           return entity.geometry(graph);
18726         })
18727       );
18728     }
18729     var action = function(graph) {
18730       var geometries = groupEntitiesByGeometry(graph);
18731       var target = geometries.area[0] || geometries.line[0];
18732       var points = geometries.point;
18733       points.forEach(function(point) {
18734         target = target.mergeTags(point.tags);
18735         graph = graph.replace(target);
18736         graph.parentRelations(point).forEach(function(parent2) {
18737           graph = graph.replace(parent2.replaceMember(point, target));
18738         });
18739         var nodes = utilArrayUniq(graph.childNodes(target));
18740         var removeNode = point;
18741         if (!point.isNew()) {
18742           var inserted = false;
18743           var canBeReplaced = function(node2) {
18744             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
18745           };
18746           var replaceNode = function(node2) {
18747             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
18748             target = target.replaceNode(node2.id, point.id);
18749             graph = graph.replace(target);
18750             removeNode = node2;
18751             inserted = true;
18752           };
18753           var i3;
18754           var node;
18755           for (i3 = 0; i3 < nodes.length; i3++) {
18756             node = nodes[i3];
18757             if (canBeReplaced(node) && node.isNew()) {
18758               replaceNode(node);
18759               break;
18760             }
18761           }
18762           if (!inserted && point.hasInterestingTags()) {
18763             for (i3 = 0; i3 < nodes.length; i3++) {
18764               node = nodes[i3];
18765               if (canBeReplaced(node) && !node.hasInterestingTags()) {
18766                 replaceNode(node);
18767                 break;
18768               }
18769             }
18770             if (!inserted) {
18771               for (i3 = 0; i3 < nodes.length; i3++) {
18772                 node = nodes[i3];
18773                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
18774                   replaceNode(node);
18775                   break;
18776                 }
18777               }
18778             }
18779           }
18780         }
18781         graph = graph.remove(removeNode);
18782       });
18783       if (target.tags.area === "yes") {
18784         var tags = Object.assign({}, target.tags);
18785         delete tags.area;
18786         if (osmTagSuggestingArea(tags)) {
18787           target = target.update({ tags });
18788           graph = graph.replace(target);
18789         }
18790       }
18791       return graph;
18792     };
18793     action.disabled = function(graph) {
18794       var geometries = groupEntitiesByGeometry(graph);
18795       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
18796         return "not_eligible";
18797       }
18798     };
18799     return action;
18800   }
18801   var init_merge5 = __esm({
18802     "modules/actions/merge.js"() {
18803       "use strict";
18804       init_tags();
18805       init_util();
18806     }
18807   });
18808
18809   // modules/actions/merge_nodes.js
18810   var merge_nodes_exports = {};
18811   __export(merge_nodes_exports, {
18812     actionMergeNodes: () => actionMergeNodes
18813   });
18814   function actionMergeNodes(nodeIDs, loc) {
18815     function chooseLoc(graph) {
18816       if (!nodeIDs.length) return null;
18817       var sum = [0, 0];
18818       var interestingCount = 0;
18819       var interestingLoc;
18820       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18821         var node = graph.entity(nodeIDs[i3]);
18822         if (node.hasInterestingTags()) {
18823           interestingLoc = ++interestingCount === 1 ? node.loc : null;
18824         }
18825         sum = geoVecAdd(sum, node.loc);
18826       }
18827       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
18828     }
18829     var action = function(graph) {
18830       if (nodeIDs.length < 2) return graph;
18831       var toLoc = loc;
18832       if (!toLoc) {
18833         toLoc = chooseLoc(graph);
18834       }
18835       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18836         var node = graph.entity(nodeIDs[i3]);
18837         if (node.loc !== toLoc) {
18838           graph = graph.replace(node.move(toLoc));
18839         }
18840       }
18841       return actionConnect(nodeIDs)(graph);
18842     };
18843     action.disabled = function(graph) {
18844       if (nodeIDs.length < 2) return "not_eligible";
18845       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18846         var entity = graph.entity(nodeIDs[i3]);
18847         if (entity.type !== "node") return "not_eligible";
18848       }
18849       return actionConnect(nodeIDs).disabled(graph);
18850     };
18851     return action;
18852   }
18853   var init_merge_nodes = __esm({
18854     "modules/actions/merge_nodes.js"() {
18855       "use strict";
18856       init_connect();
18857       init_geo2();
18858     }
18859   });
18860
18861   // modules/osm/changeset.js
18862   var changeset_exports = {};
18863   __export(changeset_exports, {
18864     osmChangeset: () => osmChangeset
18865   });
18866   function osmChangeset() {
18867     if (!(this instanceof osmChangeset)) {
18868       return new osmChangeset().initialize(arguments);
18869     } else if (arguments.length) {
18870       this.initialize(arguments);
18871     }
18872   }
18873   var init_changeset = __esm({
18874     "modules/osm/changeset.js"() {
18875       "use strict";
18876       init_entity();
18877       init_geo2();
18878       osmEntity.changeset = osmChangeset;
18879       osmChangeset.prototype = Object.create(osmEntity.prototype);
18880       Object.assign(osmChangeset.prototype, {
18881         type: "changeset",
18882         extent: function() {
18883           return new geoExtent();
18884         },
18885         geometry: function() {
18886           return "changeset";
18887         },
18888         asJXON: function() {
18889           return {
18890             osm: {
18891               changeset: {
18892                 tag: Object.keys(this.tags).map(function(k3) {
18893                   return { "@k": k3, "@v": this.tags[k3] };
18894                 }, this),
18895                 "@version": 0.6,
18896                 "@generator": "iD"
18897               }
18898             }
18899           };
18900         },
18901         // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
18902         // XML. Returns a string.
18903         osmChangeJXON: function(changes) {
18904           var changeset_id = this.id;
18905           function nest(x2, order) {
18906             var groups = {};
18907             for (var i3 = 0; i3 < x2.length; i3++) {
18908               var tagName = Object.keys(x2[i3])[0];
18909               if (!groups[tagName]) groups[tagName] = [];
18910               groups[tagName].push(x2[i3][tagName]);
18911             }
18912             var ordered = {};
18913             order.forEach(function(o2) {
18914               if (groups[o2]) ordered[o2] = groups[o2];
18915             });
18916             return ordered;
18917           }
18918           function sort(changes2) {
18919             function resolve(item) {
18920               return relations.find(function(relation2) {
18921                 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
18922               });
18923             }
18924             function isNew(item) {
18925               return !sorted[item["@id"]] && !processing.find(function(proc) {
18926                 return proc["@id"] === item["@id"];
18927               });
18928             }
18929             var processing = [];
18930             var sorted = {};
18931             var relations = changes2.relation;
18932             if (!relations) return changes2;
18933             for (var i3 = 0; i3 < relations.length; i3++) {
18934               var relation = relations[i3];
18935               if (!sorted[relation["@id"]]) {
18936                 processing.push(relation);
18937               }
18938               while (processing.length > 0) {
18939                 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
18940                 if (deps.length === 0) {
18941                   sorted[next["@id"]] = next;
18942                   processing.shift();
18943                 } else {
18944                   processing = deps.concat(processing);
18945                 }
18946               }
18947             }
18948             changes2.relation = Object.values(sorted);
18949             return changes2;
18950           }
18951           function rep(entity) {
18952             return entity.asJXON(changeset_id);
18953           }
18954           return {
18955             osmChange: {
18956               "@version": 0.6,
18957               "@generator": "iD",
18958               "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
18959               "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
18960               "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
18961             }
18962           };
18963         },
18964         asGeoJSON: function() {
18965           return {};
18966         }
18967       });
18968     }
18969   });
18970
18971   // modules/osm/note.js
18972   var note_exports = {};
18973   __export(note_exports, {
18974     osmNote: () => osmNote
18975   });
18976   function osmNote() {
18977     if (!(this instanceof osmNote)) {
18978       return new osmNote().initialize(arguments);
18979     } else if (arguments.length) {
18980       this.initialize(arguments);
18981     }
18982   }
18983   var init_note = __esm({
18984     "modules/osm/note.js"() {
18985       "use strict";
18986       init_geo2();
18987       osmNote.id = function() {
18988         return osmNote.id.next--;
18989       };
18990       osmNote.id.next = -1;
18991       Object.assign(osmNote.prototype, {
18992         type: "note",
18993         initialize: function(sources) {
18994           for (var i3 = 0; i3 < sources.length; ++i3) {
18995             var source = sources[i3];
18996             for (var prop in source) {
18997               if (Object.prototype.hasOwnProperty.call(source, prop)) {
18998                 if (source[prop] === void 0) {
18999                   delete this[prop];
19000                 } else {
19001                   this[prop] = source[prop];
19002                 }
19003               }
19004             }
19005           }
19006           if (!this.id) {
19007             this.id = osmNote.id().toString();
19008           }
19009           return this;
19010         },
19011         extent: function() {
19012           return new geoExtent(this.loc);
19013         },
19014         update: function(attrs) {
19015           return osmNote(this, attrs);
19016         },
19017         isNew: function() {
19018           return this.id < 0;
19019         },
19020         move: function(loc) {
19021           return this.update({ loc });
19022         }
19023       });
19024     }
19025   });
19026
19027   // modules/osm/relation.js
19028   var relation_exports = {};
19029   __export(relation_exports, {
19030     osmRelation: () => osmRelation
19031   });
19032   function osmRelation() {
19033     if (!(this instanceof osmRelation)) {
19034       return new osmRelation().initialize(arguments);
19035     } else if (arguments.length) {
19036       this.initialize(arguments);
19037     }
19038   }
19039   var prototype2;
19040   var init_relation = __esm({
19041     "modules/osm/relation.js"() {
19042       "use strict";
19043       init_src2();
19044       init_entity();
19045       init_multipolygon();
19046       init_geo2();
19047       osmEntity.relation = osmRelation;
19048       osmRelation.prototype = Object.create(osmEntity.prototype);
19049       osmRelation.creationOrder = function(a4, b3) {
19050         var aId = parseInt(osmEntity.id.toOSM(a4.id), 10);
19051         var bId = parseInt(osmEntity.id.toOSM(b3.id), 10);
19052         if (aId < 0 || bId < 0) return aId - bId;
19053         return bId - aId;
19054       };
19055       prototype2 = {
19056         type: "relation",
19057         members: [],
19058         copy: function(resolver, copies) {
19059           if (copies[this.id]) return copies[this.id];
19060           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
19061           var members = this.members.map(function(member) {
19062             return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
19063           });
19064           copy2 = copy2.update({ members });
19065           copies[this.id] = copy2;
19066           return copy2;
19067         },
19068         extent: function(resolver, memo) {
19069           return resolver.transient(this, "extent", function() {
19070             if (memo && memo[this.id]) return geoExtent();
19071             memo = memo || {};
19072             memo[this.id] = true;
19073             var extent = geoExtent();
19074             for (var i3 = 0; i3 < this.members.length; i3++) {
19075               var member = resolver.hasEntity(this.members[i3].id);
19076               if (member) {
19077                 extent._extend(member.extent(resolver, memo));
19078               }
19079             }
19080             return extent;
19081           });
19082         },
19083         geometry: function(graph) {
19084           return graph.transient(this, "geometry", function() {
19085             return this.isMultipolygon() ? "area" : "relation";
19086           });
19087         },
19088         isDegenerate: function() {
19089           return this.members.length === 0;
19090         },
19091         // Return an array of members, each extended with an 'index' property whose value
19092         // is the member index.
19093         indexedMembers: function() {
19094           var result = new Array(this.members.length);
19095           for (var i3 = 0; i3 < this.members.length; i3++) {
19096             result[i3] = Object.assign({}, this.members[i3], { index: i3 });
19097           }
19098           return result;
19099         },
19100         // Return the first member with the given role. A copy of the member object
19101         // is returned, extended with an 'index' property whose value is the member index.
19102         memberByRole: function(role) {
19103           for (var i3 = 0; i3 < this.members.length; i3++) {
19104             if (this.members[i3].role === role) {
19105               return Object.assign({}, this.members[i3], { index: i3 });
19106             }
19107           }
19108         },
19109         // Same as memberByRole, but returns all members with the given role
19110         membersByRole: function(role) {
19111           var result = [];
19112           for (var i3 = 0; i3 < this.members.length; i3++) {
19113             if (this.members[i3].role === role) {
19114               result.push(Object.assign({}, this.members[i3], { index: i3 }));
19115             }
19116           }
19117           return result;
19118         },
19119         // Return the first member with the given id. A copy of the member object
19120         // is returned, extended with an 'index' property whose value is the member index.
19121         memberById: function(id2) {
19122           for (var i3 = 0; i3 < this.members.length; i3++) {
19123             if (this.members[i3].id === id2) {
19124               return Object.assign({}, this.members[i3], { index: i3 });
19125             }
19126           }
19127         },
19128         // Return the first member with the given id and role. A copy of the member object
19129         // is returned, extended with an 'index' property whose value is the member index.
19130         memberByIdAndRole: function(id2, role) {
19131           for (var i3 = 0; i3 < this.members.length; i3++) {
19132             if (this.members[i3].id === id2 && this.members[i3].role === role) {
19133               return Object.assign({}, this.members[i3], { index: i3 });
19134             }
19135           }
19136         },
19137         addMember: function(member, index) {
19138           var members = this.members.slice();
19139           members.splice(index === void 0 ? members.length : index, 0, member);
19140           return this.update({ members });
19141         },
19142         updateMember: function(member, index) {
19143           var members = this.members.slice();
19144           members.splice(index, 1, Object.assign({}, members[index], member));
19145           return this.update({ members });
19146         },
19147         removeMember: function(index) {
19148           var members = this.members.slice();
19149           members.splice(index, 1);
19150           return this.update({ members });
19151         },
19152         removeMembersWithID: function(id2) {
19153           var members = this.members.filter(function(m3) {
19154             return m3.id !== id2;
19155           });
19156           return this.update({ members });
19157         },
19158         moveMember: function(fromIndex, toIndex) {
19159           var members = this.members.slice();
19160           members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
19161           return this.update({ members });
19162         },
19163         // Wherever a member appears with id `needle.id`, replace it with a member
19164         // with id `replacement.id`, type `replacement.type`, and the original role,
19165         // By default, adding a duplicate member (by id and role) is prevented.
19166         // Return an updated relation.
19167         replaceMember: function(needle, replacement, keepDuplicates) {
19168           if (!this.memberById(needle.id)) return this;
19169           var members = [];
19170           for (var i3 = 0; i3 < this.members.length; i3++) {
19171             var member = this.members[i3];
19172             if (member.id !== needle.id) {
19173               members.push(member);
19174             } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
19175               members.push({ id: replacement.id, type: replacement.type, role: member.role });
19176             }
19177           }
19178           return this.update({ members });
19179         },
19180         asJXON: function(changeset_id) {
19181           var r2 = {
19182             relation: {
19183               "@id": this.osmId(),
19184               "@version": this.version || 0,
19185               member: this.members.map(function(member) {
19186                 return {
19187                   keyAttributes: {
19188                     type: member.type,
19189                     role: member.role,
19190                     ref: osmEntity.id.toOSM(member.id)
19191                   }
19192                 };
19193               }, this),
19194               tag: Object.keys(this.tags).map(function(k3) {
19195                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
19196               }, this)
19197             }
19198           };
19199           if (changeset_id) {
19200             r2.relation["@changeset"] = changeset_id;
19201           }
19202           return r2;
19203         },
19204         asGeoJSON: function(resolver) {
19205           return resolver.transient(this, "GeoJSON", function() {
19206             if (this.isMultipolygon()) {
19207               return {
19208                 type: "MultiPolygon",
19209                 coordinates: this.multipolygon(resolver)
19210               };
19211             } else {
19212               return {
19213                 type: "FeatureCollection",
19214                 properties: this.tags,
19215                 features: this.members.map(function(member) {
19216                   return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
19217                 })
19218               };
19219             }
19220           });
19221         },
19222         area: function(resolver) {
19223           return resolver.transient(this, "area", function() {
19224             return area_default(this.asGeoJSON(resolver));
19225           });
19226         },
19227         isMultipolygon: function() {
19228           return this.tags.type === "multipolygon";
19229         },
19230         isComplete: function(resolver) {
19231           for (var i3 = 0; i3 < this.members.length; i3++) {
19232             if (!resolver.hasEntity(this.members[i3].id)) {
19233               return false;
19234             }
19235           }
19236           return true;
19237         },
19238         hasFromViaTo: function() {
19239           return this.members.some(function(m3) {
19240             return m3.role === "from";
19241           }) && this.members.some(
19242             (m3) => m3.role === "via" || m3.role === "intersection" && this.tags.type === "destination_sign"
19243           ) && this.members.some(function(m3) {
19244             return m3.role === "to";
19245           });
19246         },
19247         isRestriction: function() {
19248           return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
19249         },
19250         isValidRestriction: function() {
19251           if (!this.isRestriction()) return false;
19252           var froms = this.members.filter(function(m3) {
19253             return m3.role === "from";
19254           });
19255           var vias = this.members.filter(function(m3) {
19256             return m3.role === "via";
19257           });
19258           var tos = this.members.filter(function(m3) {
19259             return m3.role === "to";
19260           });
19261           if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
19262           if (froms.some(function(m3) {
19263             return m3.type !== "way";
19264           })) return false;
19265           if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
19266           if (tos.some(function(m3) {
19267             return m3.type !== "way";
19268           })) return false;
19269           if (vias.length === 0) return false;
19270           if (vias.length > 1 && vias.some(function(m3) {
19271             return m3.type !== "way";
19272           })) return false;
19273           return true;
19274         },
19275         isConnectivity: function() {
19276           return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
19277         },
19278         // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
19279         // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
19280         //
19281         // This corresponds to the structure needed for rendering a multipolygon path using a
19282         // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
19283         //
19284         // In the case of invalid geometries, this function will still return a result which
19285         // includes the nodes of all way members, but some Nds may be unclosed and some inner
19286         // rings not matched with the intended outer ring.
19287         //
19288         multipolygon: function(resolver) {
19289           var outers = this.members.filter(function(m3) {
19290             return "outer" === (m3.role || "outer");
19291           });
19292           var inners = this.members.filter(function(m3) {
19293             return "inner" === m3.role;
19294           });
19295           outers = osmJoinWays(outers, resolver);
19296           inners = osmJoinWays(inners, resolver);
19297           var sequenceToLineString = function(sequence) {
19298             if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
19299               sequence.nodes.push(sequence.nodes[0]);
19300             }
19301             return sequence.nodes.map(function(node) {
19302               return node.loc;
19303             });
19304           };
19305           outers = outers.map(sequenceToLineString);
19306           inners = inners.map(sequenceToLineString);
19307           var result = outers.map(function(o3) {
19308             return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
19309           });
19310           function findOuter(inner2) {
19311             var o3, outer;
19312             for (o3 = 0; o3 < outers.length; o3++) {
19313               outer = outers[o3];
19314               if (geoPolygonContainsPolygon(outer, inner2)) {
19315                 return o3;
19316               }
19317             }
19318             for (o3 = 0; o3 < outers.length; o3++) {
19319               outer = outers[o3];
19320               if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
19321                 return o3;
19322               }
19323             }
19324           }
19325           for (var i3 = 0; i3 < inners.length; i3++) {
19326             var inner = inners[i3];
19327             if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
19328               inner = inner.reverse();
19329             }
19330             var o2 = findOuter(inners[i3]);
19331             if (o2 !== void 0) {
19332               result[o2].push(inners[i3]);
19333             } else {
19334               result.push([inners[i3]]);
19335             }
19336           }
19337           return result;
19338         }
19339       };
19340       Object.assign(osmRelation.prototype, prototype2);
19341     }
19342   });
19343
19344   // modules/osm/qa_item.js
19345   var qa_item_exports = {};
19346   __export(qa_item_exports, {
19347     QAItem: () => QAItem
19348   });
19349   var QAItem;
19350   var init_qa_item = __esm({
19351     "modules/osm/qa_item.js"() {
19352       "use strict";
19353       QAItem = class _QAItem {
19354         constructor(loc, service, itemType, id2, props) {
19355           this.loc = loc;
19356           this.service = service.title;
19357           this.itemType = itemType;
19358           this.id = id2 ? id2 : `${_QAItem.id()}`;
19359           this.update(props);
19360           if (service && typeof service.getIcon === "function") {
19361             this.icon = service.getIcon(itemType);
19362           }
19363         }
19364         update(props) {
19365           const { loc, service, itemType, id: id2 } = this;
19366           Object.keys(props).forEach((prop) => this[prop] = props[prop]);
19367           this.loc = loc;
19368           this.service = service;
19369           this.itemType = itemType;
19370           this.id = id2;
19371           return this;
19372         }
19373         // Generic handling for newly created QAItems
19374         static id() {
19375           return this.nextId--;
19376         }
19377       };
19378       QAItem.nextId = -1;
19379     }
19380   });
19381
19382   // modules/actions/split.js
19383   var split_exports = {};
19384   __export(split_exports, {
19385     actionSplit: () => actionSplit
19386   });
19387   function actionSplit(nodeIds, newWayIds) {
19388     if (typeof nodeIds === "string") nodeIds = [nodeIds];
19389     var _wayIDs;
19390     var _keepHistoryOn = "longest";
19391     const circularJunctions = ["roundabout", "circular"];
19392     var _createdWayIDs = [];
19393     function dist(graph, nA, nB) {
19394       var locA = graph.entity(nA).loc;
19395       var locB = graph.entity(nB).loc;
19396       var epsilon3 = 1e-6;
19397       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
19398     }
19399     function splitArea(nodes, idxA, graph) {
19400       var lengths = new Array(nodes.length);
19401       var length2;
19402       var i3;
19403       var best = 0;
19404       var idxB;
19405       function wrap2(index) {
19406         return utilWrap(index, nodes.length);
19407       }
19408       length2 = 0;
19409       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
19410         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
19411         lengths[i3] = length2;
19412       }
19413       length2 = 0;
19414       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
19415         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
19416         if (length2 < lengths[i3]) {
19417           lengths[i3] = length2;
19418         }
19419       }
19420       for (i3 = 0; i3 < nodes.length; i3++) {
19421         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
19422         if (cost > best) {
19423           idxB = i3;
19424           best = cost;
19425         }
19426       }
19427       return idxB;
19428     }
19429     function totalLengthBetweenNodes(graph, nodes) {
19430       var totalLength = 0;
19431       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
19432         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
19433       }
19434       return totalLength;
19435     }
19436     function split(graph, nodeId, wayA, newWayId, otherNodeIds) {
19437       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
19438       var nodesA;
19439       var nodesB;
19440       var isArea = wayA.isArea();
19441       if (wayA.isClosed()) {
19442         var nodes = wayA.nodes.slice(0, -1);
19443         var idxA = nodes.indexOf(nodeId);
19444         var idxB = otherNodeIds.length > 0 ? nodes.indexOf(otherNodeIds[0]) : splitArea(nodes, idxA, graph);
19445         if (idxB < idxA) {
19446           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
19447           nodesB = nodes.slice(idxB, idxA + 1);
19448         } else {
19449           nodesA = nodes.slice(idxA, idxB + 1);
19450           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
19451         }
19452       } else {
19453         var idx = wayA.nodes.indexOf(nodeId, 1);
19454         nodesA = wayA.nodes.slice(0, idx + 1);
19455         nodesB = wayA.nodes.slice(idx);
19456       }
19457       var lengthA = totalLengthBetweenNodes(graph, nodesA);
19458       var lengthB = totalLengthBetweenNodes(graph, nodesB);
19459       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
19460         wayA = wayA.update({ nodes: nodesB });
19461         wayB = wayB.update({ nodes: nodesA });
19462         var temp = lengthA;
19463         lengthA = lengthB;
19464         lengthB = temp;
19465       } else {
19466         wayA = wayA.update({ nodes: nodesA });
19467         wayB = wayB.update({ nodes: nodesB });
19468       }
19469       for (const key in wayA.tags) {
19470         if (!osmSummableTags.has(key)) continue;
19471         var count = Number(wayA.tags[key]);
19472         if (count && // ensure a number
19473         isFinite(count) && // ensure positive
19474         count > 0 && // ensure integer
19475         Math.round(count) === count) {
19476           var tagsA = Object.assign({}, wayA.tags);
19477           var tagsB = Object.assign({}, wayB.tags);
19478           var ratioA = lengthA / (lengthA + lengthB);
19479           var countA = Math.round(count * ratioA);
19480           tagsA[key] = countA.toString();
19481           tagsB[key] = (count - countA).toString();
19482           wayA = wayA.update({ tags: tagsA });
19483           wayB = wayB.update({ tags: tagsB });
19484         }
19485       }
19486       graph = graph.replace(wayA);
19487       graph = graph.replace(wayB);
19488       graph.parentRelations(wayA).forEach(function(relation) {
19489         if (relation.hasFromViaTo()) {
19490           var f2 = relation.memberByRole("from");
19491           var v3 = [
19492             ...relation.membersByRole("via"),
19493             ...relation.membersByRole("intersection")
19494           ];
19495           var t2 = relation.memberByRole("to");
19496           var i3;
19497           if (f2.id === wayA.id || t2.id === wayA.id) {
19498             var keepB = false;
19499             if (v3.length === 1 && v3[0].type === "node") {
19500               keepB = wayB.contains(v3[0].id);
19501             } else {
19502               for (i3 = 0; i3 < v3.length; i3++) {
19503                 if (v3[i3].type === "way") {
19504                   var wayVia = graph.hasEntity(v3[i3].id);
19505                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
19506                     keepB = true;
19507                     break;
19508                   }
19509                 }
19510               }
19511             }
19512             if (keepB) {
19513               relation = relation.replaceMember(wayA, wayB);
19514               graph = graph.replace(relation);
19515             }
19516           } else {
19517             for (i3 = 0; i3 < v3.length; i3++) {
19518               if (v3[i3].type === "way" && v3[i3].id === wayA.id) {
19519                 graph = splitWayMember(graph, relation.id, wayA, wayB);
19520               }
19521             }
19522           }
19523         } else {
19524           graph = splitWayMember(graph, relation.id, wayA, wayB);
19525         }
19526       });
19527       if (isArea) {
19528         var multipolygon = osmRelation({
19529           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
19530           members: [
19531             { id: wayA.id, role: "outer", type: "way" },
19532             { id: wayB.id, role: "outer", type: "way" }
19533           ]
19534         });
19535         graph = graph.replace(multipolygon);
19536         graph = graph.replace(wayA.update({ tags: {} }));
19537         graph = graph.replace(wayB.update({ tags: {} }));
19538       }
19539       _createdWayIDs.push(wayB.id);
19540       return graph;
19541     }
19542     function splitWayMember(graph, relationId, wayA, wayB) {
19543       function connects(way1, way2) {
19544         if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
19545         if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
19546           return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
19547         } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
19548           return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
19549         }
19550         if (way1.nodes[0] === way2.nodes[0]) return true;
19551         if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
19552         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
19553         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
19554         return false;
19555       }
19556       let relation = graph.entity(relationId);
19557       const insertMembers = [];
19558       const members = relation.members;
19559       for (let i3 = 0; i3 < members.length; i3++) {
19560         const member = members[i3];
19561         if (member.id === wayA.id) {
19562           let wayAconnectsPrev = false;
19563           let wayAconnectsNext = false;
19564           let wayBconnectsPrev = false;
19565           let wayBconnectsNext = false;
19566           if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
19567             const prevEntity = graph.entity(members[i3 - 1].id);
19568             if (prevEntity.type === "way") {
19569               wayAconnectsPrev = connects(prevEntity, wayA);
19570               wayBconnectsPrev = connects(prevEntity, wayB);
19571             }
19572           }
19573           if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
19574             const nextEntity = graph.entity(members[i3 + 1].id);
19575             if (nextEntity.type === "way") {
19576               wayAconnectsNext = connects(nextEntity, wayA);
19577               wayBconnectsNext = connects(nextEntity, wayB);
19578             }
19579           }
19580           if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
19581             insertMembers.push({ at: i3 + 1, role: member.role });
19582             continue;
19583           }
19584           if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
19585             insertMembers.push({ at: i3, role: member.role });
19586             continue;
19587           }
19588           if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
19589             if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
19590               const prev2Entity = graph.entity(members[i3 - 2].id);
19591               if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
19592                 insertMembers.push({ at: i3, role: member.role });
19593                 continue;
19594               }
19595               if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
19596                 insertMembers.push({ at: i3 + 1, role: member.role });
19597                 continue;
19598               }
19599             }
19600             if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
19601               const next2Entity = graph.entity(members[i3 + 2].id);
19602               if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
19603                 insertMembers.push({ at: i3 + 1, role: member.role });
19604                 continue;
19605               }
19606               if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
19607                 insertMembers.push({ at: i3, role: member.role });
19608                 continue;
19609               }
19610             }
19611           }
19612           if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
19613             insertMembers.push({ at: i3 + 1, role: member.role });
19614           } else {
19615             insertMembers.push({ at: i3, role: member.role });
19616           }
19617         }
19618       }
19619       insertMembers.reverse().forEach((item) => {
19620         graph = graph.replace(relation.addMember({
19621           id: wayB.id,
19622           type: "way",
19623           role: item.role
19624         }, item.at));
19625         relation = graph.entity(relation.id);
19626       });
19627       return graph;
19628     }
19629     const action = function(graph) {
19630       _createdWayIDs = [];
19631       let newWayIndex = 0;
19632       for (const i3 in nodeIds) {
19633         const nodeId = nodeIds[i3];
19634         const candidates = waysForNodes(nodeIds.slice(i3), graph);
19635         for (const candidate of candidates) {
19636           graph = split(graph, nodeId, candidate, newWayIds && newWayIds[newWayIndex], nodeIds.slice(i3 + 1));
19637           newWayIndex += 1;
19638         }
19639       }
19640       return graph;
19641     };
19642     action.getCreatedWayIDs = function() {
19643       return _createdWayIDs;
19644     };
19645     function waysForNodes(nodeIds2, graph) {
19646       const splittableWays = nodeIds2.map((nodeId) => waysForNode(nodeId, graph)).reduce((cur, acc) => utilArrayIntersection(cur, acc));
19647       if (!_wayIDs) {
19648         const hasLine = splittableWays.some((way) => way.geometry(graph) === "line");
19649         if (hasLine) {
19650           return splittableWays.filter((way) => way.geometry(graph) === "line");
19651         }
19652       }
19653       return splittableWays;
19654     }
19655     function waysForNode(nodeId, graph) {
19656       const node = graph.entity(nodeId);
19657       return graph.parentWays(node).filter(isSplittable);
19658       function isSplittable(way) {
19659         if (_wayIDs && _wayIDs.indexOf(way.id) === -1) return false;
19660         if (way.isClosed()) return true;
19661         for (let i3 = 1; i3 < way.nodes.length - 1; i3++) {
19662           if (way.nodes[i3] === nodeId) return true;
19663         }
19664         return false;
19665       }
19666     }
19667     ;
19668     action.ways = function(graph) {
19669       return waysForNodes(nodeIds, graph);
19670     };
19671     action.disabled = function(graph) {
19672       const candidates = waysForNodes(nodeIds, graph);
19673       if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
19674         return "not_eligible";
19675       }
19676       for (const way of candidates) {
19677         const parentRelations = graph.parentRelations(way);
19678         for (const parentRelation of parentRelations) {
19679           if (parentRelation.hasFromViaTo()) {
19680             const vias = [
19681               ...parentRelation.membersByRole("via"),
19682               ...parentRelation.membersByRole("intersection")
19683             ];
19684             if (!vias.every((via) => graph.hasEntity(via.id))) {
19685               return "parent_incomplete";
19686             }
19687           } else {
19688             for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
19689               if (parentRelation.members[i3].id === way.id) {
19690                 const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
19691                 const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
19692                 if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
19693                   return "parent_incomplete";
19694                 }
19695               }
19696             }
19697           }
19698           const relTypesExceptions = ["junction", "enforcement"];
19699           if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
19700             return "simple_roundabout";
19701           }
19702         }
19703       }
19704     };
19705     action.limitWays = function(val) {
19706       if (!arguments.length) return _wayIDs;
19707       _wayIDs = val;
19708       return action;
19709     };
19710     action.keepHistoryOn = function(val) {
19711       if (!arguments.length) return _keepHistoryOn;
19712       _keepHistoryOn = val;
19713       return action;
19714     };
19715     return action;
19716   }
19717   var init_split = __esm({
19718     "modules/actions/split.js"() {
19719       "use strict";
19720       init_geo();
19721       init_relation();
19722       init_way();
19723       init_util();
19724       init_tags();
19725     }
19726   });
19727
19728   // modules/core/graph.js
19729   var graph_exports = {};
19730   __export(graph_exports, {
19731     coreGraph: () => coreGraph
19732   });
19733   function coreGraph(other, mutable) {
19734     if (!(this instanceof coreGraph)) return new coreGraph(other, mutable);
19735     if (other instanceof coreGraph) {
19736       var base = other.base();
19737       this.entities = Object.assign(Object.create(base.entities), other.entities);
19738       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
19739       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
19740     } else {
19741       this.entities = /* @__PURE__ */ Object.create({});
19742       this._parentWays = /* @__PURE__ */ Object.create({});
19743       this._parentRels = /* @__PURE__ */ Object.create({});
19744       this.rebase(other || [], [this]);
19745     }
19746     this.transients = {};
19747     this._childNodes = {};
19748     this.frozen = !mutable;
19749   }
19750   var init_graph = __esm({
19751     "modules/core/graph.js"() {
19752       "use strict";
19753       init_index();
19754       init_util();
19755       coreGraph.prototype = {
19756         hasEntity: function(id2) {
19757           return this.entities[id2];
19758         },
19759         entity: function(id2) {
19760           var entity = this.entities[id2];
19761           if (!entity) {
19762             throw new Error("entity " + id2 + " not found");
19763           }
19764           return entity;
19765         },
19766         geometry: function(id2) {
19767           return this.entity(id2).geometry(this);
19768         },
19769         transient: function(entity, key, fn) {
19770           var id2 = entity.id;
19771           var transients = this.transients[id2] || (this.transients[id2] = {});
19772           if (transients[key] !== void 0) {
19773             return transients[key];
19774           }
19775           transients[key] = fn.call(entity);
19776           return transients[key];
19777         },
19778         parentWays: function(entity) {
19779           var parents = this._parentWays[entity.id];
19780           var result = [];
19781           if (parents) {
19782             parents.forEach(function(id2) {
19783               result.push(this.entity(id2));
19784             }, this);
19785           }
19786           return result;
19787         },
19788         isPoi: function(entity) {
19789           var parents = this._parentWays[entity.id];
19790           return !parents || parents.size === 0;
19791         },
19792         isShared: function(entity) {
19793           var parents = this._parentWays[entity.id];
19794           return parents && parents.size > 1;
19795         },
19796         parentRelations: function(entity) {
19797           var parents = this._parentRels[entity.id];
19798           var result = [];
19799           if (parents) {
19800             parents.forEach(function(id2) {
19801               result.push(this.entity(id2));
19802             }, this);
19803           }
19804           return result;
19805         },
19806         parentMultipolygons: function(entity) {
19807           return this.parentRelations(entity).filter(function(relation) {
19808             return relation.isMultipolygon();
19809           });
19810         },
19811         childNodes: function(entity) {
19812           if (this._childNodes[entity.id]) return this._childNodes[entity.id];
19813           if (!entity.nodes) return [];
19814           var nodes = [];
19815           for (var i3 = 0; i3 < entity.nodes.length; i3++) {
19816             nodes[i3] = this.entity(entity.nodes[i3]);
19817           }
19818           if (debug) Object.freeze(nodes);
19819           this._childNodes[entity.id] = nodes;
19820           return this._childNodes[entity.id];
19821         },
19822         base: function() {
19823           return {
19824             "entities": Object.getPrototypeOf(this.entities),
19825             "parentWays": Object.getPrototypeOf(this._parentWays),
19826             "parentRels": Object.getPrototypeOf(this._parentRels)
19827           };
19828         },
19829         // Unlike other graph methods, rebase mutates in place. This is because it
19830         // is used only during the history operation that merges newly downloaded
19831         // data into each state. To external consumers, it should appear as if the
19832         // graph always contained the newly downloaded data.
19833         rebase: function(entities, stack, force) {
19834           var base = this.base();
19835           var i3, j3, k3, id2;
19836           for (i3 = 0; i3 < entities.length; i3++) {
19837             var entity = entities[i3];
19838             if (!entity.visible || !force && base.entities[entity.id]) continue;
19839             base.entities[entity.id] = entity;
19840             this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
19841             if (entity.type === "way") {
19842               for (j3 = 0; j3 < entity.nodes.length; j3++) {
19843                 id2 = entity.nodes[j3];
19844                 for (k3 = 1; k3 < stack.length; k3++) {
19845                   var ents = stack[k3].entities;
19846                   if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
19847                     delete ents[id2];
19848                   }
19849                 }
19850               }
19851             }
19852           }
19853           for (i3 = 0; i3 < stack.length; i3++) {
19854             stack[i3]._updateRebased();
19855           }
19856         },
19857         _updateRebased: function() {
19858           var base = this.base();
19859           Object.keys(this._parentWays).forEach(function(child) {
19860             if (base.parentWays[child]) {
19861               base.parentWays[child].forEach(function(id2) {
19862                 if (!this.entities.hasOwnProperty(id2)) {
19863                   this._parentWays[child].add(id2);
19864                 }
19865               }, this);
19866             }
19867           }, this);
19868           Object.keys(this._parentRels).forEach(function(child) {
19869             if (base.parentRels[child]) {
19870               base.parentRels[child].forEach(function(id2) {
19871                 if (!this.entities.hasOwnProperty(id2)) {
19872                   this._parentRels[child].add(id2);
19873                 }
19874               }, this);
19875             }
19876           }, this);
19877           this.transients = {};
19878         },
19879         // Updates calculated properties (parentWays, parentRels) for the specified change
19880         _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
19881           parentWays = parentWays || this._parentWays;
19882           parentRels = parentRels || this._parentRels;
19883           var type2 = entity && entity.type || oldentity && oldentity.type;
19884           var removed, added, i3;
19885           if (type2 === "way") {
19886             if (oldentity && entity) {
19887               removed = utilArrayDifference(oldentity.nodes, entity.nodes);
19888               added = utilArrayDifference(entity.nodes, oldentity.nodes);
19889             } else if (oldentity) {
19890               removed = oldentity.nodes;
19891               added = [];
19892             } else if (entity) {
19893               removed = [];
19894               added = entity.nodes;
19895             }
19896             for (i3 = 0; i3 < removed.length; i3++) {
19897               parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
19898               parentWays[removed[i3]].delete(oldentity.id);
19899             }
19900             for (i3 = 0; i3 < added.length; i3++) {
19901               parentWays[added[i3]] = new Set(parentWays[added[i3]]);
19902               parentWays[added[i3]].add(entity.id);
19903             }
19904           } else if (type2 === "relation") {
19905             var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m3) {
19906               return m3.id;
19907             }) : [];
19908             var entityMemberIDs = entity ? entity.members.map(function(m3) {
19909               return m3.id;
19910             }) : [];
19911             if (oldentity && entity) {
19912               removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
19913               added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
19914             } else if (oldentity) {
19915               removed = oldentityMemberIDs;
19916               added = [];
19917             } else if (entity) {
19918               removed = [];
19919               added = entityMemberIDs;
19920             }
19921             for (i3 = 0; i3 < removed.length; i3++) {
19922               parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
19923               parentRels[removed[i3]].delete(oldentity.id);
19924             }
19925             for (i3 = 0; i3 < added.length; i3++) {
19926               parentRels[added[i3]] = new Set(parentRels[added[i3]]);
19927               parentRels[added[i3]].add(entity.id);
19928             }
19929           }
19930         },
19931         replace: function(entity) {
19932           if (this.entities[entity.id] === entity) return this;
19933           return this.update(function() {
19934             this._updateCalculated(this.entities[entity.id], entity);
19935             this.entities[entity.id] = entity;
19936           });
19937         },
19938         remove: function(entity) {
19939           return this.update(function() {
19940             this._updateCalculated(entity, void 0);
19941             this.entities[entity.id] = void 0;
19942           });
19943         },
19944         revert: function(id2) {
19945           var baseEntity = this.base().entities[id2];
19946           var headEntity = this.entities[id2];
19947           if (headEntity === baseEntity) return this;
19948           return this.update(function() {
19949             this._updateCalculated(headEntity, baseEntity);
19950             delete this.entities[id2];
19951           });
19952         },
19953         update: function() {
19954           var graph = this.frozen ? coreGraph(this, true) : this;
19955           for (var i3 = 0; i3 < arguments.length; i3++) {
19956             arguments[i3].call(graph, graph);
19957           }
19958           if (this.frozen) graph.frozen = true;
19959           return graph;
19960         },
19961         // Obliterates any existing entities
19962         load: function(entities) {
19963           var base = this.base();
19964           this.entities = Object.create(base.entities);
19965           for (var i3 in entities) {
19966             this.entities[i3] = entities[i3];
19967             this._updateCalculated(base.entities[i3], this.entities[i3]);
19968           }
19969           return this;
19970         }
19971       };
19972     }
19973   });
19974
19975   // modules/osm/intersection.js
19976   var intersection_exports = {};
19977   __export(intersection_exports, {
19978     osmInferRestriction: () => osmInferRestriction,
19979     osmIntersection: () => osmIntersection,
19980     osmTurn: () => osmTurn
19981   });
19982   function osmTurn(turn) {
19983     if (!(this instanceof osmTurn)) {
19984       return new osmTurn(turn);
19985     }
19986     Object.assign(this, turn);
19987   }
19988   function osmIntersection(graph, startVertexId, maxDistance) {
19989     maxDistance = maxDistance || 30;
19990     var vgraph = coreGraph();
19991     var i3, j3, k3;
19992     function memberOfRestriction(entity) {
19993       return graph.parentRelations(entity).some(function(r2) {
19994         return r2.isRestriction();
19995       });
19996     }
19997     function isRoad(way2) {
19998       if (way2.isArea() || way2.isDegenerate()) return false;
19999       var roads = {
20000         "motorway": true,
20001         "motorway_link": true,
20002         "trunk": true,
20003         "trunk_link": true,
20004         "primary": true,
20005         "primary_link": true,
20006         "secondary": true,
20007         "secondary_link": true,
20008         "tertiary": true,
20009         "tertiary_link": true,
20010         "residential": true,
20011         "unclassified": true,
20012         "living_street": true,
20013         "service": true,
20014         "busway": true,
20015         "road": true,
20016         "track": true
20017       };
20018       return roads[way2.tags.highway];
20019     }
20020     var startNode = graph.entity(startVertexId);
20021     var checkVertices = [startNode];
20022     var checkWays;
20023     var vertices = [];
20024     var vertexIds = [];
20025     var vertex;
20026     var ways = [];
20027     var wayIds = [];
20028     var way;
20029     var nodes = [];
20030     var node;
20031     var parents = [];
20032     var parent2;
20033     var actions = [];
20034     while (checkVertices.length) {
20035       vertex = checkVertices.pop();
20036       checkWays = graph.parentWays(vertex);
20037       var hasWays = false;
20038       for (i3 = 0; i3 < checkWays.length; i3++) {
20039         way = checkWays[i3];
20040         if (!isRoad(way) && !memberOfRestriction(way)) continue;
20041         ways.push(way);
20042         hasWays = true;
20043         nodes = utilArrayUniq(graph.childNodes(way));
20044         for (j3 = 0; j3 < nodes.length; j3++) {
20045           node = nodes[j3];
20046           if (node === vertex) continue;
20047           if (vertices.indexOf(node) !== -1) continue;
20048           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
20049           var hasParents = false;
20050           parents = graph.parentWays(node);
20051           for (k3 = 0; k3 < parents.length; k3++) {
20052             parent2 = parents[k3];
20053             if (parent2 === way) continue;
20054             if (ways.indexOf(parent2) !== -1) continue;
20055             if (!isRoad(parent2)) continue;
20056             hasParents = true;
20057             break;
20058           }
20059           if (hasParents) {
20060             checkVertices.push(node);
20061           }
20062         }
20063       }
20064       if (hasWays) {
20065         vertices.push(vertex);
20066       }
20067     }
20068     vertices = utilArrayUniq(vertices);
20069     ways = utilArrayUniq(ways);
20070     ways.forEach(function(way2) {
20071       graph.childNodes(way2).forEach(function(node2) {
20072         vgraph = vgraph.replace(node2);
20073       });
20074       vgraph = vgraph.replace(way2);
20075       graph.parentRelations(way2).forEach(function(relation) {
20076         if (relation.isRestriction()) {
20077           if (relation.isValidRestriction(graph)) {
20078             vgraph = vgraph.replace(relation);
20079           } else if (relation.isComplete(graph)) {
20080             actions.push(actionDeleteRelation(relation.id));
20081           }
20082         }
20083       });
20084     });
20085     ways.forEach(function(w3) {
20086       var way2 = vgraph.entity(w3.id);
20087       if (way2.tags.oneway === "-1") {
20088         var action = actionReverse(way2.id, { reverseOneway: true });
20089         actions.push(action);
20090         vgraph = action(vgraph);
20091       }
20092     });
20093     var origCount = osmEntity.id.next.way;
20094     vertices.forEach(function(v3) {
20095       var splitAll = actionSplit([v3.id]).keepHistoryOn("first");
20096       if (!splitAll.disabled(vgraph)) {
20097         splitAll.ways(vgraph).forEach(function(way2) {
20098           var splitOne = actionSplit([v3.id]).limitWays([way2.id]).keepHistoryOn("first");
20099           actions.push(splitOne);
20100           vgraph = splitOne(vgraph);
20101         });
20102       }
20103     });
20104     osmEntity.id.next.way = origCount;
20105     vertexIds = vertices.map(function(v3) {
20106       return v3.id;
20107     });
20108     vertices = [];
20109     ways = [];
20110     vertexIds.forEach(function(id2) {
20111       var vertex2 = vgraph.entity(id2);
20112       var parents2 = vgraph.parentWays(vertex2);
20113       vertices.push(vertex2);
20114       ways = ways.concat(parents2);
20115     });
20116     vertices = utilArrayUniq(vertices);
20117     ways = utilArrayUniq(ways);
20118     vertexIds = vertices.map(function(v3) {
20119       return v3.id;
20120     });
20121     wayIds = ways.map(function(w3) {
20122       return w3.id;
20123     });
20124     function withMetadata(way2, vertexIds2) {
20125       var __oneWay = way2.isOneWay() && !way2.isBiDirectional();
20126       var __first = vertexIds2.indexOf(way2.first()) !== -1;
20127       var __last = vertexIds2.indexOf(way2.last()) !== -1;
20128       var __via = __first && __last;
20129       var __from = __first && !__oneWay || __last;
20130       var __to = __first || __last && !__oneWay;
20131       return way2.update({
20132         __first,
20133         __last,
20134         __from,
20135         __via,
20136         __to,
20137         __oneWay
20138       });
20139     }
20140     ways = [];
20141     wayIds.forEach(function(id2) {
20142       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
20143       vgraph = vgraph.replace(way2);
20144       ways.push(way2);
20145     });
20146     var keepGoing;
20147     var removeWayIds = [];
20148     var removeVertexIds = [];
20149     do {
20150       keepGoing = false;
20151       checkVertices = vertexIds.slice();
20152       for (i3 = 0; i3 < checkVertices.length; i3++) {
20153         var vertexId = checkVertices[i3];
20154         vertex = vgraph.hasEntity(vertexId);
20155         if (!vertex) {
20156           if (vertexIds.indexOf(vertexId) !== -1) {
20157             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20158           }
20159           removeVertexIds.push(vertexId);
20160           continue;
20161         }
20162         parents = vgraph.parentWays(vertex);
20163         if (parents.length < 3) {
20164           if (vertexIds.indexOf(vertexId) !== -1) {
20165             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20166           }
20167         }
20168         if (parents.length === 2) {
20169           var a4 = parents[0];
20170           var b3 = parents[1];
20171           var aIsLeaf = a4 && !a4.__via;
20172           var bIsLeaf = b3 && !b3.__via;
20173           var leaf, survivor;
20174           if (aIsLeaf && !bIsLeaf) {
20175             leaf = a4;
20176             survivor = b3;
20177           } else if (!aIsLeaf && bIsLeaf) {
20178             leaf = b3;
20179             survivor = a4;
20180           }
20181           if (leaf && survivor) {
20182             survivor = withMetadata(survivor, vertexIds);
20183             vgraph = vgraph.replace(survivor).remove(leaf);
20184             removeWayIds.push(leaf.id);
20185             keepGoing = true;
20186           }
20187         }
20188         parents = vgraph.parentWays(vertex);
20189         if (parents.length < 2) {
20190           if (vertexIds.indexOf(vertexId) !== -1) {
20191             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
20192           }
20193           removeVertexIds.push(vertexId);
20194           keepGoing = true;
20195         }
20196         if (parents.length < 1) {
20197           vgraph = vgraph.remove(vertex);
20198         }
20199       }
20200     } while (keepGoing);
20201     vertices = vertices.filter(function(vertex2) {
20202       return removeVertexIds.indexOf(vertex2.id) === -1;
20203     }).map(function(vertex2) {
20204       return vgraph.entity(vertex2.id);
20205     });
20206     ways = ways.filter(function(way2) {
20207       return removeWayIds.indexOf(way2.id) === -1;
20208     }).map(function(way2) {
20209       return vgraph.entity(way2.id);
20210     });
20211     var intersection2 = {
20212       graph: vgraph,
20213       actions,
20214       vertices,
20215       ways
20216     };
20217     intersection2.turns = function(fromWayId, maxViaWay) {
20218       if (!fromWayId) return [];
20219       if (!maxViaWay) maxViaWay = 0;
20220       var vgraph2 = intersection2.graph;
20221       var keyVertexIds = intersection2.vertices.map(function(v3) {
20222         return v3.id;
20223       });
20224       var start2 = vgraph2.entity(fromWayId);
20225       if (!start2 || !(start2.__from || start2.__via)) return [];
20226       var maxPathLength = maxViaWay * 2 + 3;
20227       var turns = [];
20228       step(start2);
20229       return turns;
20230       function step(entity, currPath, currRestrictions, matchedRestriction) {
20231         currPath = (currPath || []).slice();
20232         if (currPath.length >= maxPathLength) return;
20233         currPath.push(entity.id);
20234         currRestrictions = (currRestrictions || []).slice();
20235         if (entity.type === "node") {
20236           stepNode(entity, currPath, currRestrictions);
20237         } else {
20238           stepWay(entity, currPath, currRestrictions, matchedRestriction);
20239         }
20240       }
20241       function stepNode(entity, currPath, currRestrictions) {
20242         var i4, j4;
20243         var parents2 = vgraph2.parentWays(entity);
20244         var nextWays = [];
20245         for (i4 = 0; i4 < parents2.length; i4++) {
20246           var way2 = parents2[i4];
20247           if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
20248           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
20249           var restrict = null;
20250           for (j4 = 0; j4 < currRestrictions.length; j4++) {
20251             var restriction = currRestrictions[j4];
20252             var f2 = restriction.memberByRole("from");
20253             var v3 = restriction.membersByRole("via");
20254             var t2 = restriction.memberByRole("to");
20255             var isNo = /^no_/.test(restriction.tags.restriction);
20256             var isOnly = /^only_/.test(restriction.tags.restriction);
20257             if (!(isNo || isOnly)) {
20258               continue;
20259             }
20260             var matchesFrom = f2.id === fromWayId;
20261             var matchesViaTo = false;
20262             var isAlongOnlyPath = false;
20263             if (t2.id === way2.id) {
20264               if (v3.length === 1 && v3[0].type === "node") {
20265                 matchesViaTo = v3[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
20266               } else {
20267                 var pathVias = [];
20268                 for (k3 = 2; k3 < currPath.length; k3 += 2) {
20269                   pathVias.push(currPath[k3]);
20270                 }
20271                 var restrictionVias = [];
20272                 for (k3 = 0; k3 < v3.length; k3++) {
20273                   if (v3[k3].type === "way") {
20274                     restrictionVias.push(v3[k3].id);
20275                   }
20276                 }
20277                 var diff = utilArrayDifference(pathVias, restrictionVias);
20278                 matchesViaTo = !diff.length;
20279               }
20280             } else if (isOnly) {
20281               for (k3 = 0; k3 < v3.length; k3++) {
20282                 if (v3[k3].type === "way" && v3[k3].id === way2.id) {
20283                   isAlongOnlyPath = true;
20284                   break;
20285                 }
20286               }
20287             }
20288             if (matchesViaTo) {
20289               if (isOnly) {
20290                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
20291               } else {
20292                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
20293               }
20294             } else {
20295               if (isAlongOnlyPath) {
20296                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
20297               } else if (isOnly) {
20298                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
20299               }
20300             }
20301             if (restrict && restrict.direct) break;
20302           }
20303           nextWays.push({ way: way2, restrict });
20304         }
20305         nextWays.forEach(function(nextWay) {
20306           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
20307         });
20308       }
20309       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
20310         var i4;
20311         if (currPath.length >= 3) {
20312           var turnPath = currPath.slice();
20313           if (matchedRestriction && matchedRestriction.direct === false) {
20314             for (i4 = 0; i4 < turnPath.length; i4++) {
20315               if (turnPath[i4] === matchedRestriction.from) {
20316                 turnPath = turnPath.slice(i4);
20317                 break;
20318               }
20319             }
20320           }
20321           var turn = pathToTurn(turnPath);
20322           if (turn) {
20323             if (matchedRestriction) {
20324               turn.restrictionID = matchedRestriction.id;
20325               turn.no = matchedRestriction.no;
20326               turn.only = matchedRestriction.only;
20327               turn.direct = matchedRestriction.direct;
20328             }
20329             turns.push(osmTurn(turn));
20330           }
20331           if (currPath[0] === currPath[2]) return;
20332         }
20333         if (matchedRestriction && matchedRestriction.end) return;
20334         var n1 = vgraph2.entity(entity.first());
20335         var n22 = vgraph2.entity(entity.last());
20336         var dist = geoSphericalDistance(n1.loc, n22.loc);
20337         var nextNodes = [];
20338         if (currPath.length > 1) {
20339           if (dist > maxDistance) return;
20340           if (!entity.__via) return;
20341         }
20342         if (!entity.__oneWay && // bidirectional..
20343         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
20344         currPath.indexOf(n1.id) === -1) {
20345           nextNodes.push(n1);
20346         }
20347         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
20348         currPath.indexOf(n22.id) === -1) {
20349           nextNodes.push(n22);
20350         }
20351         nextNodes.forEach(function(nextNode) {
20352           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
20353             if (!r2.isRestriction()) return false;
20354             var f2 = r2.memberByRole("from");
20355             if (!f2 || f2.id !== entity.id) return false;
20356             var isOnly = /^only_/.test(r2.tags.restriction);
20357             if (!isOnly) return true;
20358             var isOnlyVia = false;
20359             var v3 = r2.membersByRole("via");
20360             if (v3.length === 1 && v3[0].type === "node") {
20361               isOnlyVia = v3[0].id === nextNode.id;
20362             } else {
20363               for (var i5 = 0; i5 < v3.length; i5++) {
20364                 if (v3[i5].type !== "way") continue;
20365                 var viaWay = vgraph2.entity(v3[i5].id);
20366                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
20367                   isOnlyVia = true;
20368                   break;
20369                 }
20370               }
20371             }
20372             return isOnlyVia;
20373           });
20374           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
20375         });
20376       }
20377       function pathToTurn(path) {
20378         if (path.length < 3) return;
20379         var fromWayId2, fromNodeId, fromVertexId;
20380         var toWayId, toNodeId, toVertexId;
20381         var viaWayIds, viaNodeId, isUturn;
20382         fromWayId2 = path[0];
20383         toWayId = path[path.length - 1];
20384         if (path.length === 3 && fromWayId2 === toWayId) {
20385           var way2 = vgraph2.entity(fromWayId2);
20386           if (way2.__oneWay) return null;
20387           isUturn = true;
20388           viaNodeId = fromVertexId = toVertexId = path[1];
20389           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
20390         } else {
20391           isUturn = false;
20392           fromVertexId = path[1];
20393           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
20394           toVertexId = path[path.length - 2];
20395           toNodeId = adjacentNode(toWayId, toVertexId);
20396           if (path.length === 3) {
20397             viaNodeId = path[1];
20398           } else {
20399             viaWayIds = path.filter(function(entityId) {
20400               return entityId[0] === "w";
20401             });
20402             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
20403           }
20404         }
20405         return {
20406           key: path.join("_"),
20407           path,
20408           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
20409           via: { node: viaNodeId, ways: viaWayIds },
20410           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
20411           u: isUturn
20412         };
20413         function adjacentNode(wayId, affixId) {
20414           var nodes2 = vgraph2.entity(wayId).nodes;
20415           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
20416         }
20417       }
20418     };
20419     return intersection2;
20420   }
20421   function osmInferRestriction(graph, turn, projection2) {
20422     var fromWay = graph.entity(turn.from.way);
20423     var fromNode = graph.entity(turn.from.node);
20424     var fromVertex = graph.entity(turn.from.vertex);
20425     var toWay = graph.entity(turn.to.way);
20426     var toNode = graph.entity(turn.to.node);
20427     var toVertex = graph.entity(turn.to.vertex);
20428     var fromOneWay = fromWay.tags.oneway === "yes";
20429     var toOneWay = toWay.tags.oneway === "yes";
20430     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
20431     while (angle2 < 0) {
20432       angle2 += 360;
20433     }
20434     if (fromNode === toNode) {
20435       return "no_u_turn";
20436     }
20437     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
20438       return "no_u_turn";
20439     }
20440     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
20441       return "no_u_turn";
20442     }
20443     if (angle2 < 158) {
20444       return "no_right_turn";
20445     }
20446     if (angle2 > 202) {
20447       return "no_left_turn";
20448     }
20449     return "no_straight_on";
20450   }
20451   var init_intersection = __esm({
20452     "modules/osm/intersection.js"() {
20453       "use strict";
20454       init_delete_relation();
20455       init_reverse();
20456       init_split();
20457       init_graph();
20458       init_geo2();
20459       init_entity();
20460       init_util();
20461     }
20462   });
20463
20464   // modules/osm/lanes.js
20465   var lanes_exports = {};
20466   __export(lanes_exports, {
20467     osmLanes: () => osmLanes
20468   });
20469   function osmLanes(entity) {
20470     if (entity.type !== "way") return null;
20471     if (!entity.tags.highway) return null;
20472     var tags = entity.tags;
20473     var isOneWay = entity.isOneWay();
20474     var laneCount = getLaneCount(tags, isOneWay);
20475     var maxspeed = parseMaxspeed(tags);
20476     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
20477     var forward = laneDirections.forward;
20478     var backward = laneDirections.backward;
20479     var bothways = laneDirections.bothways;
20480     var turnLanes = {};
20481     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
20482     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
20483     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
20484     var maxspeedLanes = {};
20485     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
20486     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
20487     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
20488     var psvLanes = {};
20489     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
20490     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
20491     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
20492     var busLanes = {};
20493     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
20494     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
20495     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
20496     var taxiLanes = {};
20497     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
20498     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
20499     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
20500     var hovLanes = {};
20501     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
20502     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
20503     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
20504     var hgvLanes = {};
20505     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
20506     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
20507     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
20508     var bicyclewayLanes = {};
20509     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
20510     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
20511     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
20512     var lanesObj = {
20513       forward: [],
20514       backward: [],
20515       unspecified: []
20516     };
20517     mapToLanesObj(lanesObj, turnLanes, "turnLane");
20518     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
20519     mapToLanesObj(lanesObj, psvLanes, "psv");
20520     mapToLanesObj(lanesObj, busLanes, "bus");
20521     mapToLanesObj(lanesObj, taxiLanes, "taxi");
20522     mapToLanesObj(lanesObj, hovLanes, "hov");
20523     mapToLanesObj(lanesObj, hgvLanes, "hgv");
20524     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
20525     return {
20526       metadata: {
20527         count: laneCount,
20528         oneway: isOneWay,
20529         forward,
20530         backward,
20531         bothways,
20532         turnLanes,
20533         maxspeed,
20534         maxspeedLanes,
20535         psvLanes,
20536         busLanes,
20537         taxiLanes,
20538         hovLanes,
20539         hgvLanes,
20540         bicyclewayLanes
20541       },
20542       lanes: lanesObj
20543     };
20544   }
20545   function getLaneCount(tags, isOneWay) {
20546     var count;
20547     if (tags.lanes) {
20548       count = parseInt(tags.lanes, 10);
20549       if (count > 0) {
20550         return count;
20551       }
20552     }
20553     switch (tags.highway) {
20554       case "trunk":
20555       case "motorway":
20556         count = isOneWay ? 2 : 4;
20557         break;
20558       default:
20559         count = isOneWay ? 1 : 2;
20560         break;
20561     }
20562     return count;
20563   }
20564   function parseMaxspeed(tags) {
20565     var maxspeed = tags.maxspeed;
20566     if (!maxspeed) return;
20567     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
20568     if (!maxspeedRegex.test(maxspeed)) return;
20569     return parseInt(maxspeed, 10);
20570   }
20571   function parseLaneDirections(tags, isOneWay, laneCount) {
20572     var forward = parseInt(tags["lanes:forward"], 10);
20573     var backward = parseInt(tags["lanes:backward"], 10);
20574     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
20575     if (parseInt(tags.oneway, 10) === -1) {
20576       forward = 0;
20577       bothways = 0;
20578       backward = laneCount;
20579     } else if (isOneWay) {
20580       forward = laneCount;
20581       bothways = 0;
20582       backward = 0;
20583     } else if (isNaN(forward) && isNaN(backward)) {
20584       backward = Math.floor((laneCount - bothways) / 2);
20585       forward = laneCount - bothways - backward;
20586     } else if (isNaN(forward)) {
20587       if (backward > laneCount - bothways) {
20588         backward = laneCount - bothways;
20589       }
20590       forward = laneCount - bothways - backward;
20591     } else if (isNaN(backward)) {
20592       if (forward > laneCount - bothways) {
20593         forward = laneCount - bothways;
20594       }
20595       backward = laneCount - bothways - forward;
20596     }
20597     return {
20598       forward,
20599       backward,
20600       bothways
20601     };
20602   }
20603   function parseTurnLanes(tag) {
20604     if (!tag) return;
20605     var validValues = [
20606       "left",
20607       "slight_left",
20608       "sharp_left",
20609       "through",
20610       "right",
20611       "slight_right",
20612       "sharp_right",
20613       "reverse",
20614       "merge_to_left",
20615       "merge_to_right",
20616       "none"
20617     ];
20618     return tag.split("|").map(function(s2) {
20619       if (s2 === "") s2 = "none";
20620       return s2.split(";").map(function(d2) {
20621         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
20622       });
20623     });
20624   }
20625   function parseMaxspeedLanes(tag, maxspeed) {
20626     if (!tag) return;
20627     return tag.split("|").map(function(s2) {
20628       if (s2 === "none") return s2;
20629       var m3 = parseInt(s2, 10);
20630       if (s2 === "" || m3 === maxspeed) return null;
20631       return isNaN(m3) ? "unknown" : m3;
20632     });
20633   }
20634   function parseMiscLanes(tag) {
20635     if (!tag) return;
20636     var validValues = [
20637       "yes",
20638       "no",
20639       "designated"
20640     ];
20641     return tag.split("|").map(function(s2) {
20642       if (s2 === "") s2 = "no";
20643       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
20644     });
20645   }
20646   function parseBicycleWay(tag) {
20647     if (!tag) return;
20648     var validValues = [
20649       "yes",
20650       "no",
20651       "designated",
20652       "lane"
20653     ];
20654     return tag.split("|").map(function(s2) {
20655       if (s2 === "") s2 = "no";
20656       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
20657     });
20658   }
20659   function mapToLanesObj(lanesObj, data, key) {
20660     if (data.forward) {
20661       data.forward.forEach(function(l2, i3) {
20662         if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
20663         lanesObj.forward[i3][key] = l2;
20664       });
20665     }
20666     if (data.backward) {
20667       data.backward.forEach(function(l2, i3) {
20668         if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
20669         lanesObj.backward[i3][key] = l2;
20670       });
20671     }
20672     if (data.unspecified) {
20673       data.unspecified.forEach(function(l2, i3) {
20674         if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
20675         lanesObj.unspecified[i3][key] = l2;
20676       });
20677     }
20678   }
20679   var init_lanes = __esm({
20680     "modules/osm/lanes.js"() {
20681       "use strict";
20682     }
20683   });
20684
20685   // modules/osm/index.js
20686   var osm_exports = {};
20687   __export(osm_exports, {
20688     QAItem: () => QAItem,
20689     osmAreaKeys: () => osmAreaKeys,
20690     osmChangeset: () => osmChangeset,
20691     osmEntity: () => osmEntity,
20692     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
20693     osmInferRestriction: () => osmInferRestriction,
20694     osmIntersection: () => osmIntersection,
20695     osmIsInterestingTag: () => osmIsInterestingTag,
20696     osmJoinWays: () => osmJoinWays,
20697     osmLanes: () => osmLanes,
20698     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
20699     osmNode: () => osmNode,
20700     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
20701     osmNote: () => osmNote,
20702     osmPavedTags: () => osmPavedTags,
20703     osmPointTags: () => osmPointTags,
20704     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
20705     osmRelation: () => osmRelation,
20706     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
20707     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
20708     osmSetAreaKeys: () => osmSetAreaKeys,
20709     osmSetPointTags: () => osmSetPointTags,
20710     osmSetVertexTags: () => osmSetVertexTags,
20711     osmTagSuggestingArea: () => osmTagSuggestingArea,
20712     osmTurn: () => osmTurn,
20713     osmVertexTags: () => osmVertexTags,
20714     osmWay: () => osmWay
20715   });
20716   var init_osm = __esm({
20717     "modules/osm/index.js"() {
20718       "use strict";
20719       init_changeset();
20720       init_entity();
20721       init_node2();
20722       init_note();
20723       init_relation();
20724       init_way();
20725       init_qa_item();
20726       init_intersection();
20727       init_lanes();
20728       init_multipolygon();
20729       init_tags();
20730     }
20731   });
20732
20733   // modules/actions/merge_polygon.js
20734   var merge_polygon_exports = {};
20735   __export(merge_polygon_exports, {
20736     actionMergePolygon: () => actionMergePolygon
20737   });
20738   function actionMergePolygon(ids, newRelationId) {
20739     function groupEntities(graph) {
20740       var entities = ids.map(function(id2) {
20741         return graph.entity(id2);
20742       });
20743       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
20744         if (entity.type === "way" && entity.isClosed()) {
20745           return "closedWay";
20746         } else if (entity.type === "relation" && entity.isMultipolygon()) {
20747           return "multipolygon";
20748         } else {
20749           return "other";
20750         }
20751       });
20752       return Object.assign(
20753         { closedWay: [], multipolygon: [], other: [] },
20754         geometryGroups
20755       );
20756     }
20757     var action = function(graph) {
20758       var entities = groupEntities(graph);
20759       var polygons = entities.multipolygon.reduce(function(polygons2, m3) {
20760         return polygons2.concat(osmJoinWays(m3.members, graph));
20761       }, []).concat(entities.closedWay.map(function(d2) {
20762         var member = [{ id: d2.id }];
20763         member.nodes = graph.childNodes(d2);
20764         return member;
20765       }));
20766       var contained = polygons.map(function(w3, i3) {
20767         return polygons.map(function(d2, n3) {
20768           if (i3 === n3) return null;
20769           return geoPolygonContainsPolygon(
20770             d2.nodes.map(function(n4) {
20771               return n4.loc;
20772             }),
20773             w3.nodes.map(function(n4) {
20774               return n4.loc;
20775             })
20776           );
20777         });
20778       });
20779       var members = [];
20780       var outer = true;
20781       while (polygons.length) {
20782         extractUncontained(polygons);
20783         polygons = polygons.filter(isContained);
20784         contained = contained.filter(isContained).map(filterContained);
20785       }
20786       function isContained(d2, i3) {
20787         return contained[i3].some(function(val) {
20788           return val;
20789         });
20790       }
20791       function filterContained(d2) {
20792         return d2.filter(isContained);
20793       }
20794       function extractUncontained(polygons2) {
20795         polygons2.forEach(function(d2, i3) {
20796           if (!isContained(d2, i3)) {
20797             d2.forEach(function(member) {
20798               members.push({
20799                 type: "way",
20800                 id: member.id,
20801                 role: outer ? "outer" : "inner"
20802               });
20803             });
20804           }
20805         });
20806         outer = !outer;
20807       }
20808       var relation;
20809       if (entities.multipolygon.length > 0) {
20810         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
20811         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
20812       } else {
20813         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
20814       }
20815       entities.multipolygon.forEach(function(m3) {
20816         if (m3.id !== relation.id) {
20817           relation = relation.mergeTags(m3.tags);
20818           graph = graph.remove(m3);
20819         }
20820       });
20821       entities.closedWay.forEach(function(way) {
20822         function isThisOuter(m3) {
20823           return m3.id === way.id && m3.role !== "inner";
20824         }
20825         if (members.some(isThisOuter)) {
20826           relation = relation.mergeTags(way.tags);
20827           graph = graph.replace(way.update({ tags: {} }));
20828         }
20829       });
20830       return graph.replace(relation.update({
20831         members,
20832         tags: utilObjectOmit(relation.tags, ["area"])
20833       }));
20834     };
20835     action.disabled = function(graph) {
20836       var entities = groupEntities(graph);
20837       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
20838         return "not_eligible";
20839       }
20840       if (!entities.multipolygon.every(function(r2) {
20841         return r2.isComplete(graph);
20842       })) {
20843         return "incomplete_relation";
20844       }
20845       if (!entities.multipolygon.length) {
20846         var sharedMultipolygons = [];
20847         entities.closedWay.forEach(function(way, i3) {
20848           if (i3 === 0) {
20849             sharedMultipolygons = graph.parentMultipolygons(way);
20850           } else {
20851             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
20852           }
20853         });
20854         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
20855           return relation.members.length === entities.closedWay.length;
20856         });
20857         if (sharedMultipolygons.length) {
20858           return "not_eligible";
20859         }
20860       } else if (entities.closedWay.some(function(way) {
20861         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
20862       })) {
20863         return "not_eligible";
20864       }
20865     };
20866     return action;
20867   }
20868   var init_merge_polygon = __esm({
20869     "modules/actions/merge_polygon.js"() {
20870       "use strict";
20871       init_geo2();
20872       init_osm();
20873       init_util();
20874     }
20875   });
20876
20877   // node_modules/fast-deep-equal/index.js
20878   var require_fast_deep_equal = __commonJS({
20879     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
20880       "use strict";
20881       module2.exports = function equal(a4, b3) {
20882         if (a4 === b3) return true;
20883         if (a4 && b3 && typeof a4 == "object" && typeof b3 == "object") {
20884           if (a4.constructor !== b3.constructor) return false;
20885           var length2, i3, keys2;
20886           if (Array.isArray(a4)) {
20887             length2 = a4.length;
20888             if (length2 != b3.length) return false;
20889             for (i3 = length2; i3-- !== 0; )
20890               if (!equal(a4[i3], b3[i3])) return false;
20891             return true;
20892           }
20893           if (a4.constructor === RegExp) return a4.source === b3.source && a4.flags === b3.flags;
20894           if (a4.valueOf !== Object.prototype.valueOf) return a4.valueOf() === b3.valueOf();
20895           if (a4.toString !== Object.prototype.toString) return a4.toString() === b3.toString();
20896           keys2 = Object.keys(a4);
20897           length2 = keys2.length;
20898           if (length2 !== Object.keys(b3).length) return false;
20899           for (i3 = length2; i3-- !== 0; )
20900             if (!Object.prototype.hasOwnProperty.call(b3, keys2[i3])) return false;
20901           for (i3 = length2; i3-- !== 0; ) {
20902             var key = keys2[i3];
20903             if (!equal(a4[key], b3[key])) return false;
20904           }
20905           return true;
20906         }
20907         return a4 !== a4 && b3 !== b3;
20908       };
20909     }
20910   });
20911
20912   // node_modules/node-diff3/index.mjs
20913   function LCS(buffer1, buffer2) {
20914     let equivalenceClasses = {};
20915     for (let j3 = 0; j3 < buffer2.length; j3++) {
20916       const item = buffer2[j3];
20917       if (equivalenceClasses[item]) {
20918         equivalenceClasses[item].push(j3);
20919       } else {
20920         equivalenceClasses[item] = [j3];
20921       }
20922     }
20923     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
20924     let candidates = [NULLRESULT];
20925     for (let i3 = 0; i3 < buffer1.length; i3++) {
20926       const item = buffer1[i3];
20927       const buffer2indices = equivalenceClasses[item] || [];
20928       let r2 = 0;
20929       let c2 = candidates[0];
20930       for (let jx = 0; jx < buffer2indices.length; jx++) {
20931         const j3 = buffer2indices[jx];
20932         let s2;
20933         for (s2 = r2; s2 < candidates.length; s2++) {
20934           if (candidates[s2].buffer2index < j3 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j3)) {
20935             break;
20936           }
20937         }
20938         if (s2 < candidates.length) {
20939           const newCandidate = { buffer1index: i3, buffer2index: j3, chain: candidates[s2] };
20940           if (r2 === candidates.length) {
20941             candidates.push(c2);
20942           } else {
20943             candidates[r2] = c2;
20944           }
20945           r2 = s2 + 1;
20946           c2 = newCandidate;
20947           if (r2 === candidates.length) {
20948             break;
20949           }
20950         }
20951       }
20952       candidates[r2] = c2;
20953     }
20954     return candidates[candidates.length - 1];
20955   }
20956   function diffIndices(buffer1, buffer2) {
20957     const lcs = LCS(buffer1, buffer2);
20958     let result = [];
20959     let tail1 = buffer1.length;
20960     let tail2 = buffer2.length;
20961     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
20962       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
20963       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
20964       tail1 = candidate.buffer1index;
20965       tail2 = candidate.buffer2index;
20966       if (mismatchLength1 || mismatchLength2) {
20967         result.push({
20968           buffer1: [tail1 + 1, mismatchLength1],
20969           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
20970           buffer2: [tail2 + 1, mismatchLength2],
20971           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
20972         });
20973       }
20974     }
20975     result.reverse();
20976     return result;
20977   }
20978   function diff3MergeRegions(a4, o2, b3) {
20979     let hunks = [];
20980     function addHunk(h3, ab) {
20981       hunks.push({
20982         ab,
20983         oStart: h3.buffer1[0],
20984         oLength: h3.buffer1[1],
20985         // length of o to remove
20986         abStart: h3.buffer2[0],
20987         abLength: h3.buffer2[1]
20988         // length of a/b to insert
20989         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
20990       });
20991     }
20992     diffIndices(o2, a4).forEach((item) => addHunk(item, "a"));
20993     diffIndices(o2, b3).forEach((item) => addHunk(item, "b"));
20994     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
20995     let results = [];
20996     let currOffset = 0;
20997     function advanceTo(endOffset) {
20998       if (endOffset > currOffset) {
20999         results.push({
21000           stable: true,
21001           buffer: "o",
21002           bufferStart: currOffset,
21003           bufferLength: endOffset - currOffset,
21004           bufferContent: o2.slice(currOffset, endOffset)
21005         });
21006         currOffset = endOffset;
21007       }
21008     }
21009     while (hunks.length) {
21010       let hunk = hunks.shift();
21011       let regionStart = hunk.oStart;
21012       let regionEnd = hunk.oStart + hunk.oLength;
21013       let regionHunks = [hunk];
21014       advanceTo(regionStart);
21015       while (hunks.length) {
21016         const nextHunk = hunks[0];
21017         const nextHunkStart = nextHunk.oStart;
21018         if (nextHunkStart > regionEnd) break;
21019         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
21020         regionHunks.push(hunks.shift());
21021       }
21022       if (regionHunks.length === 1) {
21023         if (hunk.abLength > 0) {
21024           const buffer = hunk.ab === "a" ? a4 : b3;
21025           results.push({
21026             stable: true,
21027             buffer: hunk.ab,
21028             bufferStart: hunk.abStart,
21029             bufferLength: hunk.abLength,
21030             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
21031           });
21032         }
21033       } else {
21034         let bounds = {
21035           a: [a4.length, -1, o2.length, -1],
21036           b: [b3.length, -1, o2.length, -1]
21037         };
21038         while (regionHunks.length) {
21039           hunk = regionHunks.shift();
21040           const oStart = hunk.oStart;
21041           const oEnd = oStart + hunk.oLength;
21042           const abStart = hunk.abStart;
21043           const abEnd = abStart + hunk.abLength;
21044           let b4 = bounds[hunk.ab];
21045           b4[0] = Math.min(abStart, b4[0]);
21046           b4[1] = Math.max(abEnd, b4[1]);
21047           b4[2] = Math.min(oStart, b4[2]);
21048           b4[3] = Math.max(oEnd, b4[3]);
21049         }
21050         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
21051         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
21052         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
21053         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
21054         let result = {
21055           stable: false,
21056           aStart,
21057           aLength: aEnd - aStart,
21058           aContent: a4.slice(aStart, aEnd),
21059           oStart: regionStart,
21060           oLength: regionEnd - regionStart,
21061           oContent: o2.slice(regionStart, regionEnd),
21062           bStart,
21063           bLength: bEnd - bStart,
21064           bContent: b3.slice(bStart, bEnd)
21065         };
21066         results.push(result);
21067       }
21068       currOffset = regionEnd;
21069     }
21070     advanceTo(o2.length);
21071     return results;
21072   }
21073   function diff3Merge(a4, o2, b3, options) {
21074     let defaults = {
21075       excludeFalseConflicts: true,
21076       stringSeparator: /\s+/
21077     };
21078     options = Object.assign(defaults, options);
21079     if (typeof a4 === "string") a4 = a4.split(options.stringSeparator);
21080     if (typeof o2 === "string") o2 = o2.split(options.stringSeparator);
21081     if (typeof b3 === "string") b3 = b3.split(options.stringSeparator);
21082     let results = [];
21083     const regions = diff3MergeRegions(a4, o2, b3);
21084     let okBuffer = [];
21085     function flushOk() {
21086       if (okBuffer.length) {
21087         results.push({ ok: okBuffer });
21088       }
21089       okBuffer = [];
21090     }
21091     function isFalseConflict(a5, b4) {
21092       if (a5.length !== b4.length) return false;
21093       for (let i3 = 0; i3 < a5.length; i3++) {
21094         if (a5[i3] !== b4[i3]) return false;
21095       }
21096       return true;
21097     }
21098     regions.forEach((region) => {
21099       if (region.stable) {
21100         okBuffer.push(...region.bufferContent);
21101       } else {
21102         if (options.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
21103           okBuffer.push(...region.aContent);
21104         } else {
21105           flushOk();
21106           results.push({
21107             conflict: {
21108               a: region.aContent,
21109               aIndex: region.aStart,
21110               o: region.oContent,
21111               oIndex: region.oStart,
21112               b: region.bContent,
21113               bIndex: region.bStart
21114             }
21115           });
21116         }
21117       }
21118     });
21119     flushOk();
21120     return results;
21121   }
21122   var init_node_diff3 = __esm({
21123     "node_modules/node-diff3/index.mjs"() {
21124     }
21125   });
21126
21127   // modules/actions/merge_remote_changes.js
21128   var merge_remote_changes_exports = {};
21129   __export(merge_remote_changes_exports, {
21130     actionMergeRemoteChanges: () => actionMergeRemoteChanges
21131   });
21132   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
21133     discardTags = discardTags || {};
21134     var _option = "safe";
21135     var _conflicts = [];
21136     function user(d2) {
21137       return typeof formatUser === "function" ? formatUser(d2) : escape_default(d2);
21138     }
21139     function mergeLocation(remote, target) {
21140       function pointEqual(a4, b3) {
21141         var epsilon3 = 1e-6;
21142         return Math.abs(a4[0] - b3[0]) < epsilon3 && Math.abs(a4[1] - b3[1]) < epsilon3;
21143       }
21144       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
21145         return target;
21146       }
21147       if (_option === "force_remote") {
21148         return target.update({ loc: remote.loc });
21149       }
21150       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
21151       return target;
21152     }
21153     function mergeNodes(base, remote, target) {
21154       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
21155         return target;
21156       }
21157       if (_option === "force_remote") {
21158         return target.update({ nodes: remote.nodes });
21159       }
21160       var ccount = _conflicts.length;
21161       var o2 = base.nodes || [];
21162       var a4 = target.nodes || [];
21163       var b3 = remote.nodes || [];
21164       var nodes = [];
21165       var hunks = diff3Merge(a4, o2, b3, { excludeFalseConflicts: true });
21166       for (var i3 = 0; i3 < hunks.length; i3++) {
21167         var hunk = hunks[i3];
21168         if (hunk.ok) {
21169           nodes.push.apply(nodes, hunk.ok);
21170         } else {
21171           var c2 = hunk.conflict;
21172           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
21173             nodes.push.apply(nodes, c2.b);
21174           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
21175             nodes.push.apply(nodes, c2.a);
21176           } else {
21177             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
21178             break;
21179           }
21180         }
21181       }
21182       return _conflicts.length === ccount ? target.update({ nodes }) : target;
21183     }
21184     function mergeChildren(targetWay, children2, updates, graph) {
21185       function isUsed(node2, targetWay2) {
21186         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
21187           return way.id !== targetWay2.id;
21188         });
21189         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
21190       }
21191       var ccount = _conflicts.length;
21192       for (var i3 = 0; i3 < children2.length; i3++) {
21193         var id3 = children2[i3];
21194         var node = graph.hasEntity(id3);
21195         if (targetWay.nodes.indexOf(id3) === -1) {
21196           if (node && !isUsed(node, targetWay)) {
21197             updates.removeIds.push(id3);
21198           }
21199           continue;
21200         }
21201         var local = localGraph.hasEntity(id3);
21202         var remote = remoteGraph.hasEntity(id3);
21203         var target;
21204         if (_option === "force_remote" && remote && remote.visible) {
21205           updates.replacements.push(remote);
21206         } else if (_option === "force_local" && local) {
21207           target = osmEntity(local);
21208           if (remote) {
21209             target = target.update({ version: remote.version });
21210           }
21211           updates.replacements.push(target);
21212         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
21213           target = osmEntity(local, { version: remote.version });
21214           if (remote.visible) {
21215             target = mergeLocation(remote, target);
21216           } else {
21217             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
21218           }
21219           if (_conflicts.length !== ccount) break;
21220           updates.replacements.push(target);
21221         }
21222       }
21223       return targetWay;
21224     }
21225     function updateChildren(updates, graph) {
21226       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
21227         graph = graph.replace(updates.replacements[i3]);
21228       }
21229       if (updates.removeIds.length) {
21230         graph = actionDeleteMultiple(updates.removeIds)(graph);
21231       }
21232       return graph;
21233     }
21234     function mergeMembers(remote, target) {
21235       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
21236         return target;
21237       }
21238       if (_option === "force_remote") {
21239         return target.update({ members: remote.members });
21240       }
21241       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
21242       return target;
21243     }
21244     function mergeTags(base, remote, target) {
21245       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
21246         return target;
21247       }
21248       if (_option === "force_remote") {
21249         return target.update({ tags: remote.tags });
21250       }
21251       var ccount = _conflicts.length;
21252       var o2 = base.tags || {};
21253       var a4 = target.tags || {};
21254       var b3 = remote.tags || {};
21255       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a4)), Object.keys(b3)).filter(function(k4) {
21256         return !discardTags[k4];
21257       });
21258       var tags = Object.assign({}, a4);
21259       var changed = false;
21260       for (var i3 = 0; i3 < keys2.length; i3++) {
21261         var k3 = keys2[i3];
21262         if (o2[k3] !== b3[k3] && a4[k3] !== b3[k3]) {
21263           if (o2[k3] !== a4[k3]) {
21264             _conflicts.push(_t.html(
21265               "merge_remote_changes.conflict.tags",
21266               { tag: k3, local: a4[k3], remote: b3[k3], user: { html: user(remote.user) } }
21267             ));
21268           } else {
21269             if (b3.hasOwnProperty(k3)) {
21270               tags[k3] = b3[k3];
21271             } else {
21272               delete tags[k3];
21273             }
21274             changed = true;
21275           }
21276         }
21277       }
21278       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
21279     }
21280     var action = function(graph) {
21281       var updates = { replacements: [], removeIds: [] };
21282       var base = graph.base().entities[id2];
21283       var local = localGraph.entity(id2);
21284       var remote = remoteGraph.entity(id2);
21285       var target = osmEntity(local, { version: remote.version });
21286       if (!remote.visible) {
21287         if (_option === "force_remote") {
21288           return actionDeleteMultiple([id2])(graph);
21289         } else if (_option === "force_local") {
21290           if (target.type === "way") {
21291             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
21292             graph = updateChildren(updates, graph);
21293           }
21294           return graph.replace(target);
21295         } else {
21296           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
21297           return graph;
21298         }
21299       }
21300       if (target.type === "node") {
21301         target = mergeLocation(remote, target);
21302       } else if (target.type === "way") {
21303         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
21304         target = mergeNodes(base, remote, target);
21305         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
21306       } else if (target.type === "relation") {
21307         target = mergeMembers(remote, target);
21308       }
21309       target = mergeTags(base, remote, target);
21310       if (!_conflicts.length) {
21311         graph = updateChildren(updates, graph).replace(target);
21312       }
21313       return graph;
21314     };
21315     action.withOption = function(opt) {
21316       _option = opt;
21317       return action;
21318     };
21319     action.conflicts = function() {
21320       return _conflicts;
21321     };
21322     return action;
21323   }
21324   var import_fast_deep_equal;
21325   var init_merge_remote_changes = __esm({
21326     "modules/actions/merge_remote_changes.js"() {
21327       "use strict";
21328       import_fast_deep_equal = __toESM(require_fast_deep_equal());
21329       init_node_diff3();
21330       init_lodash();
21331       init_localizer();
21332       init_delete_multiple();
21333       init_osm();
21334       init_util();
21335     }
21336   });
21337
21338   // modules/actions/move.js
21339   var move_exports = {};
21340   __export(move_exports, {
21341     actionMove: () => actionMove
21342   });
21343   function actionMove(moveIDs, tryDelta, projection2, cache) {
21344     var _delta = tryDelta;
21345     function setupCache(graph) {
21346       function canMove(nodeID) {
21347         if (moveIDs.indexOf(nodeID) !== -1) return true;
21348         var parents = graph.parentWays(graph.entity(nodeID));
21349         if (parents.length < 3) return true;
21350         var parentsMoving = parents.every(function(way) {
21351           return cache.moving[way.id];
21352         });
21353         if (!parentsMoving) delete cache.moving[nodeID];
21354         return parentsMoving;
21355       }
21356       function cacheEntities(ids) {
21357         for (var i3 = 0; i3 < ids.length; i3++) {
21358           var id2 = ids[i3];
21359           if (cache.moving[id2]) continue;
21360           cache.moving[id2] = true;
21361           var entity = graph.hasEntity(id2);
21362           if (!entity) continue;
21363           if (entity.type === "node") {
21364             cache.nodes.push(id2);
21365             cache.startLoc[id2] = entity.loc;
21366           } else if (entity.type === "way") {
21367             cache.ways.push(id2);
21368             cacheEntities(entity.nodes);
21369           } else {
21370             cacheEntities(entity.members.map(function(member) {
21371               return member.id;
21372             }));
21373           }
21374         }
21375       }
21376       function cacheIntersections(ids) {
21377         function isEndpoint(way2, id3) {
21378           return !way2.isClosed() && !!way2.affix(id3);
21379         }
21380         for (var i3 = 0; i3 < ids.length; i3++) {
21381           var id2 = ids[i3];
21382           var childNodes = graph.childNodes(graph.entity(id2));
21383           for (var j3 = 0; j3 < childNodes.length; j3++) {
21384             var node = childNodes[j3];
21385             var parents = graph.parentWays(node);
21386             if (parents.length !== 2) continue;
21387             var moved = graph.entity(id2);
21388             var unmoved = null;
21389             for (var k3 = 0; k3 < parents.length; k3++) {
21390               var way = parents[k3];
21391               if (!cache.moving[way.id]) {
21392                 unmoved = way;
21393                 break;
21394               }
21395             }
21396             if (!unmoved) continue;
21397             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
21398             if (moved.isArea() || unmoved.isArea()) continue;
21399             cache.intersections.push({
21400               nodeId: node.id,
21401               movedId: moved.id,
21402               unmovedId: unmoved.id,
21403               movedIsEP: isEndpoint(moved, node.id),
21404               unmovedIsEP: isEndpoint(unmoved, node.id)
21405             });
21406           }
21407         }
21408       }
21409       if (!cache) {
21410         cache = {};
21411       }
21412       if (!cache.ok) {
21413         cache.moving = {};
21414         cache.intersections = [];
21415         cache.replacedVertex = {};
21416         cache.startLoc = {};
21417         cache.nodes = [];
21418         cache.ways = [];
21419         cacheEntities(moveIDs);
21420         cacheIntersections(cache.ways);
21421         cache.nodes = cache.nodes.filter(canMove);
21422         cache.ok = true;
21423       }
21424     }
21425     function replaceMovedVertex(nodeId, wayId, graph, delta) {
21426       var way = graph.entity(wayId);
21427       var moved = graph.entity(nodeId);
21428       var movedIndex = way.nodes.indexOf(nodeId);
21429       var len, prevIndex, nextIndex;
21430       if (way.isClosed()) {
21431         len = way.nodes.length - 1;
21432         prevIndex = (movedIndex + len - 1) % len;
21433         nextIndex = (movedIndex + len + 1) % len;
21434       } else {
21435         len = way.nodes.length;
21436         prevIndex = movedIndex - 1;
21437         nextIndex = movedIndex + 1;
21438       }
21439       var prev = graph.hasEntity(way.nodes[prevIndex]);
21440       var next = graph.hasEntity(way.nodes[nextIndex]);
21441       if (!prev || !next) return graph;
21442       var key = wayId + "_" + nodeId;
21443       var orig = cache.replacedVertex[key];
21444       if (!orig) {
21445         orig = osmNode();
21446         cache.replacedVertex[key] = orig;
21447         cache.startLoc[orig.id] = cache.startLoc[nodeId];
21448       }
21449       var start2, end;
21450       if (delta) {
21451         start2 = projection2(cache.startLoc[nodeId]);
21452         end = projection2.invert(geoVecAdd(start2, delta));
21453       } else {
21454         end = cache.startLoc[nodeId];
21455       }
21456       orig = orig.move(end);
21457       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
21458       if (angle2 > 175 && angle2 < 185) return graph;
21459       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
21460       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
21461       var d1 = geoPathLength(p1);
21462       var d2 = geoPathLength(p2);
21463       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
21464       if (way.isClosed() && insertAt === 0) insertAt = len;
21465       way = way.addNode(orig.id, insertAt);
21466       return graph.replace(orig).replace(way);
21467     }
21468     function removeDuplicateVertices(wayId, graph) {
21469       var way = graph.entity(wayId);
21470       var epsilon3 = 1e-6;
21471       var prev, curr;
21472       function isInteresting(node, graph2) {
21473         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
21474       }
21475       for (var i3 = 0; i3 < way.nodes.length; i3++) {
21476         curr = graph.entity(way.nodes[i3]);
21477         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
21478           if (!isInteresting(prev, graph)) {
21479             way = way.removeNode(prev.id);
21480             graph = graph.replace(way).remove(prev);
21481           } else if (!isInteresting(curr, graph)) {
21482             way = way.removeNode(curr.id);
21483             graph = graph.replace(way).remove(curr);
21484           }
21485         }
21486         prev = curr;
21487       }
21488       return graph;
21489     }
21490     function unZorroIntersection(intersection2, graph) {
21491       var vertex = graph.entity(intersection2.nodeId);
21492       var way1 = graph.entity(intersection2.movedId);
21493       var way2 = graph.entity(intersection2.unmovedId);
21494       var isEP1 = intersection2.movedIsEP;
21495       var isEP2 = intersection2.unmovedIsEP;
21496       if (isEP1 && isEP2) return graph;
21497       var nodes1 = graph.childNodes(way1).filter(function(n3) {
21498         return n3 !== vertex;
21499       });
21500       var nodes2 = graph.childNodes(way2).filter(function(n3) {
21501         return n3 !== vertex;
21502       });
21503       if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
21504       if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
21505       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
21506       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
21507       var loc;
21508       if (!isEP1 && !isEP2) {
21509         var epsilon3 = 1e-6, maxIter = 10;
21510         for (var i3 = 0; i3 < maxIter; i3++) {
21511           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
21512           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
21513           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
21514           if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
21515         }
21516       } else if (!isEP1) {
21517         loc = edge1.loc;
21518       } else {
21519         loc = edge2.loc;
21520       }
21521       graph = graph.replace(vertex.move(loc));
21522       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
21523         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
21524         graph = graph.replace(way1);
21525       }
21526       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
21527         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
21528         graph = graph.replace(way2);
21529       }
21530       return graph;
21531     }
21532     function cleanupIntersections(graph) {
21533       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
21534         var obj = cache.intersections[i3];
21535         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
21536         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
21537         graph = unZorroIntersection(obj, graph);
21538         graph = removeDuplicateVertices(obj.movedId, graph);
21539         graph = removeDuplicateVertices(obj.unmovedId, graph);
21540       }
21541       return graph;
21542     }
21543     function limitDelta(graph) {
21544       function moveNode(loc) {
21545         return geoVecAdd(projection2(loc), _delta);
21546       }
21547       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
21548         var obj = cache.intersections[i3];
21549         if (obj.movedIsEP && obj.unmovedIsEP) continue;
21550         if (!obj.movedIsEP) continue;
21551         var node = graph.entity(obj.nodeId);
21552         var start2 = projection2(node.loc);
21553         var end = geoVecAdd(start2, _delta);
21554         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
21555         var movedPath = movedNodes.map(function(n3) {
21556           return moveNode(n3.loc);
21557         });
21558         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
21559         var unmovedPath = unmovedNodes.map(function(n3) {
21560           return projection2(n3.loc);
21561         });
21562         var hits = geoPathIntersections(movedPath, unmovedPath);
21563         for (var j3 = 0; i3 < hits.length; i3++) {
21564           if (geoVecEqual(hits[j3], end)) continue;
21565           var edge = geoChooseEdge(unmovedNodes, end, projection2);
21566           _delta = geoVecSubtract(projection2(edge.loc), start2);
21567         }
21568       }
21569     }
21570     var action = function(graph) {
21571       if (_delta[0] === 0 && _delta[1] === 0) return graph;
21572       setupCache(graph);
21573       if (cache.intersections.length) {
21574         limitDelta(graph);
21575       }
21576       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
21577         var node = graph.entity(cache.nodes[i3]);
21578         var start2 = projection2(node.loc);
21579         var end = geoVecAdd(start2, _delta);
21580         graph = graph.replace(node.move(projection2.invert(end)));
21581       }
21582       if (cache.intersections.length) {
21583         graph = cleanupIntersections(graph);
21584       }
21585       return graph;
21586     };
21587     action.delta = function() {
21588       return _delta;
21589     };
21590     return action;
21591   }
21592   var init_move = __esm({
21593     "modules/actions/move.js"() {
21594       "use strict";
21595       init_geo2();
21596       init_node2();
21597       init_util();
21598     }
21599   });
21600
21601   // modules/actions/move_member.js
21602   var move_member_exports = {};
21603   __export(move_member_exports, {
21604     actionMoveMember: () => actionMoveMember
21605   });
21606   function actionMoveMember(relationId, fromIndex, toIndex) {
21607     return function(graph) {
21608       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
21609     };
21610   }
21611   var init_move_member = __esm({
21612     "modules/actions/move_member.js"() {
21613       "use strict";
21614     }
21615   });
21616
21617   // modules/actions/move_node.js
21618   var move_node_exports = {};
21619   __export(move_node_exports, {
21620     actionMoveNode: () => actionMoveNode
21621   });
21622   function actionMoveNode(nodeID, toLoc) {
21623     var action = function(graph, t2) {
21624       if (t2 === null || !isFinite(t2)) t2 = 1;
21625       t2 = Math.min(Math.max(+t2, 0), 1);
21626       var node = graph.entity(nodeID);
21627       return graph.replace(
21628         node.move(geoVecInterp(node.loc, toLoc, t2))
21629       );
21630     };
21631     action.transitionable = true;
21632     return action;
21633   }
21634   var init_move_node = __esm({
21635     "modules/actions/move_node.js"() {
21636       "use strict";
21637       init_geo2();
21638     }
21639   });
21640
21641   // modules/actions/noop.js
21642   var noop_exports = {};
21643   __export(noop_exports, {
21644     actionNoop: () => actionNoop
21645   });
21646   function actionNoop() {
21647     return function(graph) {
21648       return graph;
21649     };
21650   }
21651   var init_noop2 = __esm({
21652     "modules/actions/noop.js"() {
21653       "use strict";
21654     }
21655   });
21656
21657   // modules/actions/orthogonalize.js
21658   var orthogonalize_exports = {};
21659   __export(orthogonalize_exports, {
21660     actionOrthogonalize: () => actionOrthogonalize
21661   });
21662   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
21663     var epsilon3 = ep || 1e-4;
21664     var threshold = degThresh || 13;
21665     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
21666     var upperThreshold = Math.cos(threshold * Math.PI / 180);
21667     var action = function(graph, t2) {
21668       if (t2 === null || !isFinite(t2)) t2 = 1;
21669       t2 = Math.min(Math.max(+t2, 0), 1);
21670       var way = graph.entity(wayID);
21671       way = way.removeNode("");
21672       if (way.tags.nonsquare) {
21673         var tags = Object.assign({}, way.tags);
21674         delete tags.nonsquare;
21675         way = way.update({ tags });
21676       }
21677       graph = graph.replace(way);
21678       var isClosed = way.isClosed();
21679       var nodes = graph.childNodes(way).slice();
21680       if (isClosed) nodes.pop();
21681       if (vertexID !== void 0) {
21682         nodes = nodeSubset(nodes, vertexID, isClosed);
21683         if (nodes.length !== 3) return graph;
21684       }
21685       var nodeCount = {};
21686       var points = [];
21687       var corner = { i: 0, dotp: 1 };
21688       var node, point, loc, score, motions, i3, j3;
21689       for (i3 = 0; i3 < nodes.length; i3++) {
21690         node = nodes[i3];
21691         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
21692         points.push({ id: node.id, coord: projection2(node.loc) });
21693       }
21694       if (points.length === 3) {
21695         for (i3 = 0; i3 < 1e3; i3++) {
21696           const motion = calcMotion(points[1], 1, points);
21697           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motion);
21698           score = corner.dotp;
21699           if (score < epsilon3) {
21700             break;
21701           }
21702         }
21703         node = graph.entity(nodes[corner.i].id);
21704         loc = projection2.invert(points[corner.i].coord);
21705         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21706       } else {
21707         var straights = [];
21708         var simplified = [];
21709         for (i3 = 0; i3 < points.length; i3++) {
21710           point = points[i3];
21711           var dotp = 0;
21712           if (isClosed || i3 > 0 && i3 < points.length - 1) {
21713             var a4 = points[(i3 - 1 + points.length) % points.length];
21714             var b3 = points[(i3 + 1) % points.length];
21715             dotp = Math.abs(geoOrthoNormalizedDotProduct(a4.coord, b3.coord, point.coord));
21716           }
21717           if (dotp > upperThreshold) {
21718             straights.push(point);
21719           } else {
21720             simplified.push(point);
21721           }
21722         }
21723         var bestPoints = clonePoints(simplified);
21724         var originalPoints = clonePoints(simplified);
21725         score = Infinity;
21726         for (i3 = 0; i3 < 1e3; i3++) {
21727           motions = simplified.map(calcMotion);
21728           for (j3 = 0; j3 < motions.length; j3++) {
21729             simplified[j3].coord = geoVecAdd(simplified[j3].coord, motions[j3]);
21730           }
21731           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
21732           if (newScore < score) {
21733             bestPoints = clonePoints(simplified);
21734             score = newScore;
21735           }
21736           if (score < epsilon3) {
21737             break;
21738           }
21739         }
21740         var bestCoords = bestPoints.map(function(p2) {
21741           return p2.coord;
21742         });
21743         if (isClosed) bestCoords.push(bestCoords[0]);
21744         for (i3 = 0; i3 < bestPoints.length; i3++) {
21745           point = bestPoints[i3];
21746           if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
21747             node = graph.entity(point.id);
21748             loc = projection2.invert(point.coord);
21749             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21750           }
21751         }
21752         for (i3 = 0; i3 < straights.length; i3++) {
21753           point = straights[i3];
21754           if (nodeCount[point.id] > 1) continue;
21755           node = graph.entity(point.id);
21756           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
21757             graph = actionDeleteNode(node.id)(graph);
21758           } else {
21759             var choice = geoVecProject(point.coord, bestCoords);
21760             if (choice) {
21761               loc = projection2.invert(choice.target);
21762               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
21763             }
21764           }
21765         }
21766       }
21767       return graph;
21768       function clonePoints(array2) {
21769         return array2.map(function(p2) {
21770           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
21771         });
21772       }
21773       function calcMotion(point2, i4, array2) {
21774         if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
21775         if (nodeCount[array2[i4].id] > 1) return [0, 0];
21776         var a5 = array2[(i4 - 1 + array2.length) % array2.length].coord;
21777         var origin = point2.coord;
21778         var b4 = array2[(i4 + 1) % array2.length].coord;
21779         var p2 = geoVecSubtract(a5, origin);
21780         var q3 = geoVecSubtract(b4, origin);
21781         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q3));
21782         p2 = geoVecNormalize(p2);
21783         q3 = geoVecNormalize(q3);
21784         var dotp2 = p2[0] * q3[0] + p2[1] * q3[1];
21785         var val = Math.abs(dotp2);
21786         if (val < lowerThreshold) {
21787           corner.i = i4;
21788           corner.dotp = val;
21789           var vec = geoVecNormalize(geoVecAdd(p2, q3));
21790           return geoVecScale(vec, 0.1 * dotp2 * scale);
21791         }
21792         return [0, 0];
21793       }
21794     };
21795     function nodeSubset(nodes, vertexID2, isClosed) {
21796       var first = isClosed ? 0 : 1;
21797       var last2 = isClosed ? nodes.length : nodes.length - 1;
21798       for (var i3 = first; i3 < last2; i3++) {
21799         if (nodes[i3].id === vertexID2) {
21800           return [
21801             nodes[(i3 - 1 + nodes.length) % nodes.length],
21802             nodes[i3],
21803             nodes[(i3 + 1) % nodes.length]
21804           ];
21805         }
21806       }
21807       return [];
21808     }
21809     action.disabled = function(graph) {
21810       var way = graph.entity(wayID);
21811       way = way.removeNode("");
21812       graph = graph.replace(way);
21813       let isClosed = way.isClosed();
21814       var nodes = graph.childNodes(way).slice();
21815       if (isClosed) nodes.pop();
21816       var allowStraightAngles = false;
21817       if (vertexID !== void 0) {
21818         allowStraightAngles = true;
21819         nodes = nodeSubset(nodes, vertexID, isClosed);
21820         if (nodes.length !== 3) return "end_vertex";
21821         isClosed = false;
21822       }
21823       var coords = nodes.map(function(n3) {
21824         return projection2(n3.loc);
21825       });
21826       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
21827       if (score === null) {
21828         return "not_squarish";
21829       } else if (score === 0) {
21830         return "square_enough";
21831       } else {
21832         return false;
21833       }
21834     };
21835     action.transitionable = true;
21836     return action;
21837   }
21838   var init_orthogonalize = __esm({
21839     "modules/actions/orthogonalize.js"() {
21840       "use strict";
21841       init_delete_node();
21842       init_geo2();
21843     }
21844   });
21845
21846   // modules/actions/reflect.js
21847   var reflect_exports = {};
21848   __export(reflect_exports, {
21849     actionReflect: () => actionReflect
21850   });
21851   function actionReflect(reflectIds, projection2) {
21852     var _useLongAxis = true;
21853     var action = function(graph, t2) {
21854       if (t2 === null || !isFinite(t2)) t2 = 1;
21855       t2 = Math.min(Math.max(+t2, 0), 1);
21856       var nodes = utilGetAllNodes(reflectIds, graph);
21857       var points = nodes.map(function(n3) {
21858         return projection2(n3.loc);
21859       });
21860       var ssr = geoGetSmallestSurroundingRectangle(points);
21861       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
21862       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
21863       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
21864       var q22 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
21865       var p3, q3;
21866       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q22);
21867       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
21868         p3 = p1;
21869         q3 = q1;
21870       } else {
21871         p3 = p2;
21872         q3 = q22;
21873       }
21874       var dx = q3[0] - p3[0];
21875       var dy = q3[1] - p3[1];
21876       var a4 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
21877       var b3 = 2 * dx * dy / (dx * dx + dy * dy);
21878       for (var i3 = 0; i3 < nodes.length; i3++) {
21879         var node = nodes[i3];
21880         var c2 = projection2(node.loc);
21881         var c22 = [
21882           a4 * (c2[0] - p3[0]) + b3 * (c2[1] - p3[1]) + p3[0],
21883           b3 * (c2[0] - p3[0]) - a4 * (c2[1] - p3[1]) + p3[1]
21884         ];
21885         var loc2 = projection2.invert(c22);
21886         node = node.move(geoVecInterp(node.loc, loc2, t2));
21887         graph = graph.replace(node);
21888       }
21889       return graph;
21890     };
21891     action.useLongAxis = function(val) {
21892       if (!arguments.length) return _useLongAxis;
21893       _useLongAxis = val;
21894       return action;
21895     };
21896     action.transitionable = true;
21897     return action;
21898   }
21899   var init_reflect = __esm({
21900     "modules/actions/reflect.js"() {
21901       "use strict";
21902       init_geo2();
21903       init_util();
21904     }
21905   });
21906
21907   // modules/actions/restrict_turn.js
21908   var restrict_turn_exports = {};
21909   __export(restrict_turn_exports, {
21910     actionRestrictTurn: () => actionRestrictTurn
21911   });
21912   function actionRestrictTurn(turn, restrictionType, restrictionID) {
21913     return function(graph) {
21914       var fromWay = graph.entity(turn.from.way);
21915       var toWay = graph.entity(turn.to.way);
21916       var viaNode = turn.via.node && graph.entity(turn.via.node);
21917       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
21918         return graph.entity(id2);
21919       });
21920       var members = [];
21921       members.push({ id: fromWay.id, type: "way", role: "from" });
21922       if (viaNode) {
21923         members.push({ id: viaNode.id, type: "node", role: "via" });
21924       } else if (viaWays) {
21925         viaWays.forEach(function(viaWay) {
21926           members.push({ id: viaWay.id, type: "way", role: "via" });
21927         });
21928       }
21929       members.push({ id: toWay.id, type: "way", role: "to" });
21930       return graph.replace(osmRelation({
21931         id: restrictionID,
21932         tags: {
21933           type: "restriction",
21934           restriction: restrictionType
21935         },
21936         members
21937       }));
21938     };
21939   }
21940   var init_restrict_turn = __esm({
21941     "modules/actions/restrict_turn.js"() {
21942       "use strict";
21943       init_relation();
21944     }
21945   });
21946
21947   // modules/actions/revert.js
21948   var revert_exports = {};
21949   __export(revert_exports, {
21950     actionRevert: () => actionRevert
21951   });
21952   function actionRevert(id2) {
21953     var action = function(graph) {
21954       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
21955       if (entity && !base) {
21956         if (entity.type === "node") {
21957           graph.parentWays(entity).forEach(function(parent2) {
21958             parent2 = parent2.removeNode(id2);
21959             graph = graph.replace(parent2);
21960             if (parent2.isDegenerate()) {
21961               graph = actionDeleteWay(parent2.id)(graph);
21962             }
21963           });
21964         }
21965         graph.parentRelations(entity).forEach(function(parent2) {
21966           parent2 = parent2.removeMembersWithID(id2);
21967           graph = graph.replace(parent2);
21968           if (parent2.isDegenerate()) {
21969             graph = actionDeleteRelation(parent2.id)(graph);
21970           }
21971         });
21972       }
21973       return graph.revert(id2);
21974     };
21975     return action;
21976   }
21977   var init_revert = __esm({
21978     "modules/actions/revert.js"() {
21979       "use strict";
21980       init_delete_relation();
21981       init_delete_way();
21982     }
21983   });
21984
21985   // modules/actions/rotate.js
21986   var rotate_exports = {};
21987   __export(rotate_exports, {
21988     actionRotate: () => actionRotate
21989   });
21990   function actionRotate(rotateIds, pivot, angle2, projection2) {
21991     var action = function(graph) {
21992       return graph.update(function(graph2) {
21993         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
21994           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
21995           graph2 = graph2.replace(node.move(projection2.invert(point)));
21996         });
21997       });
21998     };
21999     return action;
22000   }
22001   var init_rotate = __esm({
22002     "modules/actions/rotate.js"() {
22003       "use strict";
22004       init_geo2();
22005       init_util();
22006     }
22007   });
22008
22009   // modules/actions/scale.js
22010   var scale_exports = {};
22011   __export(scale_exports, {
22012     actionScale: () => actionScale
22013   });
22014   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
22015     return function(graph) {
22016       return graph.update(function(graph2) {
22017         let point, radial;
22018         utilGetAllNodes(ids, graph2).forEach(function(node) {
22019           point = projection2(node.loc);
22020           radial = [
22021             point[0] - pivotLoc[0],
22022             point[1] - pivotLoc[1]
22023           ];
22024           point = [
22025             pivotLoc[0] + scaleFactor * radial[0],
22026             pivotLoc[1] + scaleFactor * radial[1]
22027           ];
22028           graph2 = graph2.replace(node.move(projection2.invert(point)));
22029         });
22030       });
22031     };
22032   }
22033   var init_scale = __esm({
22034     "modules/actions/scale.js"() {
22035       "use strict";
22036       init_util();
22037     }
22038   });
22039
22040   // modules/actions/straighten_nodes.js
22041   var straighten_nodes_exports = {};
22042   __export(straighten_nodes_exports, {
22043     actionStraightenNodes: () => actionStraightenNodes
22044   });
22045   function actionStraightenNodes(nodeIDs, projection2) {
22046     function positionAlongWay(a4, o2, b3) {
22047       return geoVecDot(a4, b3, o2) / geoVecDot(b3, b3, o2);
22048     }
22049     function getEndpoints(points) {
22050       var ssr = geoGetSmallestSurroundingRectangle(points);
22051       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
22052       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
22053       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
22054       var q22 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
22055       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q22);
22056       if (isLong) {
22057         return [p1, q1];
22058       }
22059       return [p2, q22];
22060     }
22061     var action = function(graph, t2) {
22062       if (t2 === null || !isFinite(t2)) t2 = 1;
22063       t2 = Math.min(Math.max(+t2, 0), 1);
22064       var nodes = nodeIDs.map(function(id2) {
22065         return graph.entity(id2);
22066       });
22067       var points = nodes.map(function(n3) {
22068         return projection2(n3.loc);
22069       });
22070       var endpoints = getEndpoints(points);
22071       var startPoint = endpoints[0];
22072       var endPoint = endpoints[1];
22073       for (var i3 = 0; i3 < points.length; i3++) {
22074         var node = nodes[i3];
22075         var point = points[i3];
22076         var u2 = positionAlongWay(point, startPoint, endPoint);
22077         var point2 = geoVecInterp(startPoint, endPoint, u2);
22078         var loc2 = projection2.invert(point2);
22079         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
22080       }
22081       return graph;
22082     };
22083     action.disabled = function(graph) {
22084       var nodes = nodeIDs.map(function(id2) {
22085         return graph.entity(id2);
22086       });
22087       var points = nodes.map(function(n3) {
22088         return projection2(n3.loc);
22089       });
22090       var endpoints = getEndpoints(points);
22091       var startPoint = endpoints[0];
22092       var endPoint = endpoints[1];
22093       var maxDistance = 0;
22094       for (var i3 = 0; i3 < points.length; i3++) {
22095         var point = points[i3];
22096         var u2 = positionAlongWay(point, startPoint, endPoint);
22097         var p2 = geoVecInterp(startPoint, endPoint, u2);
22098         var dist = geoVecLength(p2, point);
22099         if (!isNaN(dist) && dist > maxDistance) {
22100           maxDistance = dist;
22101         }
22102       }
22103       if (maxDistance < 1e-4) {
22104         return "straight_enough";
22105       }
22106     };
22107     action.transitionable = true;
22108     return action;
22109   }
22110   var init_straighten_nodes = __esm({
22111     "modules/actions/straighten_nodes.js"() {
22112       "use strict";
22113       init_geo2();
22114     }
22115   });
22116
22117   // modules/actions/straighten_way.js
22118   var straighten_way_exports = {};
22119   __export(straighten_way_exports, {
22120     actionStraightenWay: () => actionStraightenWay
22121   });
22122   function actionStraightenWay(selectedIDs, projection2) {
22123     function positionAlongWay(a4, o2, b3) {
22124       return geoVecDot(a4, b3, o2) / geoVecDot(b3, b3, o2);
22125     }
22126     function allNodes(graph) {
22127       var nodes = [];
22128       var startNodes = [];
22129       var endNodes = [];
22130       var remainingWays = [];
22131       var selectedWays = selectedIDs.filter(function(w3) {
22132         return graph.entity(w3).type === "way";
22133       });
22134       var selectedNodes = selectedIDs.filter(function(n3) {
22135         return graph.entity(n3).type === "node";
22136       });
22137       for (var i3 = 0; i3 < selectedWays.length; i3++) {
22138         var way = graph.entity(selectedWays[i3]);
22139         nodes = way.nodes.slice(0);
22140         remainingWays.push(nodes);
22141         startNodes.push(nodes[0]);
22142         endNodes.push(nodes[nodes.length - 1]);
22143       }
22144       startNodes = startNodes.filter(function(n3) {
22145         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
22146       });
22147       endNodes = endNodes.filter(function(n3) {
22148         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
22149       });
22150       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
22151       var nextWay = [];
22152       nodes = [];
22153       var getNextWay = function(currNode2, remainingWays2) {
22154         return remainingWays2.filter(function(way2) {
22155           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
22156         })[0];
22157       };
22158       while (remainingWays.length) {
22159         nextWay = getNextWay(currNode, remainingWays);
22160         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
22161         if (nextWay[0] !== currNode) {
22162           nextWay.reverse();
22163         }
22164         nodes = nodes.concat(nextWay);
22165         currNode = nodes[nodes.length - 1];
22166       }
22167       if (selectedNodes.length === 2) {
22168         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
22169         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
22170         var sortedStartEnd = [startNodeIdx, endNodeIdx];
22171         sortedStartEnd.sort(function(a4, b3) {
22172           return a4 - b3;
22173         });
22174         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
22175       }
22176       return nodes.map(function(n3) {
22177         return graph.entity(n3);
22178       });
22179     }
22180     function shouldKeepNode(node, graph) {
22181       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
22182     }
22183     var action = function(graph, t2) {
22184       if (t2 === null || !isFinite(t2)) t2 = 1;
22185       t2 = Math.min(Math.max(+t2, 0), 1);
22186       var nodes = allNodes(graph);
22187       var points = nodes.map(function(n3) {
22188         return projection2(n3.loc);
22189       });
22190       var startPoint = points[0];
22191       var endPoint = points[points.length - 1];
22192       var toDelete = [];
22193       var i3;
22194       for (i3 = 1; i3 < points.length - 1; i3++) {
22195         var node = nodes[i3];
22196         var point = points[i3];
22197         if (t2 < 1 || shouldKeepNode(node, graph)) {
22198           var u2 = positionAlongWay(point, startPoint, endPoint);
22199           var p2 = geoVecInterp(startPoint, endPoint, u2);
22200           var loc2 = projection2.invert(p2);
22201           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
22202         } else {
22203           if (toDelete.indexOf(node) === -1) {
22204             toDelete.push(node);
22205           }
22206         }
22207       }
22208       for (i3 = 0; i3 < toDelete.length; i3++) {
22209         graph = actionDeleteNode(toDelete[i3].id)(graph);
22210       }
22211       return graph;
22212     };
22213     action.disabled = function(graph) {
22214       var nodes = allNodes(graph);
22215       var points = nodes.map(function(n3) {
22216         return projection2(n3.loc);
22217       });
22218       var startPoint = points[0];
22219       var endPoint = points[points.length - 1];
22220       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
22221       var i3;
22222       if (threshold === 0) {
22223         return "too_bendy";
22224       }
22225       var maxDistance = 0;
22226       for (i3 = 1; i3 < points.length - 1; i3++) {
22227         var point = points[i3];
22228         var u2 = positionAlongWay(point, startPoint, endPoint);
22229         var p2 = geoVecInterp(startPoint, endPoint, u2);
22230         var dist = geoVecLength(p2, point);
22231         if (isNaN(dist) || dist > threshold) {
22232           return "too_bendy";
22233         } else if (dist > maxDistance) {
22234           maxDistance = dist;
22235         }
22236       }
22237       var keepingAllNodes = nodes.every(function(node, i4) {
22238         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
22239       });
22240       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
22241       keepingAllNodes) {
22242         return "straight_enough";
22243       }
22244     };
22245     action.transitionable = true;
22246     return action;
22247   }
22248   var init_straighten_way = __esm({
22249     "modules/actions/straighten_way.js"() {
22250       "use strict";
22251       init_delete_node();
22252       init_geo2();
22253       init_util();
22254     }
22255   });
22256
22257   // modules/actions/unrestrict_turn.js
22258   var unrestrict_turn_exports = {};
22259   __export(unrestrict_turn_exports, {
22260     actionUnrestrictTurn: () => actionUnrestrictTurn
22261   });
22262   function actionUnrestrictTurn(turn) {
22263     return function(graph) {
22264       return actionDeleteRelation(turn.restrictionID)(graph);
22265     };
22266   }
22267   var init_unrestrict_turn = __esm({
22268     "modules/actions/unrestrict_turn.js"() {
22269       "use strict";
22270       init_delete_relation();
22271     }
22272   });
22273
22274   // modules/actions/upgrade_tags.js
22275   var upgrade_tags_exports = {};
22276   __export(upgrade_tags_exports, {
22277     actionUpgradeTags: () => actionUpgradeTags
22278   });
22279   function actionUpgradeTags(entityId, oldTags, replaceTags) {
22280     return function(graph) {
22281       var entity = graph.entity(entityId);
22282       var tags = Object.assign({}, entity.tags);
22283       var transferValue;
22284       var semiIndex;
22285       for (var oldTagKey in oldTags) {
22286         if (!(oldTagKey in tags)) continue;
22287         if (oldTags[oldTagKey] === "*") {
22288           transferValue = tags[oldTagKey];
22289           delete tags[oldTagKey];
22290         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
22291           delete tags[oldTagKey];
22292         } else {
22293           var vals = tags[oldTagKey].split(";").filter(Boolean);
22294           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
22295           if (vals.length === 1 || oldIndex === -1) {
22296             delete tags[oldTagKey];
22297           } else {
22298             if (replaceTags && replaceTags[oldTagKey]) {
22299               semiIndex = oldIndex;
22300             }
22301             vals.splice(oldIndex, 1);
22302             tags[oldTagKey] = vals.join(";");
22303           }
22304         }
22305       }
22306       if (replaceTags) {
22307         for (var replaceKey in replaceTags) {
22308           var replaceValue = replaceTags[replaceKey];
22309           if (replaceValue === "*") {
22310             if (tags[replaceKey] && tags[replaceKey] !== "no") {
22311               continue;
22312             } else {
22313               tags[replaceKey] = "yes";
22314             }
22315           } else if (replaceValue === "$1") {
22316             tags[replaceKey] = transferValue;
22317           } else {
22318             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
22319               var existingVals = tags[replaceKey].split(";").filter(Boolean);
22320               if (existingVals.indexOf(replaceValue) === -1) {
22321                 existingVals.splice(semiIndex, 0, replaceValue);
22322                 tags[replaceKey] = existingVals.join(";");
22323               }
22324             } else {
22325               tags[replaceKey] = replaceValue;
22326             }
22327           }
22328         }
22329       }
22330       return graph.replace(entity.update({ tags }));
22331     };
22332   }
22333   var init_upgrade_tags = __esm({
22334     "modules/actions/upgrade_tags.js"() {
22335       "use strict";
22336     }
22337   });
22338
22339   // modules/core/preferences.js
22340   var preferences_exports = {};
22341   __export(preferences_exports, {
22342     prefs: () => corePreferences
22343   });
22344   function corePreferences(k3, v3) {
22345     try {
22346       if (v3 === void 0) return _storage.getItem(k3);
22347       else if (v3 === null) _storage.removeItem(k3);
22348       else _storage.setItem(k3, v3);
22349       if (_listeners[k3]) {
22350         _listeners[k3].forEach((handler) => handler(v3));
22351       }
22352       return true;
22353     } catch {
22354       if (typeof console !== "undefined") {
22355         console.error("localStorage quota exceeded");
22356       }
22357       return false;
22358     }
22359   }
22360   var _storage, _listeners;
22361   var init_preferences = __esm({
22362     "modules/core/preferences.js"() {
22363       "use strict";
22364       try {
22365         _storage = localStorage;
22366       } catch {
22367       }
22368       _storage = _storage || /* @__PURE__ */ (() => {
22369         let s2 = {};
22370         return {
22371           getItem: (k3) => s2[k3],
22372           setItem: (k3, v3) => s2[k3] = v3,
22373           removeItem: (k3) => delete s2[k3]
22374         };
22375       })();
22376       _listeners = {};
22377       corePreferences.onChange = function(k3, handler) {
22378         _listeners[k3] = _listeners[k3] || [];
22379         _listeners[k3].push(handler);
22380       };
22381     }
22382   });
22383
22384   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
22385   var require_quickselect = __commonJS({
22386     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
22387       (function(global2, factory) {
22388         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
22389       })(exports2, function() {
22390         "use strict";
22391         function quickselect3(arr, k3, left, right, compare2) {
22392           quickselectStep(arr, k3, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
22393         }
22394         function quickselectStep(arr, k3, left, right, compare2) {
22395           while (right > left) {
22396             if (right - left > 600) {
22397               var n3 = right - left + 1;
22398               var m3 = k3 - left + 1;
22399               var z3 = Math.log(n3);
22400               var s2 = 0.5 * Math.exp(2 * z3 / 3);
22401               var sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
22402               var newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
22403               var newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
22404               quickselectStep(arr, k3, newLeft, newRight, compare2);
22405             }
22406             var t2 = arr[k3];
22407             var i3 = left;
22408             var j3 = right;
22409             swap3(arr, left, k3);
22410             if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
22411             while (i3 < j3) {
22412               swap3(arr, i3, j3);
22413               i3++;
22414               j3--;
22415               while (compare2(arr[i3], t2) < 0) i3++;
22416               while (compare2(arr[j3], t2) > 0) j3--;
22417             }
22418             if (compare2(arr[left], t2) === 0) swap3(arr, left, j3);
22419             else {
22420               j3++;
22421               swap3(arr, j3, right);
22422             }
22423             if (j3 <= k3) left = j3 + 1;
22424             if (k3 <= j3) right = j3 - 1;
22425           }
22426         }
22427         function swap3(arr, i3, j3) {
22428           var tmp = arr[i3];
22429           arr[i3] = arr[j3];
22430           arr[j3] = tmp;
22431         }
22432         function defaultCompare2(a4, b3) {
22433           return a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
22434         }
22435         return quickselect3;
22436       });
22437     }
22438   });
22439
22440   // node_modules/which-polygon/node_modules/rbush/index.js
22441   var require_rbush = __commonJS({
22442     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
22443       "use strict";
22444       module2.exports = rbush;
22445       module2.exports.default = rbush;
22446       var quickselect3 = require_quickselect();
22447       function rbush(maxEntries, format2) {
22448         if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
22449         this._maxEntries = Math.max(4, maxEntries || 9);
22450         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
22451         if (format2) {
22452           this._initFormat(format2);
22453         }
22454         this.clear();
22455       }
22456       rbush.prototype = {
22457         all: function() {
22458           return this._all(this.data, []);
22459         },
22460         search: function(bbox2) {
22461           var node = this.data, result = [], toBBox = this.toBBox;
22462           if (!intersects2(bbox2, node)) return result;
22463           var nodesToSearch = [], i3, len, child, childBBox;
22464           while (node) {
22465             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22466               child = node.children[i3];
22467               childBBox = node.leaf ? toBBox(child) : child;
22468               if (intersects2(bbox2, childBBox)) {
22469                 if (node.leaf) result.push(child);
22470                 else if (contains2(bbox2, childBBox)) this._all(child, result);
22471                 else nodesToSearch.push(child);
22472               }
22473             }
22474             node = nodesToSearch.pop();
22475           }
22476           return result;
22477         },
22478         collides: function(bbox2) {
22479           var node = this.data, toBBox = this.toBBox;
22480           if (!intersects2(bbox2, node)) return false;
22481           var nodesToSearch = [], i3, len, child, childBBox;
22482           while (node) {
22483             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22484               child = node.children[i3];
22485               childBBox = node.leaf ? toBBox(child) : child;
22486               if (intersects2(bbox2, childBBox)) {
22487                 if (node.leaf || contains2(bbox2, childBBox)) return true;
22488                 nodesToSearch.push(child);
22489               }
22490             }
22491             node = nodesToSearch.pop();
22492           }
22493           return false;
22494         },
22495         load: function(data) {
22496           if (!(data && data.length)) return this;
22497           if (data.length < this._minEntries) {
22498             for (var i3 = 0, len = data.length; i3 < len; i3++) {
22499               this.insert(data[i3]);
22500             }
22501             return this;
22502           }
22503           var node = this._build(data.slice(), 0, data.length - 1, 0);
22504           if (!this.data.children.length) {
22505             this.data = node;
22506           } else if (this.data.height === node.height) {
22507             this._splitRoot(this.data, node);
22508           } else {
22509             if (this.data.height < node.height) {
22510               var tmpNode = this.data;
22511               this.data = node;
22512               node = tmpNode;
22513             }
22514             this._insert(node, this.data.height - node.height - 1, true);
22515           }
22516           return this;
22517         },
22518         insert: function(item) {
22519           if (item) this._insert(item, this.data.height - 1);
22520           return this;
22521         },
22522         clear: function() {
22523           this.data = createNode2([]);
22524           return this;
22525         },
22526         remove: function(item, equalsFn) {
22527           if (!item) return this;
22528           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent2, index, goingUp;
22529           while (node || path.length) {
22530             if (!node) {
22531               node = path.pop();
22532               parent2 = path[path.length - 1];
22533               i3 = indexes.pop();
22534               goingUp = true;
22535             }
22536             if (node.leaf) {
22537               index = findItem2(item, node.children, equalsFn);
22538               if (index !== -1) {
22539                 node.children.splice(index, 1);
22540                 path.push(node);
22541                 this._condense(path);
22542                 return this;
22543               }
22544             }
22545             if (!goingUp && !node.leaf && contains2(node, bbox2)) {
22546               path.push(node);
22547               indexes.push(i3);
22548               i3 = 0;
22549               parent2 = node;
22550               node = node.children[0];
22551             } else if (parent2) {
22552               i3++;
22553               node = parent2.children[i3];
22554               goingUp = false;
22555             } else node = null;
22556           }
22557           return this;
22558         },
22559         toBBox: function(item) {
22560           return item;
22561         },
22562         compareMinX: compareNodeMinX2,
22563         compareMinY: compareNodeMinY2,
22564         toJSON: function() {
22565           return this.data;
22566         },
22567         fromJSON: function(data) {
22568           this.data = data;
22569           return this;
22570         },
22571         _all: function(node, result) {
22572           var nodesToSearch = [];
22573           while (node) {
22574             if (node.leaf) result.push.apply(result, node.children);
22575             else nodesToSearch.push.apply(nodesToSearch, node.children);
22576             node = nodesToSearch.pop();
22577           }
22578           return result;
22579         },
22580         _build: function(items, left, right, height) {
22581           var N3 = right - left + 1, M3 = this._maxEntries, node;
22582           if (N3 <= M3) {
22583             node = createNode2(items.slice(left, right + 1));
22584             calcBBox2(node, this.toBBox);
22585             return node;
22586           }
22587           if (!height) {
22588             height = Math.ceil(Math.log(N3) / Math.log(M3));
22589             M3 = Math.ceil(N3 / Math.pow(M3, height - 1));
22590           }
22591           node = createNode2([]);
22592           node.leaf = false;
22593           node.height = height;
22594           var N22 = Math.ceil(N3 / M3), N1 = N22 * Math.ceil(Math.sqrt(M3)), i3, j3, right2, right3;
22595           multiSelect2(items, left, right, N1, this.compareMinX);
22596           for (i3 = left; i3 <= right; i3 += N1) {
22597             right2 = Math.min(i3 + N1 - 1, right);
22598             multiSelect2(items, i3, right2, N22, this.compareMinY);
22599             for (j3 = i3; j3 <= right2; j3 += N22) {
22600               right3 = Math.min(j3 + N22 - 1, right2);
22601               node.children.push(this._build(items, j3, right3, height - 1));
22602             }
22603           }
22604           calcBBox2(node, this.toBBox);
22605           return node;
22606         },
22607         _chooseSubtree: function(bbox2, node, level, path) {
22608           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
22609           while (true) {
22610             path.push(node);
22611             if (node.leaf || path.length - 1 === level) break;
22612             minArea = minEnlargement = Infinity;
22613             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
22614               child = node.children[i3];
22615               area = bboxArea2(child);
22616               enlargement = enlargedArea2(bbox2, child) - area;
22617               if (enlargement < minEnlargement) {
22618                 minEnlargement = enlargement;
22619                 minArea = area < minArea ? area : minArea;
22620                 targetNode = child;
22621               } else if (enlargement === minEnlargement) {
22622                 if (area < minArea) {
22623                   minArea = area;
22624                   targetNode = child;
22625                 }
22626               }
22627             }
22628             node = targetNode || node.children[0];
22629           }
22630           return node;
22631         },
22632         _insert: function(item, level, isNode) {
22633           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
22634           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
22635           node.children.push(item);
22636           extend3(node, bbox2);
22637           while (level >= 0) {
22638             if (insertPath[level].children.length > this._maxEntries) {
22639               this._split(insertPath, level);
22640               level--;
22641             } else break;
22642           }
22643           this._adjustParentBBoxes(bbox2, insertPath, level);
22644         },
22645         // split overflowed node into two
22646         _split: function(insertPath, level) {
22647           var node = insertPath[level], M3 = node.children.length, m3 = this._minEntries;
22648           this._chooseSplitAxis(node, m3, M3);
22649           var splitIndex = this._chooseSplitIndex(node, m3, M3);
22650           var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
22651           newNode.height = node.height;
22652           newNode.leaf = node.leaf;
22653           calcBBox2(node, this.toBBox);
22654           calcBBox2(newNode, this.toBBox);
22655           if (level) insertPath[level - 1].children.push(newNode);
22656           else this._splitRoot(node, newNode);
22657         },
22658         _splitRoot: function(node, newNode) {
22659           this.data = createNode2([node, newNode]);
22660           this.data.height = node.height + 1;
22661           this.data.leaf = false;
22662           calcBBox2(this.data, this.toBBox);
22663         },
22664         _chooseSplitIndex: function(node, m3, M3) {
22665           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
22666           minOverlap = minArea = Infinity;
22667           for (i3 = m3; i3 <= M3 - m3; i3++) {
22668             bbox1 = distBBox2(node, 0, i3, this.toBBox);
22669             bbox2 = distBBox2(node, i3, M3, this.toBBox);
22670             overlap = intersectionArea2(bbox1, bbox2);
22671             area = bboxArea2(bbox1) + bboxArea2(bbox2);
22672             if (overlap < minOverlap) {
22673               minOverlap = overlap;
22674               index = i3;
22675               minArea = area < minArea ? area : minArea;
22676             } else if (overlap === minOverlap) {
22677               if (area < minArea) {
22678                 minArea = area;
22679                 index = i3;
22680               }
22681             }
22682           }
22683           return index;
22684         },
22685         // sorts node children by the best axis for split
22686         _chooseSplitAxis: function(node, m3, M3) {
22687           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m3, M3, compareMinX), yMargin = this._allDistMargin(node, m3, M3, compareMinY);
22688           if (xMargin < yMargin) node.children.sort(compareMinX);
22689         },
22690         // total margin of all possible split distributions where each node is at least m full
22691         _allDistMargin: function(node, m3, M3, compare2) {
22692           node.children.sort(compare2);
22693           var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m3, toBBox), rightBBox = distBBox2(node, M3 - m3, M3, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
22694           for (i3 = m3; i3 < M3 - m3; i3++) {
22695             child = node.children[i3];
22696             extend3(leftBBox, node.leaf ? toBBox(child) : child);
22697             margin += bboxMargin2(leftBBox);
22698           }
22699           for (i3 = M3 - m3 - 1; i3 >= m3; i3--) {
22700             child = node.children[i3];
22701             extend3(rightBBox, node.leaf ? toBBox(child) : child);
22702             margin += bboxMargin2(rightBBox);
22703           }
22704           return margin;
22705         },
22706         _adjustParentBBoxes: function(bbox2, path, level) {
22707           for (var i3 = level; i3 >= 0; i3--) {
22708             extend3(path[i3], bbox2);
22709           }
22710         },
22711         _condense: function(path) {
22712           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
22713             if (path[i3].children.length === 0) {
22714               if (i3 > 0) {
22715                 siblings = path[i3 - 1].children;
22716                 siblings.splice(siblings.indexOf(path[i3]), 1);
22717               } else this.clear();
22718             } else calcBBox2(path[i3], this.toBBox);
22719           }
22720         },
22721         _initFormat: function(format2) {
22722           var compareArr = ["return a", " - b", ";"];
22723           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
22724           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
22725           this.toBBox = new Function(
22726             "a",
22727             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
22728           );
22729         }
22730       };
22731       function findItem2(item, items, equalsFn) {
22732         if (!equalsFn) return items.indexOf(item);
22733         for (var i3 = 0; i3 < items.length; i3++) {
22734           if (equalsFn(item, items[i3])) return i3;
22735         }
22736         return -1;
22737       }
22738       function calcBBox2(node, toBBox) {
22739         distBBox2(node, 0, node.children.length, toBBox, node);
22740       }
22741       function distBBox2(node, k3, p2, toBBox, destNode) {
22742         if (!destNode) destNode = createNode2(null);
22743         destNode.minX = Infinity;
22744         destNode.minY = Infinity;
22745         destNode.maxX = -Infinity;
22746         destNode.maxY = -Infinity;
22747         for (var i3 = k3, child; i3 < p2; i3++) {
22748           child = node.children[i3];
22749           extend3(destNode, node.leaf ? toBBox(child) : child);
22750         }
22751         return destNode;
22752       }
22753       function extend3(a4, b3) {
22754         a4.minX = Math.min(a4.minX, b3.minX);
22755         a4.minY = Math.min(a4.minY, b3.minY);
22756         a4.maxX = Math.max(a4.maxX, b3.maxX);
22757         a4.maxY = Math.max(a4.maxY, b3.maxY);
22758         return a4;
22759       }
22760       function compareNodeMinX2(a4, b3) {
22761         return a4.minX - b3.minX;
22762       }
22763       function compareNodeMinY2(a4, b3) {
22764         return a4.minY - b3.minY;
22765       }
22766       function bboxArea2(a4) {
22767         return (a4.maxX - a4.minX) * (a4.maxY - a4.minY);
22768       }
22769       function bboxMargin2(a4) {
22770         return a4.maxX - a4.minX + (a4.maxY - a4.minY);
22771       }
22772       function enlargedArea2(a4, b3) {
22773         return (Math.max(b3.maxX, a4.maxX) - Math.min(b3.minX, a4.minX)) * (Math.max(b3.maxY, a4.maxY) - Math.min(b3.minY, a4.minY));
22774       }
22775       function intersectionArea2(a4, b3) {
22776         var minX = Math.max(a4.minX, b3.minX), minY = Math.max(a4.minY, b3.minY), maxX = Math.min(a4.maxX, b3.maxX), maxY = Math.min(a4.maxY, b3.maxY);
22777         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
22778       }
22779       function contains2(a4, b3) {
22780         return a4.minX <= b3.minX && a4.minY <= b3.minY && b3.maxX <= a4.maxX && b3.maxY <= a4.maxY;
22781       }
22782       function intersects2(a4, b3) {
22783         return b3.minX <= a4.maxX && b3.minY <= a4.maxY && b3.maxX >= a4.minX && b3.maxY >= a4.minY;
22784       }
22785       function createNode2(children2) {
22786         return {
22787           children: children2,
22788           height: 1,
22789           leaf: true,
22790           minX: Infinity,
22791           minY: Infinity,
22792           maxX: -Infinity,
22793           maxY: -Infinity
22794         };
22795       }
22796       function multiSelect2(arr, left, right, n3, compare2) {
22797         var stack = [left, right], mid;
22798         while (stack.length) {
22799           right = stack.pop();
22800           left = stack.pop();
22801           if (right - left <= n3) continue;
22802           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
22803           quickselect3(arr, mid, left, right, compare2);
22804           stack.push(left, mid, mid, right);
22805         }
22806       }
22807     }
22808   });
22809
22810   // node_modules/lineclip/index.js
22811   var require_lineclip = __commonJS({
22812     "node_modules/lineclip/index.js"(exports2, module2) {
22813       "use strict";
22814       module2.exports = lineclip2;
22815       lineclip2.polyline = lineclip2;
22816       lineclip2.polygon = polygonclip2;
22817       function lineclip2(points, bbox2, result) {
22818         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a4, b3, codeB, lastCode;
22819         if (!result) result = [];
22820         for (i3 = 1; i3 < len; i3++) {
22821           a4 = points[i3 - 1];
22822           b3 = points[i3];
22823           codeB = lastCode = bitCode2(b3, bbox2);
22824           while (true) {
22825             if (!(codeA | codeB)) {
22826               part.push(a4);
22827               if (codeB !== lastCode) {
22828                 part.push(b3);
22829                 if (i3 < len - 1) {
22830                   result.push(part);
22831                   part = [];
22832                 }
22833               } else if (i3 === len - 1) {
22834                 part.push(b3);
22835               }
22836               break;
22837             } else if (codeA & codeB) {
22838               break;
22839             } else if (codeA) {
22840               a4 = intersect2(a4, b3, codeA, bbox2);
22841               codeA = bitCode2(a4, bbox2);
22842             } else {
22843               b3 = intersect2(a4, b3, codeB, bbox2);
22844               codeB = bitCode2(b3, bbox2);
22845             }
22846           }
22847           codeA = lastCode;
22848         }
22849         if (part.length) result.push(part);
22850         return result;
22851       }
22852       function polygonclip2(points, bbox2) {
22853         var result, edge, prev, prevInside, i3, p2, inside;
22854         for (edge = 1; edge <= 8; edge *= 2) {
22855           result = [];
22856           prev = points[points.length - 1];
22857           prevInside = !(bitCode2(prev, bbox2) & edge);
22858           for (i3 = 0; i3 < points.length; i3++) {
22859             p2 = points[i3];
22860             inside = !(bitCode2(p2, bbox2) & edge);
22861             if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
22862             if (inside) result.push(p2);
22863             prev = p2;
22864             prevInside = inside;
22865           }
22866           points = result;
22867           if (!points.length) break;
22868         }
22869         return result;
22870       }
22871       function intersect2(a4, b3, edge, bbox2) {
22872         return edge & 8 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[3] - a4[1]) / (b3[1] - a4[1]), bbox2[3]] : (
22873           // top
22874           edge & 4 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[1] - a4[1]) / (b3[1] - a4[1]), bbox2[1]] : (
22875             // bottom
22876             edge & 2 ? [bbox2[2], a4[1] + (b3[1] - a4[1]) * (bbox2[2] - a4[0]) / (b3[0] - a4[0])] : (
22877               // right
22878               edge & 1 ? [bbox2[0], a4[1] + (b3[1] - a4[1]) * (bbox2[0] - a4[0]) / (b3[0] - a4[0])] : (
22879                 // left
22880                 null
22881               )
22882             )
22883           )
22884         );
22885       }
22886       function bitCode2(p2, bbox2) {
22887         var code = 0;
22888         if (p2[0] < bbox2[0]) code |= 1;
22889         else if (p2[0] > bbox2[2]) code |= 2;
22890         if (p2[1] < bbox2[1]) code |= 4;
22891         else if (p2[1] > bbox2[3]) code |= 8;
22892         return code;
22893       }
22894     }
22895   });
22896
22897   // node_modules/which-polygon/index.js
22898   var require_which_polygon = __commonJS({
22899     "node_modules/which-polygon/index.js"(exports2, module2) {
22900       "use strict";
22901       var rbush = require_rbush();
22902       var lineclip2 = require_lineclip();
22903       module2.exports = whichPolygon5;
22904       function whichPolygon5(data) {
22905         var bboxes = [];
22906         for (var i3 = 0; i3 < data.features.length; i3++) {
22907           var feature3 = data.features[i3];
22908           if (!feature3.geometry) continue;
22909           var coords = feature3.geometry.coordinates;
22910           if (feature3.geometry.type === "Polygon") {
22911             bboxes.push(treeItem(coords, feature3.properties));
22912           } else if (feature3.geometry.type === "MultiPolygon") {
22913             for (var j3 = 0; j3 < coords.length; j3++) {
22914               bboxes.push(treeItem(coords[j3], feature3.properties));
22915             }
22916           }
22917         }
22918         var tree = rbush().load(bboxes);
22919         function query(p2, multi) {
22920           var output = [], result = tree.search({
22921             minX: p2[0],
22922             minY: p2[1],
22923             maxX: p2[0],
22924             maxY: p2[1]
22925           });
22926           for (var i4 = 0; i4 < result.length; i4++) {
22927             if (insidePolygon(result[i4].coords, p2)) {
22928               if (multi)
22929                 output.push(result[i4].props);
22930               else
22931                 return result[i4].props;
22932             }
22933           }
22934           return multi && output.length ? output : null;
22935         }
22936         query.tree = tree;
22937         query.bbox = function queryBBox(bbox2) {
22938           var output = [];
22939           var result = tree.search({
22940             minX: bbox2[0],
22941             minY: bbox2[1],
22942             maxX: bbox2[2],
22943             maxY: bbox2[3]
22944           });
22945           for (var i4 = 0; i4 < result.length; i4++) {
22946             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
22947               output.push(result[i4].props);
22948             }
22949           }
22950           return output;
22951         };
22952         return query;
22953       }
22954       function polygonIntersectsBBox(polygon2, bbox2) {
22955         var bboxCenter = [
22956           (bbox2[0] + bbox2[2]) / 2,
22957           (bbox2[1] + bbox2[3]) / 2
22958         ];
22959         if (insidePolygon(polygon2, bboxCenter)) return true;
22960         for (var i3 = 0; i3 < polygon2.length; i3++) {
22961           if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
22962         }
22963         return false;
22964       }
22965       function insidePolygon(rings, p2) {
22966         var inside = false;
22967         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
22968           var ring = rings[i3];
22969           for (var j3 = 0, len2 = ring.length, k3 = len2 - 1; j3 < len2; k3 = j3++) {
22970             if (rayIntersect(p2, ring[j3], ring[k3])) inside = !inside;
22971           }
22972         }
22973         return inside;
22974       }
22975       function rayIntersect(p2, p1, p22) {
22976         return p1[1] > p2[1] !== p22[1] > p2[1] && p2[0] < (p22[0] - p1[0]) * (p2[1] - p1[1]) / (p22[1] - p1[1]) + p1[0];
22977       }
22978       function treeItem(coords, props) {
22979         var item = {
22980           minX: Infinity,
22981           minY: Infinity,
22982           maxX: -Infinity,
22983           maxY: -Infinity,
22984           coords,
22985           props
22986         };
22987         for (var i3 = 0; i3 < coords[0].length; i3++) {
22988           var p2 = coords[0][i3];
22989           item.minX = Math.min(item.minX, p2[0]);
22990           item.minY = Math.min(item.minY, p2[1]);
22991           item.maxX = Math.max(item.maxX, p2[0]);
22992           item.maxY = Math.max(item.maxY, p2[1]);
22993         }
22994         return item;
22995       }
22996     }
22997   });
22998
22999   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
23000   function canonicalID(id2) {
23001     const s2 = id2 || "";
23002     if (s2.charAt(0) === ".") {
23003       return s2.toUpperCase();
23004     } else {
23005       return s2.replace(idFilterRegex, "").toUpperCase();
23006     }
23007   }
23008   function loadDerivedDataAndCaches(borders2) {
23009     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23010     let geometryFeatures = [];
23011     for (const feature22 of borders2.features) {
23012       const props = feature22.properties;
23013       props.id = props.iso1A2 || props.m49 || props.wikidata;
23014       loadM49(feature22);
23015       loadTLD(feature22);
23016       loadIsoStatus(feature22);
23017       loadLevel(feature22);
23018       loadGroups(feature22);
23019       loadFlag(feature22);
23020       cacheFeatureByIDs(feature22);
23021       if (feature22.geometry) {
23022         geometryFeatures.push(feature22);
23023       }
23024     }
23025     for (const feature22 of borders2.features) {
23026       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23027         return _featuresByCode[groupID].properties.id;
23028       });
23029       loadMembersForGroupsOf(feature22);
23030     }
23031     for (const feature22 of borders2.features) {
23032       loadRoadSpeedUnit(feature22);
23033       loadRoadHeightUnit(feature22);
23034       loadDriveSide(feature22);
23035       loadCallingCodes(feature22);
23036       loadGroupGroups(feature22);
23037     }
23038     for (const feature22 of borders2.features) {
23039       feature22.properties.groups.sort((groupID1, groupID2) => {
23040         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
23041       });
23042       if (feature22.properties.members) {
23043         feature22.properties.members.sort((id1, id2) => {
23044           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
23045           if (diff === 0) {
23046             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
23047           }
23048           return diff;
23049         });
23050       }
23051     }
23052     const geometryOnlyCollection = {
23053       type: "FeatureCollection",
23054       features: geometryFeatures
23055     };
23056     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
23057     function loadGroups(feature22) {
23058       const props = feature22.properties;
23059       if (!props.groups) {
23060         props.groups = [];
23061       }
23062       if (feature22.geometry && props.country) {
23063         props.groups.push(props.country);
23064       }
23065       if (props.m49 !== "001") {
23066         props.groups.push("001");
23067       }
23068     }
23069     function loadM49(feature22) {
23070       const props = feature22.properties;
23071       if (!props.m49 && props.iso1N3) {
23072         props.m49 = props.iso1N3;
23073       }
23074     }
23075     function loadTLD(feature22) {
23076       const props = feature22.properties;
23077       if (props.level === "unitedNations") return;
23078       if (props.ccTLD === null) return;
23079       if (!props.ccTLD && props.iso1A2) {
23080         props.ccTLD = "." + props.iso1A2.toLowerCase();
23081       }
23082     }
23083     function loadIsoStatus(feature22) {
23084       const props = feature22.properties;
23085       if (!props.isoStatus && props.iso1A2) {
23086         props.isoStatus = "official";
23087       }
23088     }
23089     function loadLevel(feature22) {
23090       const props = feature22.properties;
23091       if (props.level) return;
23092       if (!props.country) {
23093         props.level = "country";
23094       } else if (!props.iso1A2 || props.isoStatus === "official") {
23095         props.level = "territory";
23096       } else {
23097         props.level = "subterritory";
23098       }
23099     }
23100     function loadGroupGroups(feature22) {
23101       const props = feature22.properties;
23102       if (feature22.geometry || !props.members) return;
23103       const featureLevelIndex = levels.indexOf(props.level);
23104       let sharedGroups = [];
23105       props.members.forEach((memberID, index) => {
23106         const member = _featuresByCode[memberID];
23107         const memberGroups = member.properties.groups.filter((groupID) => {
23108           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
23109         });
23110         if (index === 0) {
23111           sharedGroups = memberGroups;
23112         } else {
23113           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23114         }
23115       });
23116       props.groups = props.groups.concat(
23117         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23118       );
23119       for (const groupID of sharedGroups) {
23120         const groupFeature = _featuresByCode[groupID];
23121         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23122           groupFeature.properties.members.push(props.id);
23123         }
23124       }
23125     }
23126     function loadRoadSpeedUnit(feature22) {
23127       const props = feature22.properties;
23128       if (feature22.geometry) {
23129         if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
23130       } else if (props.members) {
23131         const vals = Array.from(
23132           new Set(
23133             props.members.map((id2) => {
23134               const member = _featuresByCode[id2];
23135               if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
23136             }).filter(Boolean)
23137           )
23138         );
23139         if (vals.length === 1) props.roadSpeedUnit = vals[0];
23140       }
23141     }
23142     function loadRoadHeightUnit(feature22) {
23143       const props = feature22.properties;
23144       if (feature22.geometry) {
23145         if (!props.roadHeightUnit) props.roadHeightUnit = "m";
23146       } else if (props.members) {
23147         const vals = Array.from(
23148           new Set(
23149             props.members.map((id2) => {
23150               const member = _featuresByCode[id2];
23151               if (member.geometry) return member.properties.roadHeightUnit || "m";
23152             }).filter(Boolean)
23153           )
23154         );
23155         if (vals.length === 1) props.roadHeightUnit = vals[0];
23156       }
23157     }
23158     function loadDriveSide(feature22) {
23159       const props = feature22.properties;
23160       if (feature22.geometry) {
23161         if (!props.driveSide) props.driveSide = "right";
23162       } else if (props.members) {
23163         const vals = Array.from(
23164           new Set(
23165             props.members.map((id2) => {
23166               const member = _featuresByCode[id2];
23167               if (member.geometry) return member.properties.driveSide || "right";
23168             }).filter(Boolean)
23169           )
23170         );
23171         if (vals.length === 1) props.driveSide = vals[0];
23172       }
23173     }
23174     function loadCallingCodes(feature22) {
23175       const props = feature22.properties;
23176       if (!feature22.geometry && props.members) {
23177         props.callingCodes = Array.from(
23178           new Set(
23179             props.members.reduce((array2, id2) => {
23180               const member = _featuresByCode[id2];
23181               if (member.geometry && member.properties.callingCodes) {
23182                 return array2.concat(member.properties.callingCodes);
23183               }
23184               return array2;
23185             }, [])
23186           )
23187         );
23188       }
23189     }
23190     function loadFlag(feature22) {
23191       if (!feature22.properties.iso1A2) return;
23192       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23193         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23194       });
23195       feature22.properties.emojiFlag = flag;
23196     }
23197     function loadMembersForGroupsOf(feature22) {
23198       for (const groupID of feature22.properties.groups) {
23199         const groupFeature = _featuresByCode[groupID];
23200         if (!groupFeature.properties.members) {
23201           groupFeature.properties.members = [];
23202         }
23203         groupFeature.properties.members.push(feature22.properties.id);
23204       }
23205     }
23206     function cacheFeatureByIDs(feature22) {
23207       let ids = [];
23208       for (const prop of identifierProps) {
23209         const id2 = feature22.properties[prop];
23210         if (id2) {
23211           ids.push(id2);
23212         }
23213       }
23214       for (const alias of feature22.properties.aliases || []) {
23215         ids.push(alias);
23216       }
23217       for (const id2 of ids) {
23218         const cid = canonicalID(id2);
23219         _featuresByCode[cid] = feature22;
23220       }
23221     }
23222   }
23223   function locArray(loc) {
23224     if (Array.isArray(loc)) {
23225       return loc;
23226     } else if (loc.coordinates) {
23227       return loc.coordinates;
23228     }
23229     return loc.geometry.coordinates;
23230   }
23231   function smallestFeature(loc) {
23232     const query = locArray(loc);
23233     const featureProperties = _whichPolygon(query);
23234     if (!featureProperties) return null;
23235     return _featuresByCode[featureProperties.id];
23236   }
23237   function countryFeature(loc) {
23238     const feature22 = smallestFeature(loc);
23239     if (!feature22) return null;
23240     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23241     return _featuresByCode[countryCode] || null;
23242   }
23243   function featureForLoc(loc, opts) {
23244     const targetLevel = opts.level || "country";
23245     const maxLevel = opts.maxLevel || "world";
23246     const withProp = opts.withProp;
23247     const targetLevelIndex = levels.indexOf(targetLevel);
23248     if (targetLevelIndex === -1) return null;
23249     const maxLevelIndex = levels.indexOf(maxLevel);
23250     if (maxLevelIndex === -1) return null;
23251     if (maxLevelIndex < targetLevelIndex) return null;
23252     if (targetLevel === "country") {
23253       const fastFeature = countryFeature(loc);
23254       if (fastFeature) {
23255         if (!withProp || fastFeature.properties[withProp]) {
23256           return fastFeature;
23257         }
23258       }
23259     }
23260     const features = featuresContaining(loc);
23261     const match = features.find((feature22) => {
23262       let levelIndex = levels.indexOf(feature22.properties.level);
23263       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23264       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23265         if (!withProp || feature22.properties[withProp]) {
23266           return feature22;
23267         }
23268       }
23269       return false;
23270     });
23271     return match || null;
23272   }
23273   function featureForID(id2) {
23274     let stringID;
23275     if (typeof id2 === "number") {
23276       stringID = id2.toString();
23277       if (stringID.length === 1) {
23278         stringID = "00" + stringID;
23279       } else if (stringID.length === 2) {
23280         stringID = "0" + stringID;
23281       }
23282     } else {
23283       stringID = canonicalID(id2);
23284     }
23285     return _featuresByCode[stringID] || null;
23286   }
23287   function smallestFeaturesForBbox(bbox2) {
23288     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
23289   }
23290   function smallestOrMatchingFeature(query) {
23291     if (typeof query === "object") {
23292       return smallestFeature(query);
23293     }
23294     return featureForID(query);
23295   }
23296   function feature(query, opts = defaultOpts) {
23297     if (typeof query === "object") {
23298       return featureForLoc(query, opts);
23299     }
23300     return featureForID(query);
23301   }
23302   function iso1A2Code(query, opts = defaultOpts) {
23303     opts.withProp = "iso1A2";
23304     const match = feature(query, opts);
23305     if (!match) return null;
23306     return match.properties.iso1A2 || null;
23307   }
23308   function propertiesForQuery(query, property) {
23309     const features = featuresContaining(query, false);
23310     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
23311   }
23312   function iso1A2Codes(query) {
23313     return propertiesForQuery(query, "iso1A2");
23314   }
23315   function featuresContaining(query, strict) {
23316     let matchingFeatures;
23317     if (Array.isArray(query) && query.length === 4) {
23318       matchingFeatures = smallestFeaturesForBbox(query);
23319     } else {
23320       const smallestOrMatching = smallestOrMatchingFeature(query);
23321       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23322     }
23323     if (!matchingFeatures.length) return [];
23324     let returnFeatures;
23325     if (!strict || typeof query === "object") {
23326       returnFeatures = matchingFeatures.slice();
23327     } else {
23328       returnFeatures = [];
23329     }
23330     for (const feature22 of matchingFeatures) {
23331       const properties = feature22.properties;
23332       for (const groupID of properties.groups) {
23333         const groupFeature = _featuresByCode[groupID];
23334         if (returnFeatures.indexOf(groupFeature) === -1) {
23335           returnFeatures.push(groupFeature);
23336         }
23337       }
23338     }
23339     return returnFeatures;
23340   }
23341   function featuresIn(id2, strict) {
23342     const feature22 = featureForID(id2);
23343     if (!feature22) return [];
23344     let features = [];
23345     if (!strict) {
23346       features.push(feature22);
23347     }
23348     const properties = feature22.properties;
23349     for (const memberID of properties.members || []) {
23350       features.push(_featuresByCode[memberID]);
23351     }
23352     return features;
23353   }
23354   function aggregateFeature(id2) {
23355     var _a4;
23356     const features = featuresIn(id2, false);
23357     if (features.length === 0) return null;
23358     let aggregateCoordinates = [];
23359     for (const feature22 of features) {
23360       if (((_a4 = feature22.geometry) == null ? void 0 : _a4.type) === "MultiPolygon" && feature22.geometry.coordinates) {
23361         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23362       }
23363     }
23364     return {
23365       type: "Feature",
23366       properties: features[0].properties,
23367       geometry: {
23368         type: "MultiPolygon",
23369         coordinates: aggregateCoordinates
23370       }
23371     };
23372   }
23373   function roadSpeedUnit(query) {
23374     const feature22 = smallestOrMatchingFeature(query);
23375     return feature22 && feature22.properties.roadSpeedUnit || null;
23376   }
23377   function roadHeightUnit(query) {
23378     const feature22 = smallestOrMatchingFeature(query);
23379     return feature22 && feature22.properties.roadHeightUnit || null;
23380   }
23381   var import_which_polygon, borders_default, borders, _whichPolygon, _featuresByCode, idFilterRegex, levels, defaultOpts;
23382   var init_country_coder = __esm({
23383     "node_modules/@rapideditor/country-coder/dist/country-coder.mjs"() {
23384       import_which_polygon = __toESM(require_which_polygon(), 1);
23385       borders_default = { type: "FeatureCollection", features: [
23386         { 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]]]] } },
23387         { 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]]]] } },
23388         { 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]]]] } },
23389         { 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]]]] } },
23390         { 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]]]] } },
23391         { 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]]]] } },
23392         { 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]]]] } },
23393         { 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]]]] } },
23394         { 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]]]] } },
23395         { 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]]]] } },
23396         { 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]]]] } },
23397         { 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]]]] } },
23398         { 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]]]] } },
23399         { 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]]]] } },
23400         { 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]]]] } },
23401         { 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]]]] } },
23402         { 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]]]] } },
23403         { 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]]]] } },
23404         { 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]]]] } },
23405         { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
23406         { 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]]]] } },
23407         { 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.6333, 24.46259], [119.42295, 25.0886], [119.98511, 25.37624], [119.78816, 26.2348], [120.0693, 26.3959], [120.5128, 26.536], [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]]]] } },
23408         { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
23409         { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
23410         { 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.90247, 35.07686], [33.92495, 35.06789], [33.94869, 35.07277], [33.99999, 35.07016], [34.23164, 35.1777], [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]]]] } },
23411         { 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]]]] } },
23412         { 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]]]] } },
23413         { 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]]]] } },
23414         { 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]]]] } },
23415         { 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]]]] } },
23416         { 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]]]] } },
23417         { 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]]]] } },
23418         { 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]]]] } },
23419         { 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]]]] } },
23420         { 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]]]] } },
23421         { 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]]]] } },
23422         { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
23423         { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
23424         { 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]]]] } },
23425         { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
23426         { 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]]]] } },
23427         { 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]]]] } },
23428         { 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]]]] } },
23429         { 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]]]] } },
23430         { 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]]]] } },
23431         { 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]]]] } },
23432         { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
23433         { 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]]]] } },
23434         { 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]]]] } },
23435         { 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]]]] } },
23436         { 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]]]] } },
23437         { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
23438         { 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]]]] } },
23439         { 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]]]] } },
23440         { 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]]]] } },
23441         { 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]]]] } },
23442         { 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]]]] } },
23443         { 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]]]] } },
23444         { 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]]]] } },
23445         { 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]]]] } },
23446         { 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]]]] } },
23447         { 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]]]] } },
23448         { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
23449         { 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]]]] } },
23450         { 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]]]] } },
23451         { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
23452         { 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]]]] } },
23453         { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
23454         { 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]]]] } },
23455         { 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]]]] } },
23456         { 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], [-71.75113, 45.0114], [-72.09934, 45.00571], [-72.17312, 45.00587], [-72.71867, 45.01551], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.47782, 44.99747], [-74.7163, 45.00017], [-74.73876, 44.98856], [-74.76044, 44.99491], [-74.76308, 45.00624], [-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]]]] } },
23457         { 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]]]] } },
23458         { 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]]]] } },
23459         { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
23460         { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
23461         { 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]]]] } },
23462         { 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]]]] } },
23463         { 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]]]] } },
23464         { 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]]]] } },
23465         { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
23466         { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
23467         { 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]]]] } },
23468         { 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]]]] } },
23469         { 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]]]] } },
23470         { 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], [118.99941, 4.76678], [119.52945, 5.35672], [118.33378, 5.99991], [117.96674, 6.28383], [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]]]] } },
23471         { 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]]]] } },
23472         { 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]]]] } },
23473         { 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]]]] } },
23474         { 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]]]] } },
23475         { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
23476         { 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]]]] } },
23477         { 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]]]] } },
23478         { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
23479         { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
23480         { 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]]]] } },
23481         { 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.96312, 34.63236], [32.95516, 34.63541], [32.95323, 34.64075], [32.95471, 34.64528], [32.95277, 34.65104], [32.96154, 34.65587], [32.9639, 34.65866], [32.969, 34.6549], [32.98046, 34.65336], [32.99014, 34.65518], [32.98668, 34.67268], [32.98967, 34.67981], [32.95567, 34.6839], [32.94127, 34.67426], [32.93989, 34.67034], [32.93756, 34.67072], [32.93535, 34.66317], [32.92824, 34.66821], [32.93043, 34.67091], [32.91398, 34.67343], [32.9068, 34.66102], [32.86167, 34.68734], [32.86014, 34.70585]]]] } },
23482         { 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.90146, 34.96458], [33.86018, 34.97381], [33.84741, 34.97167], [33.84028, 34.97179], [33.83459, 34.97448], [33.84616, 34.98511], [33.85488, 34.98462], [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.87438, 35.08118], [33.89322, 35.06789], [33.90247, 35.07686], [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]]]] } },
23483         { 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]]]] } },
23484         { 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]]]] } },
23485         { 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]]]] } },
23486         { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
23487         { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
23488         { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
23489         { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
23490         { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
23491         { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
23492         { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
23493         { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
23494         { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
23495         { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
23496         { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
23497         { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
23498         { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
23499         { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
23500         { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
23501         { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
23502         { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
23503         { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
23504         { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
23505         { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
23506         { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
23507         { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
23508         { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
23509         { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
23510         { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
23511         { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
23512         { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
23513         { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
23514         { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
23515         { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
23516         { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
23517         { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
23518         { 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]]]] } },
23519         { 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]]]] } },
23520         { 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]]]] } },
23521         { 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]]]] } },
23522         { 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]]]] } },
23523         { 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]]]] } },
23524         { 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]]]] } },
23525         { 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]]]] } },
23526         { 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]]]] } },
23527         { 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]]]] } },
23528         { 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]]]] } },
23529         { 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]]]] } },
23530         { 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.82208, 48.6151], [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.40656, 48.3719], [13.31419, 48.31643], [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.77435, 47.66102], [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.44018, 47.6952], [12.40137, 47.69215], [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.45444, 47.5558], [10.48202, 47.58434], [10.43892, 47.58408], [10.42973, 47.57752], [10.45145, 47.55472], [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.97837, 47.51314], [9.97173, 47.51551], [9.96229, 47.53612], [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.77612, 47.59359], [9.75798, 47.57982], [9.73528, 47.54527], [9.73683, 47.53564], [9.72564, 47.53282], [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.42715, 46.97495], [10.42211, 46.96019], [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]]]] } },
23531         { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
23532         { 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]]]] } },
23533         { 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]]]] } },
23534         { 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]]]] } },
23535         { 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]]]] } },
23536         { 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]]]] } },
23537         { 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]]]] } },
23538         { 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]]]] } },
23539         { 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]]]] } },
23540         { 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]]]] } },
23541         { 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]]]] } },
23542         { 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]]]] } },
23543         { 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]]]] } },
23544         { 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]]]] } },
23545         { 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]]]] } },
23546         { 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]]]] } },
23547         { 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.40519, -12.45065], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.28979, -10.21932], [-65.32696, -10.06449], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-66.61289, -9.93233], [-67.12883, -10.31634], [-67.18847, -10.33951], [-67.1917, -10.32944], [-67.21325, -10.3208], [-67.67724, -10.60263], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-68.75452, -11.00821], [-68.76092, -11.01726], [-68.7638, -11.01693], [-68.76291, -11.00728], [-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.70971, -19.03489], [-57.70818, -19.02772], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71901, -18.89907], [-57.76603, -18.89904], [-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.32208, -16.26597], [-58.39179, -16.27715], [-58.43081, -16.32233], [-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]]]] } },
23548         { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
23549         { 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.18183, 1.72948], [-69.39079, 1.72934], [-69.55722, 1.77158], [-69.84289, 1.69122], [-69.84259, 1.07881], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-69.82577, 0.59225], [-70.04708, 0.56194], [-70.04294, -0.19043], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.93323, -4.21971], [-69.93571, -4.2195], [-69.94924, -4.23116], [-69.95836, -4.32881], [-69.99218, -4.32041], [-70.03272, -4.35441], [-70.02689, -4.37095], [-70.04593, -4.37554], [-70.0533, -4.2907], [-70.14422, -4.2714], [-70.19582, -4.3607], [-70.30567, -4.24361], [-70.27991, -4.23226], [-70.33236, -4.15214], [-70.73715, -4.17416], [-70.74728, -4.16112], [-70.78125, -4.16295], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-72.87086, -5.26346], [-73.24116, -6.07187], [-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.49706, -9.425], [-70.59272, -9.62142], [-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.76291, -11.00728], [-68.7638, -11.01693], [-68.76092, -11.01726], [-68.75452, -11.00821], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.67724, -10.60263], [-67.21325, -10.3208], [-67.1917, -10.32944], [-67.18847, -10.33951], [-67.12883, -10.31634], [-66.61289, -9.93233], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.32696, -10.06449], [-65.28979, -10.21932], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.40519, -12.45065], [-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.43081, -16.32233], [-58.39179, -16.27715], [-58.32208, -16.26597], [-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.76603, -18.89904], [-57.71901, -18.89907], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.70818, -19.02772], [-57.70971, -19.03489], [-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.74691, -22.46966], [-55.75257, -22.47633], [-55.75128, -22.48165], [-55.74718, -22.48376], [-55.74715, -22.50567], [-55.74069, -22.51564], [-55.74032, -22.51928], [-55.73792, -22.52632], [-55.72399, -22.55131], [-55.71193, -22.55809], [-55.69863, -22.56307], [-55.69103, -22.57959], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.53614, -23.24524], [-55.5222, -23.26048], [-55.55496, -23.28366], [-55.47567, -23.67566], [-55.4471, -23.7602], [-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.34579, -24.13058], [-54.31115, -24.26625], [-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.50823, -30.9145], [-54.45458, -31.65285], [-54.15721, -31.87458], [-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.80525, 3.35466], [-59.8041, 3.37027], [-59.81107, 3.38023], [-59.81484, 3.41955], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
23550         { 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]]]] } },
23551         { 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]]]] } },
23552         { 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]]]] } },
23553         { 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]]]] } },
23554         { 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]]]] } },
23555         { 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]]]] } },
23556         { 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.76308, 45.00624], [-74.76044, 44.99491], [-74.73876, 44.98856], [-74.7163, 45.00017], [-74.47782, 44.99747], [-74.32699, 44.99029], [-73.35025, 45.00942], [-72.71867, 45.01551], [-72.17312, 45.00587], [-72.09934, 45.00571], [-71.75113, 45.0114], [-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]]]] } },
23557         { 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]]]] } },
23558         { 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]]]] } },
23559         { 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]]]] } },
23560         { 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]]]] } },
23561         { 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.60469, 47.67239], [8.60695, 47.66622], [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.57449, 47.61148], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.35512, 47.57014], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.2973, 47.60647], [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.06689, 47.56398], [8.06017, 47.56351], [8.04692, 47.55561], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95494, 47.55764], [7.94828, 47.54408], [7.91554, 47.54765], [7.90773, 47.55738], [7.91159, 47.57185], [7.88664, 47.58854], [7.84412, 47.5841], [7.82174, 47.58757], [7.79716, 47.5575], [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.63432, 47.56171], [7.63604, 47.56387], [7.64859, 47.55996], [7.68229, 47.56754], [7.68904, 47.57133], [7.672, 47.58527], [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.50813, 47.51601], [7.50898, 47.49819], [7.49025, 47.48355], [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.41906, 47.44626], [7.40308, 47.43638], [7.38216, 47.433], [7.38122, 47.43208], [7.37349, 47.43399], [7.3527, 47.43426], [7.34123, 47.43873], [7.33818, 47.44256], [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.05198, 47.35634], [7.05302, 47.33131], [7.01, 47.32451], [7.00827, 47.3014], [6.94316, 47.28747], [6.95108, 47.26428], [6.95087, 47.24121], [6.86359, 47.18015], [6.85069, 47.15744], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.69579, 47.0371], [6.68456, 47.03714], [6.65915, 47.02734], [6.64008, 47.00251], [6.61239, 46.99083], [6.50315, 46.96736], [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.42211, 46.96019], [10.42715, 46.97495], [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.85148, 47.69769], [8.87474, 47.69425], [8.86881, 47.70524], [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.67538, 47.68629], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.68571, 47.70954], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] } },
23562         { 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]]]] } },
23563         { 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]]]] } },
23564         { 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]]]] } },
23565         { 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]]]] } },
23566         { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
23567         { 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], [-70.28573, -3.82549], [-69.96843, -4.19678], [-69.94924, -4.23116], [-69.93571, -4.2195], [-69.93323, -4.21971], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.04294, -0.19043], [-70.04708, 0.56194], [-69.82577, 0.59225], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.84259, 1.07881], [-69.84289, 1.69122], [-69.55722, 1.77158], [-69.39079, 1.72934], [-68.18183, 1.72948], [-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]]]] } },
23568         { 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]]]] } },
23569         { type: "Feature", properties: { iso1A2: "CQ", iso1A3: "CRQ", iso1N3: "680", m49: "680", wikidata: "Q3405693", ccTLD: null, nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", isoStatus: "excRes", 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]]]] } },
23570         { 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]]]] } },
23571         { 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]]]] } },
23572         { 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]]]] } },
23573         { 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]]]] } },
23574         { 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]]]] } },
23575         { 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.60361, 35.16647], [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.92824, 34.66821], [32.93535, 34.66317], [32.93756, 34.67072], [32.93989, 34.67034], [32.94127, 34.67426], [32.95567, 34.6839], [32.98967, 34.67981], [32.98668, 34.67268], [32.99014, 34.65518], [32.98046, 34.65336], [32.969, 34.6549], [32.9639, 34.65866], [32.96154, 34.65587], [32.95277, 34.65104], [32.95471, 34.64528], [32.95323, 34.64075], [32.95516, 34.63541], [32.96312, 34.63236], [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]]], [[[33.7343, 35.01178], [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.77553, 34.99518], [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.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.85488, 34.98462], [33.84616, 34.98511], [33.83459, 34.97448], [33.84028, 34.97179], [33.84741, 34.97167], [33.86018, 34.97381], [33.90146, 34.96458], [33.98684, 34.76642], [35.48515, 34.70851], [35.51152, 36.10954], [34.23164, 35.1777], [33.99999, 35.07016], [33.94869, 35.07277], [33.92495, 35.06789], [33.90247, 35.07686], [33.89322, 35.06789], [33.87438, 35.08118], [33.85261, 35.0574], [33.8355, 35.05777], [33.82051, 35.0667]]]] } },
23576         { 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]]]] } },
23577         { 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.68571, 47.70954], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.67538, 47.68629], [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.86881, 47.70524], [8.87474, 47.69425], [8.85148, 47.69769], [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.72564, 47.53282], [9.73683, 47.53564], [9.73528, 47.54527], [9.75798, 47.57982], [9.77612, 47.59359], [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.96229, 47.53612], [9.97173, 47.51551], [9.97837, 47.51314], [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.45145, 47.55472], [10.42973, 47.57752], [10.43892, 47.58408], [10.48202, 47.58434], [10.45444, 47.5558], [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.40137, 47.69215], [12.44018, 47.6952], [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.77435, 47.66102], [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.31419, 48.31643], [13.40656, 48.3719], [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.82208, 48.6151], [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.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.55975, 47.83953], [7.52764, 47.78161], [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.672, 47.58527], [7.68904, 47.57133], [7.68229, 47.56754], [7.64859, 47.55996], [7.63604, 47.56387], [7.63432, 47.56171], [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.79716, 47.5575], [7.82174, 47.58757], [7.84412, 47.5841], [7.88664, 47.58854], [7.91159, 47.57185], [7.90773, 47.55738], [7.91554, 47.54765], [7.94828, 47.54408], [7.95494, 47.55764], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04692, 47.55561], [8.06017, 47.56351], [8.06689, 47.56398], [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.2973, 47.60647], [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.57449, 47.61148], [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.60695, 47.66622], [8.60469, 47.67239], [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]]]] } },
23578         { 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]]]] } },
23579         { 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]]]] } },
23580         { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
23581         { 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]]]] } },
23582         { 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]]]] } },
23583         { 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]]]] } },
23584         { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
23585         { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
23586         { 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]]]] } },
23587         { 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]]]] } },
23588         { 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]]]] } },
23589         { 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]]]] } },
23590         { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
23591         { 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]]]] } },
23592         { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
23593         { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
23594         { 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]]]] } },
23595         { 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]]]] } },
23596         { 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]]]] } },
23597         { 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]]]] } },
23598         { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
23599         { 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.50315, 46.96736], [6.61239, 46.99083], [6.64008, 47.00251], [6.65915, 47.02734], [6.68456, 47.03714], [6.69579, 47.0371], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.85069, 47.15744], [6.86359, 47.18015], [6.95087, 47.24121], [6.95108, 47.26428], [6.94316, 47.28747], [7.00827, 47.3014], [7.01, 47.32451], [7.05302, 47.33131], [7.05198, 47.35634], [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.33818, 47.44256], [7.34123, 47.43873], [7.3527, 47.43426], [7.37349, 47.43399], [7.38122, 47.43208], [7.38216, 47.433], [7.40308, 47.43638], [7.41906, 47.44626], [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.49025, 47.48355], [7.50898, 47.49819], [7.50813, 47.51601], [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.52764, 47.78161], [7.55975, 47.83953], [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.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]]]] } },
23600         { 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]]]] } },
23601         { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
23602         { 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]]]] } },
23603         { 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]]]] } },
23604         { 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]]]] } },
23605         { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
23606         { 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]]]] } },
23607         { 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]]]] } },
23608         { 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]]]] } },
23609         { 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]]]] } },
23610         { 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]]]] } },
23611         { 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]]]] } },
23612         { 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]]]] } },
23613         { 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]]]] } },
23614         { 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]]]] } },
23615         { 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]]]] } },
23616         { 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]]]] } },
23617         { 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]]]] } },
23618         { 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.81484, 3.41955], [-59.81107, 3.38023], [-59.8041, 3.37027], [-59.80525, 3.35466], [-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]]]] } },
23619         { 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]]]] } },
23620         { 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]]]] } },
23621         { 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]]]] } },
23622         { 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]]]] } },
23623         { 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]]]] } },
23624         { 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.72154, 47.78683], [18.65644, 47.7568], [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]]]] } },
23625         { 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]]]] } },
23626         { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
23627         { 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], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] } },
23628         { 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]]]] } },
23629         { 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]]]] } },
23630         { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
23631         { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
23632         { 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]]]] } },
23633         { 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]]]] } },
23634         { 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]]]] } },
23635         { 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.40899, 46.21509], [13.41193, 46.22767], [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]]]] } },
23636         { 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]]]] } },
23637         { 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]]]] } },
23638         { 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]]]] } },
23639         { 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]]]] } },
23640         { 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]]]] } },
23641         { 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]]]] } },
23642         { 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]]]] } },
23643         { 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]]]] } },
23644         { 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]]]] } },
23645         { 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]]]] } },
23646         { 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]]]] } },
23647         { 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]]]] } },
23648         { 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]]]] } },
23649         { 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]]]] } },
23650         { 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]]]] } },
23651         { 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]]]] } },
23652         { 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]]]] } },
23653         { 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]]]] } },
23654         { 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]]]] } },
23655         { 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]]]] } },
23656         { 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]]]] } },
23657         { 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]]]] } },
23658         { 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]]]] } },
23659         { 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]]]] } },
23660         { 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]]]] } },
23661         { 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]]]] } },
23662         { 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]]]] } },
23663         { 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]]]] } },
23664         { 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]]]] } },
23665         { 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]]]] } },
23666         { 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]]]] } },
23667         { 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]]]] } },
23668         { 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]]]] } },
23669         { 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]]]] } },
23670         { 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]]]] } },
23671         { 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]]]] } },
23672         { 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]]]] } },
23673         { 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]]]] } },
23674         { 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]]]] } },
23675         { 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]]]] } },
23676         { 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]]]] } },
23677         { 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]]]] } },
23678         { 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]]]] } },
23679         { 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]]]] } },
23680         { 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]]]] } },
23681         { 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]]]] } },
23682         { 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]]]] } },
23683         { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
23684         { 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]]]] } },
23685         { 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]]]] } },
23686         { 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]]]] } },
23687         { 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]]]] } },
23688         { 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]]]] } },
23689         { 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]]]] } },
23690         { 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]]]] } },
23691         { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
23692         { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
23693         { 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]]]] } },
23694         { 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]]]] } },
23695         { 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]]]] } },
23696         { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
23697         { 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]]]] } },
23698         { 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]]]] } },
23699         { 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.59272, -9.62142], [-70.49706, -9.425], [-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.24116, -6.07187], [-72.87086, -5.26346], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.78125, -4.16295], [-70.74728, -4.16112], [-70.73715, -4.17416], [-70.33236, -4.15214], [-70.27991, -4.23226], [-70.30567, -4.24361], [-70.19582, -4.3607], [-70.14422, -4.2714], [-70.0533, -4.2907], [-70.04593, -4.37554], [-70.02689, -4.37095], [-70.03272, -4.35441], [-69.99218, -4.32041], [-69.95836, -4.32881], [-69.94924, -4.23116], [-69.96843, -4.19678], [-70.28573, -3.82549], [-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]]]] } },
23700         { 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]]]] } },
23701         { 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]]]] } },
23702         { 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.96674, 6.28383], [118.33378, 5.99991], [119.52945, 5.35672], [118.99941, 4.76678], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
23703         { 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]]]] } },
23704         { 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]]]] } },
23705         { 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]]]] } },
23706         { 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]]]] } },
23707         { 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]]]] } },
23708         { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
23709         { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
23710         { 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]]]] } },
23711         { 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.31115, -24.26625], [-54.34579, -24.13058], [-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.4471, -23.7602], [-55.47567, -23.67566], [-55.55496, -23.28366], [-55.5222, -23.26048], [-55.53614, -23.24524], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.69103, -22.57959], [-55.69863, -22.56307], [-55.71193, -22.55809], [-55.72399, -22.55131], [-55.73792, -22.52632], [-55.74032, -22.51928], [-55.74069, -22.51564], [-55.74715, -22.50567], [-55.74718, -22.48376], [-55.75128, -22.48165], [-55.75257, -22.47633], [-55.74691, -22.46966], [-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]]]] } },
23712         { 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]]]] } },
23713         { 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]]]] } },
23714         { 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]]]] } },
23715         { 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]]]] } },
23716         { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
23717         { 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]]]] } },
23718         { 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]]]] } },
23719         { 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]]]] } },
23720         { 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]]]] } },
23721         { 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]]]] } },
23722         { 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]]]] } },
23723         { 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]]]] } },
23724         { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
23725         { 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.41193, 46.22767], [13.40899, 46.21509], [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]]]] } },
23726         { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
23727         { 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.65644, 47.7568], [18.72154, 47.78683], [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]]]] } },
23728         { 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]]]] } },
23729         { 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]]]] } },
23730         { 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]]]] } },
23731         { 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]]]] } },
23732         { 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]]]] } },
23733         { 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]]]] } },
23734         { 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]]]] } },
23735         { 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]]]] } },
23736         { 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]]]] } },
23737         { 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]]]] } },
23738         { 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]]]] } },
23739         { 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]]]] } },
23740         { 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]]]] } },
23741         { 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]]]] } },
23742         { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
23743         { 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]]]] } },
23744         { 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]]]] } },
23745         { 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]]]] } },
23746         { 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]]]] } },
23747         { 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]]]] } },
23748         { 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]]]] } },
23749         { 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]]]] } },
23750         { 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]]]] } },
23751         { 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]]]] } },
23752         { 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]]]] } },
23753         { 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]]]] } },
23754         { 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.5128, 26.536], [120.0693, 26.3959], [119.78816, 26.2348], [119.98511, 25.37624], [119.42295, 25.0886], [118.6333, 24.46259], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
23755         { 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]]]] } },
23756         { 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]]]] } },
23757         { 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]]]] } },
23758         { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23759         { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23760         { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23761         { 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.15721, -31.87458], [-54.45458, -31.65285], [-55.50823, -30.9145], [-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]]]] } },
23762         { 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]]]] } },
23763         { 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]]]] } },
23764         { 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]]]] } },
23765         { 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]]]] } },
23766         { 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]]]] } },
23767         { 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]]]] } },
23768         { 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]]]] } },
23769         { 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]]]] } },
23770         { 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]]]] } },
23771         { 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]]]] } },
23772         { 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]]]] } },
23773         { 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]]]] } },
23774         { 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]]]] } },
23775         { 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]]]] } },
23776         { 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]]]] } },
23777         { 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]]]] } }
23778       ] };
23779       borders = borders_default;
23780       _whichPolygon = {};
23781       _featuresByCode = {};
23782       idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23783       levels = [
23784         "subterritory",
23785         "territory",
23786         "subcountryGroup",
23787         "country",
23788         "sharedLandform",
23789         "intermediateRegion",
23790         "subregion",
23791         "region",
23792         "subunion",
23793         "union",
23794         "unitedNations",
23795         "world"
23796       ];
23797       loadDerivedDataAndCaches(borders);
23798       defaultOpts = {
23799         level: void 0,
23800         maxLevel: void 0,
23801         withProp: void 0
23802       };
23803     }
23804   });
23805
23806   // node_modules/bignumber.js/bignumber.mjs
23807   function clone(configObject) {
23808     var div, convertBase, parseNumeric2, P3 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
23809       prefix: "",
23810       groupSize: 3,
23811       secondaryGroupSize: 0,
23812       groupSeparator: ",",
23813       decimalSeparator: ".",
23814       fractionGroupSize: 0,
23815       fractionGroupSeparator: "\xA0",
23816       // non-breaking space
23817       suffix: ""
23818     }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
23819     function BigNumber2(v3, b3) {
23820       var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
23821       if (!(x2 instanceof BigNumber2)) return new BigNumber2(v3, b3);
23822       if (b3 == null) {
23823         if (v3 && v3._isBigNumber === true) {
23824           x2.s = v3.s;
23825           if (!v3.c || v3.e > MAX_EXP) {
23826             x2.c = x2.e = null;
23827           } else if (v3.e < MIN_EXP) {
23828             x2.c = [x2.e = 0];
23829           } else {
23830             x2.e = v3.e;
23831             x2.c = v3.c.slice();
23832           }
23833           return;
23834         }
23835         if ((isNum = typeof v3 == "number") && v3 * 0 == 0) {
23836           x2.s = 1 / v3 < 0 ? (v3 = -v3, -1) : 1;
23837           if (v3 === ~~v3) {
23838             for (e3 = 0, i3 = v3; i3 >= 10; i3 /= 10, e3++) ;
23839             if (e3 > MAX_EXP) {
23840               x2.c = x2.e = null;
23841             } else {
23842               x2.e = e3;
23843               x2.c = [v3];
23844             }
23845             return;
23846           }
23847           str = String(v3);
23848         } else {
23849           if (!isNumeric.test(str = String(v3))) return parseNumeric2(x2, str, isNum);
23850           x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
23851         }
23852         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
23853         if ((i3 = str.search(/e/i)) > 0) {
23854           if (e3 < 0) e3 = i3;
23855           e3 += +str.slice(i3 + 1);
23856           str = str.substring(0, i3);
23857         } else if (e3 < 0) {
23858           e3 = str.length;
23859         }
23860       } else {
23861         intCheck(b3, 2, ALPHABET.length, "Base");
23862         if (b3 == 10 && alphabetHasNormalDecimalDigits) {
23863           x2 = new BigNumber2(v3);
23864           return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
23865         }
23866         str = String(v3);
23867         if (isNum = typeof v3 == "number") {
23868           if (v3 * 0 != 0) return parseNumeric2(x2, str, isNum, b3);
23869           x2.s = 1 / v3 < 0 ? (str = str.slice(1), -1) : 1;
23870           if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
23871             throw Error(tooManyDigits + v3);
23872           }
23873         } else {
23874           x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
23875         }
23876         alphabet = ALPHABET.slice(0, b3);
23877         e3 = i3 = 0;
23878         for (len = str.length; i3 < len; i3++) {
23879           if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
23880             if (c2 == ".") {
23881               if (i3 > e3) {
23882                 e3 = len;
23883                 continue;
23884               }
23885             } else if (!caseChanged) {
23886               if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
23887                 caseChanged = true;
23888                 i3 = -1;
23889                 e3 = 0;
23890                 continue;
23891               }
23892             }
23893             return parseNumeric2(x2, String(v3), isNum, b3);
23894           }
23895         }
23896         isNum = false;
23897         str = convertBase(str, b3, 10, x2.s);
23898         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
23899         else e3 = str.length;
23900       }
23901       for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
23902       for (len = str.length; str.charCodeAt(--len) === 48; ) ;
23903       if (str = str.slice(i3, ++len)) {
23904         len -= i3;
23905         if (isNum && BigNumber2.DEBUG && len > 15 && (v3 > MAX_SAFE_INTEGER3 || v3 !== mathfloor(v3))) {
23906           throw Error(tooManyDigits + x2.s * v3);
23907         }
23908         if ((e3 = e3 - i3 - 1) > MAX_EXP) {
23909           x2.c = x2.e = null;
23910         } else if (e3 < MIN_EXP) {
23911           x2.c = [x2.e = 0];
23912         } else {
23913           x2.e = e3;
23914           x2.c = [];
23915           i3 = (e3 + 1) % LOG_BASE;
23916           if (e3 < 0) i3 += LOG_BASE;
23917           if (i3 < len) {
23918             if (i3) x2.c.push(+str.slice(0, i3));
23919             for (len -= LOG_BASE; i3 < len; ) {
23920               x2.c.push(+str.slice(i3, i3 += LOG_BASE));
23921             }
23922             i3 = LOG_BASE - (str = str.slice(i3)).length;
23923           } else {
23924             i3 -= len;
23925           }
23926           for (; i3--; str += "0") ;
23927           x2.c.push(+str);
23928         }
23929       } else {
23930         x2.c = [x2.e = 0];
23931       }
23932     }
23933     BigNumber2.clone = clone;
23934     BigNumber2.ROUND_UP = 0;
23935     BigNumber2.ROUND_DOWN = 1;
23936     BigNumber2.ROUND_CEIL = 2;
23937     BigNumber2.ROUND_FLOOR = 3;
23938     BigNumber2.ROUND_HALF_UP = 4;
23939     BigNumber2.ROUND_HALF_DOWN = 5;
23940     BigNumber2.ROUND_HALF_EVEN = 6;
23941     BigNumber2.ROUND_HALF_CEIL = 7;
23942     BigNumber2.ROUND_HALF_FLOOR = 8;
23943     BigNumber2.EUCLID = 9;
23944     BigNumber2.config = BigNumber2.set = function(obj) {
23945       var p2, v3;
23946       if (obj != null) {
23947         if (typeof obj == "object") {
23948           if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
23949             v3 = obj[p2];
23950             intCheck(v3, 0, MAX, p2);
23951             DECIMAL_PLACES = v3;
23952           }
23953           if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
23954             v3 = obj[p2];
23955             intCheck(v3, 0, 8, p2);
23956             ROUNDING_MODE = v3;
23957           }
23958           if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
23959             v3 = obj[p2];
23960             if (v3 && v3.pop) {
23961               intCheck(v3[0], -MAX, 0, p2);
23962               intCheck(v3[1], 0, MAX, p2);
23963               TO_EXP_NEG = v3[0];
23964               TO_EXP_POS = v3[1];
23965             } else {
23966               intCheck(v3, -MAX, MAX, p2);
23967               TO_EXP_NEG = -(TO_EXP_POS = v3 < 0 ? -v3 : v3);
23968             }
23969           }
23970           if (obj.hasOwnProperty(p2 = "RANGE")) {
23971             v3 = obj[p2];
23972             if (v3 && v3.pop) {
23973               intCheck(v3[0], -MAX, -1, p2);
23974               intCheck(v3[1], 1, MAX, p2);
23975               MIN_EXP = v3[0];
23976               MAX_EXP = v3[1];
23977             } else {
23978               intCheck(v3, -MAX, MAX, p2);
23979               if (v3) {
23980                 MIN_EXP = -(MAX_EXP = v3 < 0 ? -v3 : v3);
23981               } else {
23982                 throw Error(bignumberError + p2 + " cannot be zero: " + v3);
23983               }
23984             }
23985           }
23986           if (obj.hasOwnProperty(p2 = "CRYPTO")) {
23987             v3 = obj[p2];
23988             if (v3 === !!v3) {
23989               if (v3) {
23990                 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
23991                   CRYPTO = v3;
23992                 } else {
23993                   CRYPTO = !v3;
23994                   throw Error(bignumberError + "crypto unavailable");
23995                 }
23996               } else {
23997                 CRYPTO = v3;
23998               }
23999             } else {
24000               throw Error(bignumberError + p2 + " not true or false: " + v3);
24001             }
24002           }
24003           if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
24004             v3 = obj[p2];
24005             intCheck(v3, 0, 9, p2);
24006             MODULO_MODE = v3;
24007           }
24008           if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
24009             v3 = obj[p2];
24010             intCheck(v3, 0, MAX, p2);
24011             POW_PRECISION = v3;
24012           }
24013           if (obj.hasOwnProperty(p2 = "FORMAT")) {
24014             v3 = obj[p2];
24015             if (typeof v3 == "object") FORMAT = v3;
24016             else throw Error(bignumberError + p2 + " not an object: " + v3);
24017           }
24018           if (obj.hasOwnProperty(p2 = "ALPHABET")) {
24019             v3 = obj[p2];
24020             if (typeof v3 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v3)) {
24021               alphabetHasNormalDecimalDigits = v3.slice(0, 10) == "0123456789";
24022               ALPHABET = v3;
24023             } else {
24024               throw Error(bignumberError + p2 + " invalid: " + v3);
24025             }
24026           }
24027         } else {
24028           throw Error(bignumberError + "Object expected: " + obj);
24029         }
24030       }
24031       return {
24032         DECIMAL_PLACES,
24033         ROUNDING_MODE,
24034         EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
24035         RANGE: [MIN_EXP, MAX_EXP],
24036         CRYPTO,
24037         MODULO_MODE,
24038         POW_PRECISION,
24039         FORMAT,
24040         ALPHABET
24041       };
24042     };
24043     BigNumber2.isBigNumber = function(v3) {
24044       if (!v3 || v3._isBigNumber !== true) return false;
24045       if (!BigNumber2.DEBUG) return true;
24046       var i3, n3, c2 = v3.c, e3 = v3.e, s2 = v3.s;
24047       out: if ({}.toString.call(c2) == "[object Array]") {
24048         if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
24049           if (c2[0] === 0) {
24050             if (e3 === 0 && c2.length === 1) return true;
24051             break out;
24052           }
24053           i3 = (e3 + 1) % LOG_BASE;
24054           if (i3 < 1) i3 += LOG_BASE;
24055           if (String(c2[0]).length == i3) {
24056             for (i3 = 0; i3 < c2.length; i3++) {
24057               n3 = c2[i3];
24058               if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
24059             }
24060             if (n3 !== 0) return true;
24061           }
24062         }
24063       } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
24064         return true;
24065       }
24066       throw Error(bignumberError + "Invalid BigNumber: " + v3);
24067     };
24068     BigNumber2.maximum = BigNumber2.max = function() {
24069       return maxOrMin(arguments, -1);
24070     };
24071     BigNumber2.minimum = BigNumber2.min = function() {
24072       return maxOrMin(arguments, 1);
24073     };
24074     BigNumber2.random = function() {
24075       var pow2_53 = 9007199254740992;
24076       var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
24077         return mathfloor(Math.random() * pow2_53);
24078       } : function() {
24079         return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
24080       };
24081       return function(dp) {
24082         var a4, b3, e3, k3, v3, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
24083         if (dp == null) dp = DECIMAL_PLACES;
24084         else intCheck(dp, 0, MAX);
24085         k3 = mathceil(dp / LOG_BASE);
24086         if (CRYPTO) {
24087           if (crypto.getRandomValues) {
24088             a4 = crypto.getRandomValues(new Uint32Array(k3 *= 2));
24089             for (; i3 < k3; ) {
24090               v3 = a4[i3] * 131072 + (a4[i3 + 1] >>> 11);
24091               if (v3 >= 9e15) {
24092                 b3 = crypto.getRandomValues(new Uint32Array(2));
24093                 a4[i3] = b3[0];
24094                 a4[i3 + 1] = b3[1];
24095               } else {
24096                 c2.push(v3 % 1e14);
24097                 i3 += 2;
24098               }
24099             }
24100             i3 = k3 / 2;
24101           } else if (crypto.randomBytes) {
24102             a4 = crypto.randomBytes(k3 *= 7);
24103             for (; i3 < k3; ) {
24104               v3 = (a4[i3] & 31) * 281474976710656 + a4[i3 + 1] * 1099511627776 + a4[i3 + 2] * 4294967296 + a4[i3 + 3] * 16777216 + (a4[i3 + 4] << 16) + (a4[i3 + 5] << 8) + a4[i3 + 6];
24105               if (v3 >= 9e15) {
24106                 crypto.randomBytes(7).copy(a4, i3);
24107               } else {
24108                 c2.push(v3 % 1e14);
24109                 i3 += 7;
24110               }
24111             }
24112             i3 = k3 / 7;
24113           } else {
24114             CRYPTO = false;
24115             throw Error(bignumberError + "crypto unavailable");
24116           }
24117         }
24118         if (!CRYPTO) {
24119           for (; i3 < k3; ) {
24120             v3 = random53bitInt();
24121             if (v3 < 9e15) c2[i3++] = v3 % 1e14;
24122           }
24123         }
24124         k3 = c2[--i3];
24125         dp %= LOG_BASE;
24126         if (k3 && dp) {
24127           v3 = POWS_TEN[LOG_BASE - dp];
24128           c2[i3] = mathfloor(k3 / v3) * v3;
24129         }
24130         for (; c2[i3] === 0; c2.pop(), i3--) ;
24131         if (i3 < 0) {
24132           c2 = [e3 = 0];
24133         } else {
24134           for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
24135           for (i3 = 1, v3 = c2[0]; v3 >= 10; v3 /= 10, i3++) ;
24136           if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
24137         }
24138         rand.e = e3;
24139         rand.c = c2;
24140         return rand;
24141       };
24142     }();
24143     BigNumber2.sum = function() {
24144       var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
24145       for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
24146       return sum;
24147     };
24148     convertBase = /* @__PURE__ */ function() {
24149       var decimal = "0123456789";
24150       function toBaseOut(str, baseIn, baseOut, alphabet) {
24151         var j3, arr = [0], arrL, i3 = 0, len = str.length;
24152         for (; i3 < len; ) {
24153           for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
24154           arr[0] += alphabet.indexOf(str.charAt(i3++));
24155           for (j3 = 0; j3 < arr.length; j3++) {
24156             if (arr[j3] > baseOut - 1) {
24157               if (arr[j3 + 1] == null) arr[j3 + 1] = 0;
24158               arr[j3 + 1] += arr[j3] / baseOut | 0;
24159               arr[j3] %= baseOut;
24160             }
24161           }
24162         }
24163         return arr.reverse();
24164       }
24165       return function(str, baseIn, baseOut, sign2, callerIsToString) {
24166         var alphabet, d2, e3, k3, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
24167         if (i3 >= 0) {
24168           k3 = POW_PRECISION;
24169           POW_PRECISION = 0;
24170           str = str.replace(".", "");
24171           y2 = new BigNumber2(baseIn);
24172           x2 = y2.pow(str.length - i3);
24173           POW_PRECISION = k3;
24174           y2.c = toBaseOut(
24175             toFixedPoint(coeffToString(x2.c), x2.e, "0"),
24176             10,
24177             baseOut,
24178             decimal
24179           );
24180           y2.e = y2.c.length;
24181         }
24182         xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
24183         e3 = k3 = xc.length;
24184         for (; xc[--k3] == 0; xc.pop()) ;
24185         if (!xc[0]) return alphabet.charAt(0);
24186         if (i3 < 0) {
24187           --e3;
24188         } else {
24189           x2.c = xc;
24190           x2.e = e3;
24191           x2.s = sign2;
24192           x2 = div(x2, y2, dp, rm, baseOut);
24193           xc = x2.c;
24194           r2 = x2.r;
24195           e3 = x2.e;
24196         }
24197         d2 = e3 + dp + 1;
24198         i3 = xc[d2];
24199         k3 = baseOut / 2;
24200         r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
24201         r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k3 || i3 == k3 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
24202         if (d2 < 1 || !xc[0]) {
24203           str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
24204         } else {
24205           xc.length = d2;
24206           if (r2) {
24207             for (--baseOut; ++xc[--d2] > baseOut; ) {
24208               xc[d2] = 0;
24209               if (!d2) {
24210                 ++e3;
24211                 xc = [1].concat(xc);
24212               }
24213             }
24214           }
24215           for (k3 = xc.length; !xc[--k3]; ) ;
24216           for (i3 = 0, str = ""; i3 <= k3; str += alphabet.charAt(xc[i3++])) ;
24217           str = toFixedPoint(str, e3, alphabet.charAt(0));
24218         }
24219         return str;
24220       };
24221     }();
24222     div = /* @__PURE__ */ function() {
24223       function multiply(x2, k3, base) {
24224         var m3, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k3 % SQRT_BASE, khi = k3 / SQRT_BASE | 0;
24225         for (x2 = x2.slice(); i3--; ) {
24226           xlo = x2[i3] % SQRT_BASE;
24227           xhi = x2[i3] / SQRT_BASE | 0;
24228           m3 = khi * xlo + xhi * klo;
24229           temp = klo * xlo + m3 % SQRT_BASE * SQRT_BASE + carry;
24230           carry = (temp / base | 0) + (m3 / SQRT_BASE | 0) + khi * xhi;
24231           x2[i3] = temp % base;
24232         }
24233         if (carry) x2 = [carry].concat(x2);
24234         return x2;
24235       }
24236       function compare2(a4, b3, aL, bL) {
24237         var i3, cmp;
24238         if (aL != bL) {
24239           cmp = aL > bL ? 1 : -1;
24240         } else {
24241           for (i3 = cmp = 0; i3 < aL; i3++) {
24242             if (a4[i3] != b3[i3]) {
24243               cmp = a4[i3] > b3[i3] ? 1 : -1;
24244               break;
24245             }
24246           }
24247         }
24248         return cmp;
24249       }
24250       function subtract(a4, b3, aL, base) {
24251         var i3 = 0;
24252         for (; aL--; ) {
24253           a4[aL] -= i3;
24254           i3 = a4[aL] < b3[aL] ? 1 : 0;
24255           a4[aL] = i3 * base + a4[aL] - b3[aL];
24256         }
24257         for (; !a4[0] && a4.length > 1; a4.splice(0, 1)) ;
24258       }
24259       return function(x2, y2, dp, rm, base) {
24260         var cmp, e3, i3, more, n3, prod, prodL, q3, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
24261         if (!xc || !xc[0] || !yc || !yc[0]) {
24262           return new BigNumber2(
24263             // Return NaN if either NaN, or both Infinity or 0.
24264             !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
24265               // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
24266               xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
24267             )
24268           );
24269         }
24270         q3 = new BigNumber2(s2);
24271         qc = q3.c = [];
24272         e3 = x2.e - y2.e;
24273         s2 = dp + e3 + 1;
24274         if (!base) {
24275           base = BASE;
24276           e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
24277           s2 = s2 / LOG_BASE | 0;
24278         }
24279         for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
24280         if (yc[i3] > (xc[i3] || 0)) e3--;
24281         if (s2 < 0) {
24282           qc.push(1);
24283           more = true;
24284         } else {
24285           xL = xc.length;
24286           yL = yc.length;
24287           i3 = 0;
24288           s2 += 2;
24289           n3 = mathfloor(base / (yc[0] + 1));
24290           if (n3 > 1) {
24291             yc = multiply(yc, n3, base);
24292             xc = multiply(xc, n3, base);
24293             yL = yc.length;
24294             xL = xc.length;
24295           }
24296           xi = yL;
24297           rem = xc.slice(0, yL);
24298           remL = rem.length;
24299           for (; remL < yL; rem[remL++] = 0) ;
24300           yz = yc.slice();
24301           yz = [0].concat(yz);
24302           yc0 = yc[0];
24303           if (yc[1] >= base / 2) yc0++;
24304           do {
24305             n3 = 0;
24306             cmp = compare2(yc, rem, yL, remL);
24307             if (cmp < 0) {
24308               rem0 = rem[0];
24309               if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
24310               n3 = mathfloor(rem0 / yc0);
24311               if (n3 > 1) {
24312                 if (n3 >= base) n3 = base - 1;
24313                 prod = multiply(yc, n3, base);
24314                 prodL = prod.length;
24315                 remL = rem.length;
24316                 while (compare2(prod, rem, prodL, remL) == 1) {
24317                   n3--;
24318                   subtract(prod, yL < prodL ? yz : yc, prodL, base);
24319                   prodL = prod.length;
24320                   cmp = 1;
24321                 }
24322               } else {
24323                 if (n3 == 0) {
24324                   cmp = n3 = 1;
24325                 }
24326                 prod = yc.slice();
24327                 prodL = prod.length;
24328               }
24329               if (prodL < remL) prod = [0].concat(prod);
24330               subtract(rem, prod, remL, base);
24331               remL = rem.length;
24332               if (cmp == -1) {
24333                 while (compare2(yc, rem, yL, remL) < 1) {
24334                   n3++;
24335                   subtract(rem, yL < remL ? yz : yc, remL, base);
24336                   remL = rem.length;
24337                 }
24338               }
24339             } else if (cmp === 0) {
24340               n3++;
24341               rem = [0];
24342             }
24343             qc[i3++] = n3;
24344             if (rem[0]) {
24345               rem[remL++] = xc[xi] || 0;
24346             } else {
24347               rem = [xc[xi]];
24348               remL = 1;
24349             }
24350           } while ((xi++ < xL || rem[0] != null) && s2--);
24351           more = rem[0] != null;
24352           if (!qc[0]) qc.splice(0, 1);
24353         }
24354         if (base == BASE) {
24355           for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
24356           round(q3, dp + (q3.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
24357         } else {
24358           q3.e = e3;
24359           q3.r = +more;
24360         }
24361         return q3;
24362       };
24363     }();
24364     function format2(n3, i3, rm, id2) {
24365       var c0, e3, ne2, len, str;
24366       if (rm == null) rm = ROUNDING_MODE;
24367       else intCheck(rm, 0, 8);
24368       if (!n3.c) return n3.toString();
24369       c0 = n3.c[0];
24370       ne2 = n3.e;
24371       if (i3 == null) {
24372         str = coeffToString(n3.c);
24373         str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
24374       } else {
24375         n3 = round(new BigNumber2(n3), i3, rm);
24376         e3 = n3.e;
24377         str = coeffToString(n3.c);
24378         len = str.length;
24379         if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
24380           for (; len < i3; str += "0", len++) ;
24381           str = toExponential(str, e3);
24382         } else {
24383           i3 -= ne2;
24384           str = toFixedPoint(str, e3, "0");
24385           if (e3 + 1 > len) {
24386             if (--i3 > 0) for (str += "."; i3--; str += "0") ;
24387           } else {
24388             i3 += e3 - len;
24389             if (i3 > 0) {
24390               if (e3 + 1 == len) str += ".";
24391               for (; i3--; str += "0") ;
24392             }
24393           }
24394         }
24395       }
24396       return n3.s < 0 && c0 ? "-" + str : str;
24397     }
24398     function maxOrMin(args, n3) {
24399       var k3, y2, i3 = 1, x2 = new BigNumber2(args[0]);
24400       for (; i3 < args.length; i3++) {
24401         y2 = new BigNumber2(args[i3]);
24402         if (!y2.s || (k3 = compare(x2, y2)) === n3 || k3 === 0 && x2.s === n3) {
24403           x2 = y2;
24404         }
24405       }
24406       return x2;
24407     }
24408     function normalise(n3, c2, e3) {
24409       var i3 = 1, j3 = c2.length;
24410       for (; !c2[--j3]; c2.pop()) ;
24411       for (j3 = c2[0]; j3 >= 10; j3 /= 10, i3++) ;
24412       if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
24413         n3.c = n3.e = null;
24414       } else if (e3 < MIN_EXP) {
24415         n3.c = [n3.e = 0];
24416       } else {
24417         n3.e = e3;
24418         n3.c = c2;
24419       }
24420       return n3;
24421     }
24422     parseNumeric2 = /* @__PURE__ */ function() {
24423       var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
24424       return function(x2, str, isNum, b3) {
24425         var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
24426         if (isInfinityOrNaN.test(s2)) {
24427           x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
24428         } else {
24429           if (!isNum) {
24430             s2 = s2.replace(basePrefix, function(m3, p1, p2) {
24431               base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
24432               return !b3 || b3 == base ? p1 : m3;
24433             });
24434             if (b3) {
24435               base = b3;
24436               s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
24437             }
24438             if (str != s2) return new BigNumber2(s2, base);
24439           }
24440           if (BigNumber2.DEBUG) {
24441             throw Error(bignumberError + "Not a" + (b3 ? " base " + b3 : "") + " number: " + str);
24442           }
24443           x2.s = null;
24444         }
24445         x2.c = x2.e = null;
24446       };
24447     }();
24448     function round(x2, sd, rm, r2) {
24449       var d2, i3, j3, k3, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
24450       if (xc) {
24451         out: {
24452           for (d2 = 1, k3 = xc[0]; k3 >= 10; k3 /= 10, d2++) ;
24453           i3 = sd - d2;
24454           if (i3 < 0) {
24455             i3 += LOG_BASE;
24456             j3 = sd;
24457             n3 = xc[ni = 0];
24458             rd = mathfloor(n3 / pows10[d2 - j3 - 1] % 10);
24459           } else {
24460             ni = mathceil((i3 + 1) / LOG_BASE);
24461             if (ni >= xc.length) {
24462               if (r2) {
24463                 for (; xc.length <= ni; xc.push(0)) ;
24464                 n3 = rd = 0;
24465                 d2 = 1;
24466                 i3 %= LOG_BASE;
24467                 j3 = i3 - LOG_BASE + 1;
24468               } else {
24469                 break out;
24470               }
24471             } else {
24472               n3 = k3 = xc[ni];
24473               for (d2 = 1; k3 >= 10; k3 /= 10, d2++) ;
24474               i3 %= LOG_BASE;
24475               j3 = i3 - LOG_BASE + d2;
24476               rd = j3 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j3 - 1] % 10);
24477             }
24478           }
24479           r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
24480           // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
24481           // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
24482           xc[ni + 1] != null || (j3 < 0 ? n3 : n3 % pows10[d2 - j3 - 1]);
24483           r2 = rm < 4 ? (rd || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r2 || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
24484           (i3 > 0 ? j3 > 0 ? n3 / pows10[d2 - j3] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
24485           if (sd < 1 || !xc[0]) {
24486             xc.length = 0;
24487             if (r2) {
24488               sd -= x2.e + 1;
24489               xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
24490               x2.e = -sd || 0;
24491             } else {
24492               xc[0] = x2.e = 0;
24493             }
24494             return x2;
24495           }
24496           if (i3 == 0) {
24497             xc.length = ni;
24498             k3 = 1;
24499             ni--;
24500           } else {
24501             xc.length = ni + 1;
24502             k3 = pows10[LOG_BASE - i3];
24503             xc[ni] = j3 > 0 ? mathfloor(n3 / pows10[d2 - j3] % pows10[j3]) * k3 : 0;
24504           }
24505           if (r2) {
24506             for (; ; ) {
24507               if (ni == 0) {
24508                 for (i3 = 1, j3 = xc[0]; j3 >= 10; j3 /= 10, i3++) ;
24509                 j3 = xc[0] += k3;
24510                 for (k3 = 1; j3 >= 10; j3 /= 10, k3++) ;
24511                 if (i3 != k3) {
24512                   x2.e++;
24513                   if (xc[0] == BASE) xc[0] = 1;
24514                 }
24515                 break;
24516               } else {
24517                 xc[ni] += k3;
24518                 if (xc[ni] != BASE) break;
24519                 xc[ni--] = 0;
24520                 k3 = 1;
24521               }
24522             }
24523           }
24524           for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
24525         }
24526         if (x2.e > MAX_EXP) {
24527           x2.c = x2.e = null;
24528         } else if (x2.e < MIN_EXP) {
24529           x2.c = [x2.e = 0];
24530         }
24531       }
24532       return x2;
24533     }
24534     function valueOf(n3) {
24535       var str, e3 = n3.e;
24536       if (e3 === null) return n3.toString();
24537       str = coeffToString(n3.c);
24538       str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
24539       return n3.s < 0 ? "-" + str : str;
24540     }
24541     P3.absoluteValue = P3.abs = function() {
24542       var x2 = new BigNumber2(this);
24543       if (x2.s < 0) x2.s = 1;
24544       return x2;
24545     };
24546     P3.comparedTo = function(y2, b3) {
24547       return compare(this, new BigNumber2(y2, b3));
24548     };
24549     P3.decimalPlaces = P3.dp = function(dp, rm) {
24550       var c2, n3, v3, x2 = this;
24551       if (dp != null) {
24552         intCheck(dp, 0, MAX);
24553         if (rm == null) rm = ROUNDING_MODE;
24554         else intCheck(rm, 0, 8);
24555         return round(new BigNumber2(x2), dp + x2.e + 1, rm);
24556       }
24557       if (!(c2 = x2.c)) return null;
24558       n3 = ((v3 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
24559       if (v3 = c2[v3]) for (; v3 % 10 == 0; v3 /= 10, n3--) ;
24560       if (n3 < 0) n3 = 0;
24561       return n3;
24562     };
24563     P3.dividedBy = P3.div = function(y2, b3) {
24564       return div(this, new BigNumber2(y2, b3), DECIMAL_PLACES, ROUNDING_MODE);
24565     };
24566     P3.dividedToIntegerBy = P3.idiv = function(y2, b3) {
24567       return div(this, new BigNumber2(y2, b3), 0, 1);
24568     };
24569     P3.exponentiatedBy = P3.pow = function(n3, m3) {
24570       var half, isModExp, i3, k3, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
24571       n3 = new BigNumber2(n3);
24572       if (n3.c && !n3.isInteger()) {
24573         throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
24574       }
24575       if (m3 != null) m3 = new BigNumber2(m3);
24576       nIsBig = n3.e > 14;
24577       if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
24578         y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
24579         return m3 ? y2.mod(m3) : y2;
24580       }
24581       nIsNeg = n3.s < 0;
24582       if (m3) {
24583         if (m3.c ? !m3.c[0] : !m3.s) return new BigNumber2(NaN);
24584         isModExp = !nIsNeg && x2.isInteger() && m3.isInteger();
24585         if (isModExp) x2 = x2.mod(m3);
24586       } else if (n3.e > 9 && (x2.e > 0 || x2.e < -1 || (x2.e == 0 ? x2.c[0] > 1 || nIsBig && x2.c[1] >= 24e7 : x2.c[0] < 8e13 || nIsBig && x2.c[0] <= 9999975e7))) {
24587         k3 = x2.s < 0 && isOdd(n3) ? -0 : 0;
24588         if (x2.e > -1) k3 = 1 / k3;
24589         return new BigNumber2(nIsNeg ? 1 / k3 : k3);
24590       } else if (POW_PRECISION) {
24591         k3 = mathceil(POW_PRECISION / LOG_BASE + 2);
24592       }
24593       if (nIsBig) {
24594         half = new BigNumber2(0.5);
24595         if (nIsNeg) n3.s = 1;
24596         nIsOdd = isOdd(n3);
24597       } else {
24598         i3 = Math.abs(+valueOf(n3));
24599         nIsOdd = i3 % 2;
24600       }
24601       y2 = new BigNumber2(ONE);
24602       for (; ; ) {
24603         if (nIsOdd) {
24604           y2 = y2.times(x2);
24605           if (!y2.c) break;
24606           if (k3) {
24607             if (y2.c.length > k3) y2.c.length = k3;
24608           } else if (isModExp) {
24609             y2 = y2.mod(m3);
24610           }
24611         }
24612         if (i3) {
24613           i3 = mathfloor(i3 / 2);
24614           if (i3 === 0) break;
24615           nIsOdd = i3 % 2;
24616         } else {
24617           n3 = n3.times(half);
24618           round(n3, n3.e + 1, 1);
24619           if (n3.e > 14) {
24620             nIsOdd = isOdd(n3);
24621           } else {
24622             i3 = +valueOf(n3);
24623             if (i3 === 0) break;
24624             nIsOdd = i3 % 2;
24625           }
24626         }
24627         x2 = x2.times(x2);
24628         if (k3) {
24629           if (x2.c && x2.c.length > k3) x2.c.length = k3;
24630         } else if (isModExp) {
24631           x2 = x2.mod(m3);
24632         }
24633       }
24634       if (isModExp) return y2;
24635       if (nIsNeg) y2 = ONE.div(y2);
24636       return m3 ? y2.mod(m3) : k3 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
24637     };
24638     P3.integerValue = function(rm) {
24639       var n3 = new BigNumber2(this);
24640       if (rm == null) rm = ROUNDING_MODE;
24641       else intCheck(rm, 0, 8);
24642       return round(n3, n3.e + 1, rm);
24643     };
24644     P3.isEqualTo = P3.eq = function(y2, b3) {
24645       return compare(this, new BigNumber2(y2, b3)) === 0;
24646     };
24647     P3.isFinite = function() {
24648       return !!this.c;
24649     };
24650     P3.isGreaterThan = P3.gt = function(y2, b3) {
24651       return compare(this, new BigNumber2(y2, b3)) > 0;
24652     };
24653     P3.isGreaterThanOrEqualTo = P3.gte = function(y2, b3) {
24654       return (b3 = compare(this, new BigNumber2(y2, b3))) === 1 || b3 === 0;
24655     };
24656     P3.isInteger = function() {
24657       return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
24658     };
24659     P3.isLessThan = P3.lt = function(y2, b3) {
24660       return compare(this, new BigNumber2(y2, b3)) < 0;
24661     };
24662     P3.isLessThanOrEqualTo = P3.lte = function(y2, b3) {
24663       return (b3 = compare(this, new BigNumber2(y2, b3))) === -1 || b3 === 0;
24664     };
24665     P3.isNaN = function() {
24666       return !this.s;
24667     };
24668     P3.isNegative = function() {
24669       return this.s < 0;
24670     };
24671     P3.isPositive = function() {
24672       return this.s > 0;
24673     };
24674     P3.isZero = function() {
24675       return !!this.c && this.c[0] == 0;
24676     };
24677     P3.minus = function(y2, b3) {
24678       var i3, j3, t2, xLTy, x2 = this, a4 = x2.s;
24679       y2 = new BigNumber2(y2, b3);
24680       b3 = y2.s;
24681       if (!a4 || !b3) return new BigNumber2(NaN);
24682       if (a4 != b3) {
24683         y2.s = -b3;
24684         return x2.plus(y2);
24685       }
24686       var xe3 = x2.e / LOG_BASE, ye3 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24687       if (!xe3 || !ye3) {
24688         if (!xc || !yc) return xc ? (y2.s = -b3, y2) : new BigNumber2(yc ? x2 : NaN);
24689         if (!xc[0] || !yc[0]) {
24690           return yc[0] ? (y2.s = -b3, y2) : new BigNumber2(xc[0] ? x2 : (
24691             // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
24692             ROUNDING_MODE == 3 ? -0 : 0
24693           ));
24694         }
24695       }
24696       xe3 = bitFloor(xe3);
24697       ye3 = bitFloor(ye3);
24698       xc = xc.slice();
24699       if (a4 = xe3 - ye3) {
24700         if (xLTy = a4 < 0) {
24701           a4 = -a4;
24702           t2 = xc;
24703         } else {
24704           ye3 = xe3;
24705           t2 = yc;
24706         }
24707         t2.reverse();
24708         for (b3 = a4; b3--; t2.push(0)) ;
24709         t2.reverse();
24710       } else {
24711         j3 = (xLTy = (a4 = xc.length) < (b3 = yc.length)) ? a4 : b3;
24712         for (a4 = b3 = 0; b3 < j3; b3++) {
24713           if (xc[b3] != yc[b3]) {
24714             xLTy = xc[b3] < yc[b3];
24715             break;
24716           }
24717         }
24718       }
24719       if (xLTy) {
24720         t2 = xc;
24721         xc = yc;
24722         yc = t2;
24723         y2.s = -y2.s;
24724       }
24725       b3 = (j3 = yc.length) - (i3 = xc.length);
24726       if (b3 > 0) for (; b3--; xc[i3++] = 0) ;
24727       b3 = BASE - 1;
24728       for (; j3 > a4; ) {
24729         if (xc[--j3] < yc[j3]) {
24730           for (i3 = j3; i3 && !xc[--i3]; xc[i3] = b3) ;
24731           --xc[i3];
24732           xc[j3] += BASE;
24733         }
24734         xc[j3] -= yc[j3];
24735       }
24736       for (; xc[0] == 0; xc.splice(0, 1), --ye3) ;
24737       if (!xc[0]) {
24738         y2.s = ROUNDING_MODE == 3 ? -1 : 1;
24739         y2.c = [y2.e = 0];
24740         return y2;
24741       }
24742       return normalise(y2, xc, ye3);
24743     };
24744     P3.modulo = P3.mod = function(y2, b3) {
24745       var q3, s2, x2 = this;
24746       y2 = new BigNumber2(y2, b3);
24747       if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
24748         return new BigNumber2(NaN);
24749       } else if (!y2.c || x2.c && !x2.c[0]) {
24750         return new BigNumber2(x2);
24751       }
24752       if (MODULO_MODE == 9) {
24753         s2 = y2.s;
24754         y2.s = 1;
24755         q3 = div(x2, y2, 0, 3);
24756         y2.s = s2;
24757         q3.s *= s2;
24758       } else {
24759         q3 = div(x2, y2, 0, MODULO_MODE);
24760       }
24761       y2 = x2.minus(q3.times(y2));
24762       if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
24763       return y2;
24764     };
24765     P3.multipliedBy = P3.times = function(y2, b3) {
24766       var c2, e3, i3, j3, k3, m3, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b3)).c;
24767       if (!xc || !yc || !xc[0] || !yc[0]) {
24768         if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
24769           y2.c = y2.e = y2.s = null;
24770         } else {
24771           y2.s *= x2.s;
24772           if (!xc || !yc) {
24773             y2.c = y2.e = null;
24774           } else {
24775             y2.c = [0];
24776             y2.e = 0;
24777           }
24778         }
24779         return y2;
24780       }
24781       e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
24782       y2.s *= x2.s;
24783       xcL = xc.length;
24784       ycL = yc.length;
24785       if (xcL < ycL) {
24786         zc = xc;
24787         xc = yc;
24788         yc = zc;
24789         i3 = xcL;
24790         xcL = ycL;
24791         ycL = i3;
24792       }
24793       for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
24794       base = BASE;
24795       sqrtBase = SQRT_BASE;
24796       for (i3 = ycL; --i3 >= 0; ) {
24797         c2 = 0;
24798         ylo = yc[i3] % sqrtBase;
24799         yhi = yc[i3] / sqrtBase | 0;
24800         for (k3 = xcL, j3 = i3 + k3; j3 > i3; ) {
24801           xlo = xc[--k3] % sqrtBase;
24802           xhi = xc[k3] / sqrtBase | 0;
24803           m3 = yhi * xlo + xhi * ylo;
24804           xlo = ylo * xlo + m3 % sqrtBase * sqrtBase + zc[j3] + c2;
24805           c2 = (xlo / base | 0) + (m3 / sqrtBase | 0) + yhi * xhi;
24806           zc[j3--] = xlo % base;
24807         }
24808         zc[j3] = c2;
24809       }
24810       if (c2) {
24811         ++e3;
24812       } else {
24813         zc.splice(0, 1);
24814       }
24815       return normalise(y2, zc, e3);
24816     };
24817     P3.negated = function() {
24818       var x2 = new BigNumber2(this);
24819       x2.s = -x2.s || null;
24820       return x2;
24821     };
24822     P3.plus = function(y2, b3) {
24823       var t2, x2 = this, a4 = x2.s;
24824       y2 = new BigNumber2(y2, b3);
24825       b3 = y2.s;
24826       if (!a4 || !b3) return new BigNumber2(NaN);
24827       if (a4 != b3) {
24828         y2.s = -b3;
24829         return x2.minus(y2);
24830       }
24831       var xe3 = x2.e / LOG_BASE, ye3 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24832       if (!xe3 || !ye3) {
24833         if (!xc || !yc) return new BigNumber2(a4 / 0);
24834         if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a4 * 0);
24835       }
24836       xe3 = bitFloor(xe3);
24837       ye3 = bitFloor(ye3);
24838       xc = xc.slice();
24839       if (a4 = xe3 - ye3) {
24840         if (a4 > 0) {
24841           ye3 = xe3;
24842           t2 = yc;
24843         } else {
24844           a4 = -a4;
24845           t2 = xc;
24846         }
24847         t2.reverse();
24848         for (; a4--; t2.push(0)) ;
24849         t2.reverse();
24850       }
24851       a4 = xc.length;
24852       b3 = yc.length;
24853       if (a4 - b3 < 0) {
24854         t2 = yc;
24855         yc = xc;
24856         xc = t2;
24857         b3 = a4;
24858       }
24859       for (a4 = 0; b3; ) {
24860         a4 = (xc[--b3] = xc[b3] + yc[b3] + a4) / BASE | 0;
24861         xc[b3] = BASE === xc[b3] ? 0 : xc[b3] % BASE;
24862       }
24863       if (a4) {
24864         xc = [a4].concat(xc);
24865         ++ye3;
24866       }
24867       return normalise(y2, xc, ye3);
24868     };
24869     P3.precision = P3.sd = function(sd, rm) {
24870       var c2, n3, v3, x2 = this;
24871       if (sd != null && sd !== !!sd) {
24872         intCheck(sd, 1, MAX);
24873         if (rm == null) rm = ROUNDING_MODE;
24874         else intCheck(rm, 0, 8);
24875         return round(new BigNumber2(x2), sd, rm);
24876       }
24877       if (!(c2 = x2.c)) return null;
24878       v3 = c2.length - 1;
24879       n3 = v3 * LOG_BASE + 1;
24880       if (v3 = c2[v3]) {
24881         for (; v3 % 10 == 0; v3 /= 10, n3--) ;
24882         for (v3 = c2[0]; v3 >= 10; v3 /= 10, n3++) ;
24883       }
24884       if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
24885       return n3;
24886     };
24887     P3.shiftedBy = function(k3) {
24888       intCheck(k3, -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3);
24889       return this.times("1e" + k3);
24890     };
24891     P3.squareRoot = P3.sqrt = function() {
24892       var m3, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
24893       if (s2 !== 1 || !c2 || !c2[0]) {
24894         return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
24895       }
24896       s2 = Math.sqrt(+valueOf(x2));
24897       if (s2 == 0 || s2 == 1 / 0) {
24898         n3 = coeffToString(c2);
24899         if ((n3.length + e3) % 2 == 0) n3 += "0";
24900         s2 = Math.sqrt(+n3);
24901         e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
24902         if (s2 == 1 / 0) {
24903           n3 = "5e" + e3;
24904         } else {
24905           n3 = s2.toExponential();
24906           n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
24907         }
24908         r2 = new BigNumber2(n3);
24909       } else {
24910         r2 = new BigNumber2(s2 + "");
24911       }
24912       if (r2.c[0]) {
24913         e3 = r2.e;
24914         s2 = e3 + dp;
24915         if (s2 < 3) s2 = 0;
24916         for (; ; ) {
24917           t2 = r2;
24918           r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
24919           if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
24920             if (r2.e < e3) --s2;
24921             n3 = n3.slice(s2 - 3, s2 + 1);
24922             if (n3 == "9999" || !rep && n3 == "4999") {
24923               if (!rep) {
24924                 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
24925                 if (t2.times(t2).eq(x2)) {
24926                   r2 = t2;
24927                   break;
24928                 }
24929               }
24930               dp += 4;
24931               s2 += 4;
24932               rep = 1;
24933             } else {
24934               if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
24935                 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
24936                 m3 = !r2.times(r2).eq(x2);
24937               }
24938               break;
24939             }
24940           }
24941         }
24942       }
24943       return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m3);
24944     };
24945     P3.toExponential = function(dp, rm) {
24946       if (dp != null) {
24947         intCheck(dp, 0, MAX);
24948         dp++;
24949       }
24950       return format2(this, dp, rm, 1);
24951     };
24952     P3.toFixed = function(dp, rm) {
24953       if (dp != null) {
24954         intCheck(dp, 0, MAX);
24955         dp = dp + this.e + 1;
24956       }
24957       return format2(this, dp, rm);
24958     };
24959     P3.toFormat = function(dp, rm, format3) {
24960       var str, x2 = this;
24961       if (format3 == null) {
24962         if (dp != null && rm && typeof rm == "object") {
24963           format3 = rm;
24964           rm = null;
24965         } else if (dp && typeof dp == "object") {
24966           format3 = dp;
24967           dp = rm = null;
24968         } else {
24969           format3 = FORMAT;
24970         }
24971       } else if (typeof format3 != "object") {
24972         throw Error(bignumberError + "Argument not an object: " + format3);
24973       }
24974       str = x2.toFixed(dp, rm);
24975       if (x2.c) {
24976         var i3, arr = str.split("."), g1 = +format3.groupSize, g22 = +format3.secondaryGroupSize, groupSeparator = format3.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x2.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
24977         if (g22) {
24978           i3 = g1;
24979           g1 = g22;
24980           g22 = i3;
24981           len -= i3;
24982         }
24983         if (g1 > 0 && len > 0) {
24984           i3 = len % g1 || g1;
24985           intPart = intDigits.substr(0, i3);
24986           for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
24987           if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
24988           if (isNeg) intPart = "-" + intPart;
24989         }
24990         str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
24991           new RegExp("\\d{" + g22 + "}\\B", "g"),
24992           "$&" + (format3.fractionGroupSeparator || "")
24993         ) : fractionPart) : intPart;
24994       }
24995       return (format3.prefix || "") + str + (format3.suffix || "");
24996     };
24997     P3.toFraction = function(md) {
24998       var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q3, r2, s2, x2 = this, xc = x2.c;
24999       if (md != null) {
25000         n3 = new BigNumber2(md);
25001         if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
25002           throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
25003         }
25004       }
25005       if (!xc) return new BigNumber2(x2);
25006       d2 = new BigNumber2(ONE);
25007       n1 = d0 = new BigNumber2(ONE);
25008       d1 = n0 = new BigNumber2(ONE);
25009       s2 = coeffToString(xc);
25010       e3 = d2.e = s2.length - x2.e - 1;
25011       d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
25012       md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
25013       exp2 = MAX_EXP;
25014       MAX_EXP = 1 / 0;
25015       n3 = new BigNumber2(s2);
25016       n0.c[0] = 0;
25017       for (; ; ) {
25018         q3 = div(n3, d2, 0, 1);
25019         d22 = d0.plus(q3.times(d1));
25020         if (d22.comparedTo(md) == 1) break;
25021         d0 = d1;
25022         d1 = d22;
25023         n1 = n0.plus(q3.times(d22 = n1));
25024         n0 = d22;
25025         d2 = n3.minus(q3.times(d22 = d2));
25026         n3 = d22;
25027       }
25028       d22 = div(md.minus(d0), d1, 0, 1);
25029       n0 = n0.plus(d22.times(n1));
25030       d0 = d0.plus(d22.times(d1));
25031       n0.s = n1.s = x2.s;
25032       e3 = e3 * 2;
25033       r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
25034         div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
25035       ) < 1 ? [n1, d1] : [n0, d0];
25036       MAX_EXP = exp2;
25037       return r2;
25038     };
25039     P3.toNumber = function() {
25040       return +valueOf(this);
25041     };
25042     P3.toPrecision = function(sd, rm) {
25043       if (sd != null) intCheck(sd, 1, MAX);
25044       return format2(this, sd, rm, 2);
25045     };
25046     P3.toString = function(b3) {
25047       var str, n3 = this, s2 = n3.s, e3 = n3.e;
25048       if (e3 === null) {
25049         if (s2) {
25050           str = "Infinity";
25051           if (s2 < 0) str = "-" + str;
25052         } else {
25053           str = "NaN";
25054         }
25055       } else {
25056         if (b3 == null) {
25057           str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
25058         } else if (b3 === 10 && alphabetHasNormalDecimalDigits) {
25059           n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
25060           str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
25061         } else {
25062           intCheck(b3, 2, ALPHABET.length, "Base");
25063           str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b3, s2, true);
25064         }
25065         if (s2 < 0 && n3.c[0]) str = "-" + str;
25066       }
25067       return str;
25068     };
25069     P3.valueOf = P3.toJSON = function() {
25070       return valueOf(this);
25071     };
25072     P3._isBigNumber = true;
25073     P3[Symbol.toStringTag] = "BigNumber";
25074     P3[Symbol.for("nodejs.util.inspect.custom")] = P3.valueOf;
25075     if (configObject != null) BigNumber2.set(configObject);
25076     return BigNumber2;
25077   }
25078   function bitFloor(n3) {
25079     var i3 = n3 | 0;
25080     return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
25081   }
25082   function coeffToString(a4) {
25083     var s2, z3, i3 = 1, j3 = a4.length, r2 = a4[0] + "";
25084     for (; i3 < j3; ) {
25085       s2 = a4[i3++] + "";
25086       z3 = LOG_BASE - s2.length;
25087       for (; z3--; s2 = "0" + s2) ;
25088       r2 += s2;
25089     }
25090     for (j3 = r2.length; r2.charCodeAt(--j3) === 48; ) ;
25091     return r2.slice(0, j3 + 1 || 1);
25092   }
25093   function compare(x2, y2) {
25094     var a4, b3, xc = x2.c, yc = y2.c, i3 = x2.s, j3 = y2.s, k3 = x2.e, l2 = y2.e;
25095     if (!i3 || !j3) return null;
25096     a4 = xc && !xc[0];
25097     b3 = yc && !yc[0];
25098     if (a4 || b3) return a4 ? b3 ? 0 : -j3 : i3;
25099     if (i3 != j3) return i3;
25100     a4 = i3 < 0;
25101     b3 = k3 == l2;
25102     if (!xc || !yc) return b3 ? 0 : !xc ^ a4 ? 1 : -1;
25103     if (!b3) return k3 > l2 ^ a4 ? 1 : -1;
25104     j3 = (k3 = xc.length) < (l2 = yc.length) ? k3 : l2;
25105     for (i3 = 0; i3 < j3; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a4 ? 1 : -1;
25106     return k3 == l2 ? 0 : k3 > l2 ^ a4 ? 1 : -1;
25107   }
25108   function intCheck(n3, min3, max3, name) {
25109     if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
25110       throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
25111     }
25112   }
25113   function isOdd(n3) {
25114     var k3 = n3.c.length - 1;
25115     return bitFloor(n3.e / LOG_BASE) == k3 && n3.c[k3] % 2 != 0;
25116   }
25117   function toExponential(str, e3) {
25118     return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
25119   }
25120   function toFixedPoint(str, e3, z3) {
25121     var len, zs;
25122     if (e3 < 0) {
25123       for (zs = z3 + "."; ++e3; zs += z3) ;
25124       str = zs + str;
25125     } else {
25126       len = str.length;
25127       if (++e3 > len) {
25128         for (zs = z3, e3 -= len; --e3; zs += z3) ;
25129         str += zs;
25130       } else if (e3 < len) {
25131         str = str.slice(0, e3) + "." + str.slice(e3);
25132       }
25133     }
25134     return str;
25135   }
25136   var isNumeric, mathceil, mathfloor, bignumberError, tooManyDigits, BASE, LOG_BASE, MAX_SAFE_INTEGER3, POWS_TEN, SQRT_BASE, MAX, BigNumber, bignumber_default;
25137   var init_bignumber = __esm({
25138     "node_modules/bignumber.js/bignumber.mjs"() {
25139       isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
25140       mathceil = Math.ceil;
25141       mathfloor = Math.floor;
25142       bignumberError = "[BigNumber Error] ";
25143       tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
25144       BASE = 1e14;
25145       LOG_BASE = 14;
25146       MAX_SAFE_INTEGER3 = 9007199254740991;
25147       POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
25148       SQRT_BASE = 1e7;
25149       MAX = 1e9;
25150       BigNumber = clone();
25151       bignumber_default = BigNumber;
25152     }
25153   });
25154
25155   // node_modules/splaytree-ts/dist/esm/index.js
25156   var SplayTreeNode, SplayTreeSetNode, SplayTree, _a, _b, SplayTreeSet, SplayTreeIterableIterator, SplayTreeKeyIterableIterator, SplayTreeSetEntryIterableIterator;
25157   var init_esm = __esm({
25158     "node_modules/splaytree-ts/dist/esm/index.js"() {
25159       SplayTreeNode = class {
25160         constructor(key) {
25161           __publicField(this, "key");
25162           __publicField(this, "left", null);
25163           __publicField(this, "right", null);
25164           this.key = key;
25165         }
25166       };
25167       SplayTreeSetNode = class extends SplayTreeNode {
25168         constructor(key) {
25169           super(key);
25170         }
25171       };
25172       SplayTree = class {
25173         constructor() {
25174           __publicField(this, "size", 0);
25175           __publicField(this, "modificationCount", 0);
25176           __publicField(this, "splayCount", 0);
25177         }
25178         splay(key) {
25179           const root3 = this.root;
25180           if (root3 == null) {
25181             this.compare(key, key);
25182             return -1;
25183           }
25184           let right = null;
25185           let newTreeRight = null;
25186           let left = null;
25187           let newTreeLeft = null;
25188           let current = root3;
25189           const compare2 = this.compare;
25190           let comp;
25191           while (true) {
25192             comp = compare2(current.key, key);
25193             if (comp > 0) {
25194               let currentLeft = current.left;
25195               if (currentLeft == null) break;
25196               comp = compare2(currentLeft.key, key);
25197               if (comp > 0) {
25198                 current.left = currentLeft.right;
25199                 currentLeft.right = current;
25200                 current = currentLeft;
25201                 currentLeft = current.left;
25202                 if (currentLeft == null) break;
25203               }
25204               if (right == null) {
25205                 newTreeRight = current;
25206               } else {
25207                 right.left = current;
25208               }
25209               right = current;
25210               current = currentLeft;
25211             } else if (comp < 0) {
25212               let currentRight = current.right;
25213               if (currentRight == null) break;
25214               comp = compare2(currentRight.key, key);
25215               if (comp < 0) {
25216                 current.right = currentRight.left;
25217                 currentRight.left = current;
25218                 current = currentRight;
25219                 currentRight = current.right;
25220                 if (currentRight == null) break;
25221               }
25222               if (left == null) {
25223                 newTreeLeft = current;
25224               } else {
25225                 left.right = current;
25226               }
25227               left = current;
25228               current = currentRight;
25229             } else {
25230               break;
25231             }
25232           }
25233           if (left != null) {
25234             left.right = current.left;
25235             current.left = newTreeLeft;
25236           }
25237           if (right != null) {
25238             right.left = current.right;
25239             current.right = newTreeRight;
25240           }
25241           if (this.root !== current) {
25242             this.root = current;
25243             this.splayCount++;
25244           }
25245           return comp;
25246         }
25247         splayMin(node) {
25248           let current = node;
25249           let nextLeft = current.left;
25250           while (nextLeft != null) {
25251             const left = nextLeft;
25252             current.left = left.right;
25253             left.right = current;
25254             current = left;
25255             nextLeft = current.left;
25256           }
25257           return current;
25258         }
25259         splayMax(node) {
25260           let current = node;
25261           let nextRight = current.right;
25262           while (nextRight != null) {
25263             const right = nextRight;
25264             current.right = right.left;
25265             right.left = current;
25266             current = right;
25267             nextRight = current.right;
25268           }
25269           return current;
25270         }
25271         _delete(key) {
25272           if (this.root == null) return null;
25273           const comp = this.splay(key);
25274           if (comp != 0) return null;
25275           let root3 = this.root;
25276           const result = root3;
25277           const left = root3.left;
25278           this.size--;
25279           if (left == null) {
25280             this.root = root3.right;
25281           } else {
25282             const right = root3.right;
25283             root3 = this.splayMax(left);
25284             root3.right = right;
25285             this.root = root3;
25286           }
25287           this.modificationCount++;
25288           return result;
25289         }
25290         addNewRoot(node, comp) {
25291           this.size++;
25292           this.modificationCount++;
25293           const root3 = this.root;
25294           if (root3 == null) {
25295             this.root = node;
25296             return;
25297           }
25298           if (comp < 0) {
25299             node.left = root3;
25300             node.right = root3.right;
25301             root3.right = null;
25302           } else {
25303             node.right = root3;
25304             node.left = root3.left;
25305             root3.left = null;
25306           }
25307           this.root = node;
25308         }
25309         _first() {
25310           const root3 = this.root;
25311           if (root3 == null) return null;
25312           this.root = this.splayMin(root3);
25313           return this.root;
25314         }
25315         _last() {
25316           const root3 = this.root;
25317           if (root3 == null) return null;
25318           this.root = this.splayMax(root3);
25319           return this.root;
25320         }
25321         clear() {
25322           this.root = null;
25323           this.size = 0;
25324           this.modificationCount++;
25325         }
25326         has(key) {
25327           return this.validKey(key) && this.splay(key) == 0;
25328         }
25329         defaultCompare() {
25330           return (a4, b3) => a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
25331         }
25332         wrap() {
25333           return {
25334             getRoot: () => {
25335               return this.root;
25336             },
25337             setRoot: (root3) => {
25338               this.root = root3;
25339             },
25340             getSize: () => {
25341               return this.size;
25342             },
25343             getModificationCount: () => {
25344               return this.modificationCount;
25345             },
25346             getSplayCount: () => {
25347               return this.splayCount;
25348             },
25349             setSplayCount: (count) => {
25350               this.splayCount = count;
25351             },
25352             splay: (key) => {
25353               return this.splay(key);
25354             },
25355             has: (key) => {
25356               return this.has(key);
25357             }
25358           };
25359         }
25360       };
25361       SplayTreeSet = class _SplayTreeSet extends SplayTree {
25362         constructor(compare2, isValidKey) {
25363           super();
25364           __publicField(this, "root", null);
25365           __publicField(this, "compare");
25366           __publicField(this, "validKey");
25367           __publicField(this, _a, "[object Set]");
25368           this.compare = compare2 != null ? compare2 : this.defaultCompare();
25369           this.validKey = isValidKey != null ? isValidKey : (v3) => v3 != null && v3 != void 0;
25370         }
25371         delete(element) {
25372           if (!this.validKey(element)) return false;
25373           return this._delete(element) != null;
25374         }
25375         deleteAll(elements) {
25376           for (const element of elements) {
25377             this.delete(element);
25378           }
25379         }
25380         forEach(f2) {
25381           const nodes = this[Symbol.iterator]();
25382           let result;
25383           while (result = nodes.next(), !result.done) {
25384             f2(result.value, result.value, this);
25385           }
25386         }
25387         add(element) {
25388           const compare2 = this.splay(element);
25389           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
25390           return this;
25391         }
25392         addAndReturn(element) {
25393           const compare2 = this.splay(element);
25394           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
25395           return this.root.key;
25396         }
25397         addAll(elements) {
25398           for (const element of elements) {
25399             this.add(element);
25400           }
25401         }
25402         isEmpty() {
25403           return this.root == null;
25404         }
25405         isNotEmpty() {
25406           return this.root != null;
25407         }
25408         single() {
25409           if (this.size == 0) throw "Bad state: No element";
25410           if (this.size > 1) throw "Bad state: Too many element";
25411           return this.root.key;
25412         }
25413         first() {
25414           if (this.size == 0) throw "Bad state: No element";
25415           return this._first().key;
25416         }
25417         last() {
25418           if (this.size == 0) throw "Bad state: No element";
25419           return this._last().key;
25420         }
25421         lastBefore(element) {
25422           if (element == null) throw "Invalid arguments(s)";
25423           if (this.root == null) return null;
25424           const comp = this.splay(element);
25425           if (comp < 0) return this.root.key;
25426           let node = this.root.left;
25427           if (node == null) return null;
25428           let nodeRight = node.right;
25429           while (nodeRight != null) {
25430             node = nodeRight;
25431             nodeRight = node.right;
25432           }
25433           return node.key;
25434         }
25435         firstAfter(element) {
25436           if (element == null) throw "Invalid arguments(s)";
25437           if (this.root == null) return null;
25438           const comp = this.splay(element);
25439           if (comp > 0) return this.root.key;
25440           let node = this.root.right;
25441           if (node == null) return null;
25442           let nodeLeft = node.left;
25443           while (nodeLeft != null) {
25444             node = nodeLeft;
25445             nodeLeft = node.left;
25446           }
25447           return node.key;
25448         }
25449         retainAll(elements) {
25450           const retainSet = new _SplayTreeSet(this.compare, this.validKey);
25451           const modificationCount = this.modificationCount;
25452           for (const object of elements) {
25453             if (modificationCount != this.modificationCount) {
25454               throw "Concurrent modification during iteration.";
25455             }
25456             if (this.validKey(object) && this.splay(object) == 0) {
25457               retainSet.add(this.root.key);
25458             }
25459           }
25460           if (retainSet.size != this.size) {
25461             this.root = retainSet.root;
25462             this.size = retainSet.size;
25463             this.modificationCount++;
25464           }
25465         }
25466         lookup(object) {
25467           if (!this.validKey(object)) return null;
25468           const comp = this.splay(object);
25469           if (comp != 0) return null;
25470           return this.root.key;
25471         }
25472         intersection(other) {
25473           const result = new _SplayTreeSet(this.compare, this.validKey);
25474           for (const element of this) {
25475             if (other.has(element)) result.add(element);
25476           }
25477           return result;
25478         }
25479         difference(other) {
25480           const result = new _SplayTreeSet(this.compare, this.validKey);
25481           for (const element of this) {
25482             if (!other.has(element)) result.add(element);
25483           }
25484           return result;
25485         }
25486         union(other) {
25487           const u2 = this.clone();
25488           u2.addAll(other);
25489           return u2;
25490         }
25491         clone() {
25492           const set4 = new _SplayTreeSet(this.compare, this.validKey);
25493           set4.size = this.size;
25494           set4.root = this.copyNode(this.root);
25495           return set4;
25496         }
25497         copyNode(node) {
25498           if (node == null) return null;
25499           function copyChildren(node2, dest) {
25500             let left;
25501             let right;
25502             do {
25503               left = node2.left;
25504               right = node2.right;
25505               if (left != null) {
25506                 const newLeft = new SplayTreeSetNode(left.key);
25507                 dest.left = newLeft;
25508                 copyChildren(left, newLeft);
25509               }
25510               if (right != null) {
25511                 const newRight = new SplayTreeSetNode(right.key);
25512                 dest.right = newRight;
25513                 node2 = right;
25514                 dest = newRight;
25515               }
25516             } while (right != null);
25517           }
25518           const result = new SplayTreeSetNode(node.key);
25519           copyChildren(node, result);
25520           return result;
25521         }
25522         toSet() {
25523           return this.clone();
25524         }
25525         entries() {
25526           return new SplayTreeSetEntryIterableIterator(this.wrap());
25527         }
25528         keys() {
25529           return this[Symbol.iterator]();
25530         }
25531         values() {
25532           return this[Symbol.iterator]();
25533         }
25534         [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
25535           return new SplayTreeKeyIterableIterator(this.wrap());
25536         }
25537       };
25538       SplayTreeIterableIterator = class {
25539         constructor(tree) {
25540           __publicField(this, "tree");
25541           __publicField(this, "path", new Array());
25542           __publicField(this, "modificationCount", null);
25543           __publicField(this, "splayCount");
25544           this.tree = tree;
25545           this.splayCount = tree.getSplayCount();
25546         }
25547         [Symbol.iterator]() {
25548           return this;
25549         }
25550         next() {
25551           if (this.moveNext()) return { done: false, value: this.current() };
25552           return { done: true, value: null };
25553         }
25554         current() {
25555           if (!this.path.length) return null;
25556           const node = this.path[this.path.length - 1];
25557           return this.getValue(node);
25558         }
25559         rebuildPath(key) {
25560           this.path.splice(0, this.path.length);
25561           this.tree.splay(key);
25562           this.path.push(this.tree.getRoot());
25563           this.splayCount = this.tree.getSplayCount();
25564         }
25565         findLeftMostDescendent(node) {
25566           while (node != null) {
25567             this.path.push(node);
25568             node = node.left;
25569           }
25570         }
25571         moveNext() {
25572           if (this.modificationCount != this.tree.getModificationCount()) {
25573             if (this.modificationCount == null) {
25574               this.modificationCount = this.tree.getModificationCount();
25575               let node2 = this.tree.getRoot();
25576               while (node2 != null) {
25577                 this.path.push(node2);
25578                 node2 = node2.left;
25579               }
25580               return this.path.length > 0;
25581             }
25582             throw "Concurrent modification during iteration.";
25583           }
25584           if (!this.path.length) return false;
25585           if (this.splayCount != this.tree.getSplayCount()) {
25586             this.rebuildPath(this.path[this.path.length - 1].key);
25587           }
25588           let node = this.path[this.path.length - 1];
25589           let next = node.right;
25590           if (next != null) {
25591             while (next != null) {
25592               this.path.push(next);
25593               next = next.left;
25594             }
25595             return true;
25596           }
25597           this.path.pop();
25598           while (this.path.length && this.path[this.path.length - 1].right === node) {
25599             node = this.path.pop();
25600           }
25601           return this.path.length > 0;
25602         }
25603       };
25604       SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
25605         getValue(node) {
25606           return node.key;
25607         }
25608       };
25609       SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
25610         getValue(node) {
25611           return [node.key, node.key];
25612         }
25613       };
25614     }
25615   });
25616
25617   // node_modules/polyclip-ts/dist/esm/index.js
25618   function orient_default(eps) {
25619     const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(
25620       cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)
25621     ) : constant_default6(false);
25622     return (a4, b3, c2) => {
25623       const ax = a4.x, ay = a4.y, cx = c2.x, cy = c2.y;
25624       const area2 = ay.minus(cy).times(b3.x.minus(cx)).minus(ax.minus(cx).times(b3.y.minus(cy)));
25625       if (almostCollinear(area2, ax, ay, cx, cy)) return 0;
25626       return area2.comparedTo(0);
25627     };
25628   }
25629   var constant_default6, compare_default, identity_default4, snap_default, set3, precision, isInBbox, getBboxOverlap, crossProduct, dotProduct, length, sineOfAngle, cosineOfAngle, horizontalIntersection, verticalIntersection, intersection, SweepEvent, RingOut, PolyOut, MultiPolyOut, SweepLine, Operation, operation, operation_default, segmentId, Segment, RingIn, PolyIn, MultiPolyIn, union, difference, setPrecision;
25630   var init_esm2 = __esm({
25631     "node_modules/polyclip-ts/dist/esm/index.js"() {
25632       init_bignumber();
25633       init_bignumber();
25634       init_esm();
25635       init_esm();
25636       init_esm();
25637       constant_default6 = (x2) => {
25638         return () => {
25639           return x2;
25640         };
25641       };
25642       compare_default = (eps) => {
25643         const almostEqual = eps ? (a4, b3) => b3.minus(a4).abs().isLessThanOrEqualTo(eps) : constant_default6(false);
25644         return (a4, b3) => {
25645           if (almostEqual(a4, b3)) return 0;
25646           return a4.comparedTo(b3);
25647         };
25648       };
25649       identity_default4 = (x2) => {
25650         return x2;
25651       };
25652       snap_default = (eps) => {
25653         if (eps) {
25654           const xTree = new SplayTreeSet(compare_default(eps));
25655           const yTree = new SplayTreeSet(compare_default(eps));
25656           const snapCoord = (coord2, tree) => {
25657             return tree.addAndReturn(coord2);
25658           };
25659           const snap = (v3) => {
25660             return {
25661               x: snapCoord(v3.x, xTree),
25662               y: snapCoord(v3.y, yTree)
25663             };
25664           };
25665           snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
25666           return snap;
25667         }
25668         return identity_default4;
25669       };
25670       set3 = (eps) => {
25671         return {
25672           set: (eps2) => {
25673             precision = set3(eps2);
25674           },
25675           reset: () => set3(eps),
25676           compare: compare_default(eps),
25677           snap: snap_default(eps),
25678           orient: orient_default(eps)
25679         };
25680       };
25681       precision = set3();
25682       isInBbox = (bbox2, point) => {
25683         return bbox2.ll.x.isLessThanOrEqualTo(point.x) && point.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point.y) && point.y.isLessThanOrEqualTo(bbox2.ur.y);
25684       };
25685       getBboxOverlap = (b1, b22) => {
25686         if (b22.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b22.ll.x) || b22.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b22.ll.y))
25687           return null;
25688         const lowerX = b1.ll.x.isLessThan(b22.ll.x) ? b22.ll.x : b1.ll.x;
25689         const upperX = b1.ur.x.isLessThan(b22.ur.x) ? b1.ur.x : b22.ur.x;
25690         const lowerY = b1.ll.y.isLessThan(b22.ll.y) ? b22.ll.y : b1.ll.y;
25691         const upperY = b1.ur.y.isLessThan(b22.ur.y) ? b1.ur.y : b22.ur.y;
25692         return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
25693       };
25694       crossProduct = (a4, b3) => a4.x.times(b3.y).minus(a4.y.times(b3.x));
25695       dotProduct = (a4, b3) => a4.x.times(b3.x).plus(a4.y.times(b3.y));
25696       length = (v3) => dotProduct(v3, v3).sqrt();
25697       sineOfAngle = (pShared, pBase, pAngle) => {
25698         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25699         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25700         return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25701       };
25702       cosineOfAngle = (pShared, pBase, pAngle) => {
25703         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25704         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25705         return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25706       };
25707       horizontalIntersection = (pt2, v3, y2) => {
25708         if (v3.y.isZero()) return null;
25709         return { x: pt2.x.plus(v3.x.div(v3.y).times(y2.minus(pt2.y))), y: y2 };
25710       };
25711       verticalIntersection = (pt2, v3, x2) => {
25712         if (v3.x.isZero()) return null;
25713         return { x: x2, y: pt2.y.plus(v3.y.div(v3.x).times(x2.minus(pt2.x))) };
25714       };
25715       intersection = (pt1, v1, pt2, v22) => {
25716         if (v1.x.isZero()) return verticalIntersection(pt2, v22, pt1.x);
25717         if (v22.x.isZero()) return verticalIntersection(pt1, v1, pt2.x);
25718         if (v1.y.isZero()) return horizontalIntersection(pt2, v22, pt1.y);
25719         if (v22.y.isZero()) return horizontalIntersection(pt1, v1, pt2.y);
25720         const kross = crossProduct(v1, v22);
25721         if (kross.isZero()) return null;
25722         const ve3 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
25723         const d1 = crossProduct(ve3, v1).div(kross);
25724         const d2 = crossProduct(ve3, v22).div(kross);
25725         const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v22.x));
25726         const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v22.y));
25727         const x3 = x12.plus(x2).div(2);
25728         const y3 = y12.plus(y2).div(2);
25729         return { x: x3, y: y3 };
25730       };
25731       SweepEvent = class _SweepEvent {
25732         // Warning: 'point' input will be modified and re-used (for performance)
25733         constructor(point, isLeft) {
25734           __publicField(this, "point");
25735           __publicField(this, "isLeft");
25736           __publicField(this, "segment");
25737           __publicField(this, "otherSE");
25738           __publicField(this, "consumedBy");
25739           if (point.events === void 0) point.events = [this];
25740           else point.events.push(this);
25741           this.point = point;
25742           this.isLeft = isLeft;
25743         }
25744         // for ordering sweep events in the sweep event queue
25745         static compare(a4, b3) {
25746           const ptCmp = _SweepEvent.comparePoints(a4.point, b3.point);
25747           if (ptCmp !== 0) return ptCmp;
25748           if (a4.point !== b3.point) a4.link(b3);
25749           if (a4.isLeft !== b3.isLeft) return a4.isLeft ? 1 : -1;
25750           return Segment.compare(a4.segment, b3.segment);
25751         }
25752         // for ordering points in sweep line order
25753         static comparePoints(aPt, bPt) {
25754           if (aPt.x.isLessThan(bPt.x)) return -1;
25755           if (aPt.x.isGreaterThan(bPt.x)) return 1;
25756           if (aPt.y.isLessThan(bPt.y)) return -1;
25757           if (aPt.y.isGreaterThan(bPt.y)) return 1;
25758           return 0;
25759         }
25760         link(other) {
25761           if (other.point === this.point) {
25762             throw new Error("Tried to link already linked events");
25763           }
25764           const otherEvents = other.point.events;
25765           for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
25766             const evt = otherEvents[i3];
25767             this.point.events.push(evt);
25768             evt.point = this.point;
25769           }
25770           this.checkForConsuming();
25771         }
25772         /* Do a pass over our linked events and check to see if any pair
25773          * of segments match, and should be consumed. */
25774         checkForConsuming() {
25775           const numEvents = this.point.events.length;
25776           for (let i3 = 0; i3 < numEvents; i3++) {
25777             const evt1 = this.point.events[i3];
25778             if (evt1.segment.consumedBy !== void 0) continue;
25779             for (let j3 = i3 + 1; j3 < numEvents; j3++) {
25780               const evt2 = this.point.events[j3];
25781               if (evt2.consumedBy !== void 0) continue;
25782               if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
25783               evt1.segment.consume(evt2.segment);
25784             }
25785           }
25786         }
25787         getAvailableLinkedEvents() {
25788           const events = [];
25789           for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
25790             const evt = this.point.events[i3];
25791             if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
25792               events.push(evt);
25793             }
25794           }
25795           return events;
25796         }
25797         /**
25798          * Returns a comparator function for sorting linked events that will
25799          * favor the event that will give us the smallest left-side angle.
25800          * All ring construction starts as low as possible heading to the right,
25801          * so by always turning left as sharp as possible we'll get polygons
25802          * without uncessary loops & holes.
25803          *
25804          * The comparator function has a compute cache such that it avoids
25805          * re-computing already-computed values.
25806          */
25807         getLeftmostComparator(baseEvent) {
25808           const cache = /* @__PURE__ */ new Map();
25809           const fillCache = (linkedEvent) => {
25810             const nextEvent = linkedEvent.otherSE;
25811             cache.set(linkedEvent, {
25812               sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
25813               cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
25814             });
25815           };
25816           return (a4, b3) => {
25817             if (!cache.has(a4)) fillCache(a4);
25818             if (!cache.has(b3)) fillCache(b3);
25819             const { sine: asine, cosine: acosine } = cache.get(a4);
25820             const { sine: bsine, cosine: bcosine } = cache.get(b3);
25821             if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
25822               if (acosine.isLessThan(bcosine)) return 1;
25823               if (acosine.isGreaterThan(bcosine)) return -1;
25824               return 0;
25825             }
25826             if (asine.isLessThan(0) && bsine.isLessThan(0)) {
25827               if (acosine.isLessThan(bcosine)) return -1;
25828               if (acosine.isGreaterThan(bcosine)) return 1;
25829               return 0;
25830             }
25831             if (bsine.isLessThan(asine)) return -1;
25832             if (bsine.isGreaterThan(asine)) return 1;
25833             return 0;
25834           };
25835         }
25836       };
25837       RingOut = class _RingOut {
25838         constructor(events) {
25839           __publicField(this, "events");
25840           __publicField(this, "poly");
25841           __publicField(this, "_isExteriorRing");
25842           __publicField(this, "_enclosingRing");
25843           this.events = events;
25844           for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
25845             events[i3].segment.ringOut = this;
25846           }
25847           this.poly = null;
25848         }
25849         /* Given the segments from the sweep line pass, compute & return a series
25850          * of closed rings from all the segments marked to be part of the result */
25851         static factory(allSegments) {
25852           const ringsOut = [];
25853           for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
25854             const segment = allSegments[i3];
25855             if (!segment.isInResult() || segment.ringOut) continue;
25856             let prevEvent = null;
25857             let event = segment.leftSE;
25858             let nextEvent = segment.rightSE;
25859             const events = [event];
25860             const startingPoint = event.point;
25861             const intersectionLEs = [];
25862             while (true) {
25863               prevEvent = event;
25864               event = nextEvent;
25865               events.push(event);
25866               if (event.point === startingPoint) break;
25867               while (true) {
25868                 const availableLEs = event.getAvailableLinkedEvents();
25869                 if (availableLEs.length === 0) {
25870                   const firstPt = events[0].point;
25871                   const lastPt = events[events.length - 1].point;
25872                   throw new Error(
25873                     `Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`
25874                   );
25875                 }
25876                 if (availableLEs.length === 1) {
25877                   nextEvent = availableLEs[0].otherSE;
25878                   break;
25879                 }
25880                 let indexLE = null;
25881                 for (let j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
25882                   if (intersectionLEs[j3].point === event.point) {
25883                     indexLE = j3;
25884                     break;
25885                   }
25886                 }
25887                 if (indexLE !== null) {
25888                   const intersectionLE = intersectionLEs.splice(indexLE)[0];
25889                   const ringEvents = events.splice(intersectionLE.index);
25890                   ringEvents.unshift(ringEvents[0].otherSE);
25891                   ringsOut.push(new _RingOut(ringEvents.reverse()));
25892                   continue;
25893                 }
25894                 intersectionLEs.push({
25895                   index: events.length,
25896                   point: event.point
25897                 });
25898                 const comparator = event.getLeftmostComparator(prevEvent);
25899                 nextEvent = availableLEs.sort(comparator)[0].otherSE;
25900                 break;
25901               }
25902             }
25903             ringsOut.push(new _RingOut(events));
25904           }
25905           return ringsOut;
25906         }
25907         getGeom() {
25908           let prevPt = this.events[0].point;
25909           const points = [prevPt];
25910           for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
25911             const pt22 = this.events[i3].point;
25912             const nextPt2 = this.events[i3 + 1].point;
25913             if (precision.orient(pt22, prevPt, nextPt2) === 0) continue;
25914             points.push(pt22);
25915             prevPt = pt22;
25916           }
25917           if (points.length === 1) return null;
25918           const pt2 = points[0];
25919           const nextPt = points[1];
25920           if (precision.orient(pt2, prevPt, nextPt) === 0) points.shift();
25921           points.push(points[0]);
25922           const step = this.isExteriorRing() ? 1 : -1;
25923           const iStart = this.isExteriorRing() ? 0 : points.length - 1;
25924           const iEnd = this.isExteriorRing() ? points.length : -1;
25925           const orderedPoints = [];
25926           for (let i3 = iStart; i3 != iEnd; i3 += step)
25927             orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
25928           return orderedPoints;
25929         }
25930         isExteriorRing() {
25931           if (this._isExteriorRing === void 0) {
25932             const enclosing = this.enclosingRing();
25933             this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
25934           }
25935           return this._isExteriorRing;
25936         }
25937         enclosingRing() {
25938           if (this._enclosingRing === void 0) {
25939             this._enclosingRing = this._calcEnclosingRing();
25940           }
25941           return this._enclosingRing;
25942         }
25943         /* Returns the ring that encloses this one, if any */
25944         _calcEnclosingRing() {
25945           var _a4, _b2;
25946           let leftMostEvt = this.events[0];
25947           for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
25948             const evt = this.events[i3];
25949             if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
25950           }
25951           let prevSeg = leftMostEvt.segment.prevInResult();
25952           let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
25953           while (true) {
25954             if (!prevSeg) return null;
25955             if (!prevPrevSeg) return prevSeg.ringOut;
25956             if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
25957               if (((_a4 = prevPrevSeg.ringOut) == null ? void 0 : _a4.enclosingRing()) !== prevSeg.ringOut) {
25958                 return prevSeg.ringOut;
25959               } else return (_b2 = prevSeg.ringOut) == null ? void 0 : _b2.enclosingRing();
25960             }
25961             prevSeg = prevPrevSeg.prevInResult();
25962             prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
25963           }
25964         }
25965       };
25966       PolyOut = class {
25967         constructor(exteriorRing) {
25968           __publicField(this, "exteriorRing");
25969           __publicField(this, "interiorRings");
25970           this.exteriorRing = exteriorRing;
25971           exteriorRing.poly = this;
25972           this.interiorRings = [];
25973         }
25974         addInterior(ring) {
25975           this.interiorRings.push(ring);
25976           ring.poly = this;
25977         }
25978         getGeom() {
25979           const geom0 = this.exteriorRing.getGeom();
25980           if (geom0 === null) return null;
25981           const geom = [geom0];
25982           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
25983             const ringGeom = this.interiorRings[i3].getGeom();
25984             if (ringGeom === null) continue;
25985             geom.push(ringGeom);
25986           }
25987           return geom;
25988         }
25989       };
25990       MultiPolyOut = class {
25991         constructor(rings) {
25992           __publicField(this, "rings");
25993           __publicField(this, "polys");
25994           this.rings = rings;
25995           this.polys = this._composePolys(rings);
25996         }
25997         getGeom() {
25998           const geom = [];
25999           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26000             const polyGeom = this.polys[i3].getGeom();
26001             if (polyGeom === null) continue;
26002             geom.push(polyGeom);
26003           }
26004           return geom;
26005         }
26006         _composePolys(rings) {
26007           var _a4;
26008           const polys = [];
26009           for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
26010             const ring = rings[i3];
26011             if (ring.poly) continue;
26012             if (ring.isExteriorRing()) polys.push(new PolyOut(ring));
26013             else {
26014               const enclosingRing = ring.enclosingRing();
26015               if (!(enclosingRing == null ? void 0 : enclosingRing.poly)) polys.push(new PolyOut(enclosingRing));
26016               (_a4 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a4.addInterior(ring);
26017             }
26018           }
26019           return polys;
26020         }
26021       };
26022       SweepLine = class {
26023         constructor(queue, comparator = Segment.compare) {
26024           __publicField(this, "queue");
26025           __publicField(this, "tree");
26026           __publicField(this, "segments");
26027           this.queue = queue;
26028           this.tree = new SplayTreeSet(comparator);
26029           this.segments = [];
26030         }
26031         process(event) {
26032           const segment = event.segment;
26033           const newEvents = [];
26034           if (event.consumedBy) {
26035             if (event.isLeft) this.queue.delete(event.otherSE);
26036             else this.tree.delete(segment);
26037             return newEvents;
26038           }
26039           if (event.isLeft) this.tree.add(segment);
26040           let prevSeg = segment;
26041           let nextSeg = segment;
26042           do {
26043             prevSeg = this.tree.lastBefore(prevSeg);
26044           } while (prevSeg != null && prevSeg.consumedBy != void 0);
26045           do {
26046             nextSeg = this.tree.firstAfter(nextSeg);
26047           } while (nextSeg != null && nextSeg.consumedBy != void 0);
26048           if (event.isLeft) {
26049             let prevMySplitter = null;
26050             if (prevSeg) {
26051               const prevInter = prevSeg.getIntersection(segment);
26052               if (prevInter !== null) {
26053                 if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
26054                 if (!prevSeg.isAnEndpoint(prevInter)) {
26055                   const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
26056                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26057                     newEvents.push(newEventsFromSplit[i3]);
26058                   }
26059                 }
26060               }
26061             }
26062             let nextMySplitter = null;
26063             if (nextSeg) {
26064               const nextInter = nextSeg.getIntersection(segment);
26065               if (nextInter !== null) {
26066                 if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
26067                 if (!nextSeg.isAnEndpoint(nextInter)) {
26068                   const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
26069                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26070                     newEvents.push(newEventsFromSplit[i3]);
26071                   }
26072                 }
26073               }
26074             }
26075             if (prevMySplitter !== null || nextMySplitter !== null) {
26076               let mySplitter = null;
26077               if (prevMySplitter === null) mySplitter = nextMySplitter;
26078               else if (nextMySplitter === null) mySplitter = prevMySplitter;
26079               else {
26080                 const cmpSplitters = SweepEvent.comparePoints(
26081                   prevMySplitter,
26082                   nextMySplitter
26083                 );
26084                 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
26085               }
26086               this.queue.delete(segment.rightSE);
26087               newEvents.push(segment.rightSE);
26088               const newEventsFromSplit = segment.split(mySplitter);
26089               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26090                 newEvents.push(newEventsFromSplit[i3]);
26091               }
26092             }
26093             if (newEvents.length > 0) {
26094               this.tree.delete(segment);
26095               newEvents.push(event);
26096             } else {
26097               this.segments.push(segment);
26098               segment.prev = prevSeg;
26099             }
26100           } else {
26101             if (prevSeg && nextSeg) {
26102               const inter = prevSeg.getIntersection(nextSeg);
26103               if (inter !== null) {
26104                 if (!prevSeg.isAnEndpoint(inter)) {
26105                   const newEventsFromSplit = this._splitSafely(prevSeg, inter);
26106                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26107                     newEvents.push(newEventsFromSplit[i3]);
26108                   }
26109                 }
26110                 if (!nextSeg.isAnEndpoint(inter)) {
26111                   const newEventsFromSplit = this._splitSafely(nextSeg, inter);
26112                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26113                     newEvents.push(newEventsFromSplit[i3]);
26114                   }
26115                 }
26116               }
26117             }
26118             this.tree.delete(segment);
26119           }
26120           return newEvents;
26121         }
26122         /* Safely split a segment that is currently in the datastructures
26123          * IE - a segment other than the one that is currently being processed. */
26124         _splitSafely(seg, pt2) {
26125           this.tree.delete(seg);
26126           const rightSE = seg.rightSE;
26127           this.queue.delete(rightSE);
26128           const newEvents = seg.split(pt2);
26129           newEvents.push(rightSE);
26130           if (seg.consumedBy === void 0) this.tree.add(seg);
26131           return newEvents;
26132         }
26133       };
26134       Operation = class {
26135         constructor() {
26136           __publicField(this, "type");
26137           __publicField(this, "numMultiPolys");
26138         }
26139         run(type2, geom, moreGeoms) {
26140           operation.type = type2;
26141           const multipolys = [new MultiPolyIn(geom, true)];
26142           for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
26143             multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
26144           }
26145           operation.numMultiPolys = multipolys.length;
26146           if (operation.type === "difference") {
26147             const subject = multipolys[0];
26148             let i3 = 1;
26149             while (i3 < multipolys.length) {
26150               if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null) i3++;
26151               else multipolys.splice(i3, 1);
26152             }
26153           }
26154           if (operation.type === "intersection") {
26155             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26156               const mpA = multipolys[i3];
26157               for (let j3 = i3 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
26158                 if (getBboxOverlap(mpA.bbox, multipolys[j3].bbox) === null) return [];
26159               }
26160             }
26161           }
26162           const queue = new SplayTreeSet(SweepEvent.compare);
26163           for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26164             const sweepEvents = multipolys[i3].getSweepEvents();
26165             for (let j3 = 0, jMax = sweepEvents.length; j3 < jMax; j3++) {
26166               queue.add(sweepEvents[j3]);
26167             }
26168           }
26169           const sweepLine = new SweepLine(queue);
26170           let evt = null;
26171           if (queue.size != 0) {
26172             evt = queue.first();
26173             queue.delete(evt);
26174           }
26175           while (evt) {
26176             const newEvents = sweepLine.process(evt);
26177             for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
26178               const evt2 = newEvents[i3];
26179               if (evt2.consumedBy === void 0) queue.add(evt2);
26180             }
26181             if (queue.size != 0) {
26182               evt = queue.first();
26183               queue.delete(evt);
26184             } else {
26185               evt = null;
26186             }
26187           }
26188           precision.reset();
26189           const ringsOut = RingOut.factory(sweepLine.segments);
26190           const result = new MultiPolyOut(ringsOut);
26191           return result.getGeom();
26192         }
26193       };
26194       operation = new Operation();
26195       operation_default = operation;
26196       segmentId = 0;
26197       Segment = class _Segment {
26198         /* Warning: a reference to ringWindings input will be stored,
26199          *  and possibly will be later modified */
26200         constructor(leftSE, rightSE, rings, windings) {
26201           __publicField(this, "id");
26202           __publicField(this, "leftSE");
26203           __publicField(this, "rightSE");
26204           __publicField(this, "rings");
26205           __publicField(this, "windings");
26206           __publicField(this, "ringOut");
26207           __publicField(this, "consumedBy");
26208           __publicField(this, "prev");
26209           __publicField(this, "_prevInResult");
26210           __publicField(this, "_beforeState");
26211           __publicField(this, "_afterState");
26212           __publicField(this, "_isInResult");
26213           this.id = ++segmentId;
26214           this.leftSE = leftSE;
26215           leftSE.segment = this;
26216           leftSE.otherSE = rightSE;
26217           this.rightSE = rightSE;
26218           rightSE.segment = this;
26219           rightSE.otherSE = leftSE;
26220           this.rings = rings;
26221           this.windings = windings;
26222         }
26223         /* This compare() function is for ordering segments in the sweep
26224          * line tree, and does so according to the following criteria:
26225          *
26226          * Consider the vertical line that lies an infinestimal step to the
26227          * right of the right-more of the two left endpoints of the input
26228          * segments. Imagine slowly moving a point up from negative infinity
26229          * in the increasing y direction. Which of the two segments will that
26230          * point intersect first? That segment comes 'before' the other one.
26231          *
26232          * If neither segment would be intersected by such a line, (if one
26233          * or more of the segments are vertical) then the line to be considered
26234          * is directly on the right-more of the two left inputs.
26235          */
26236         static compare(a4, b3) {
26237           const alx = a4.leftSE.point.x;
26238           const blx = b3.leftSE.point.x;
26239           const arx = a4.rightSE.point.x;
26240           const brx = b3.rightSE.point.x;
26241           if (brx.isLessThan(alx)) return 1;
26242           if (arx.isLessThan(blx)) return -1;
26243           const aly = a4.leftSE.point.y;
26244           const bly = b3.leftSE.point.y;
26245           const ary = a4.rightSE.point.y;
26246           const bry = b3.rightSE.point.y;
26247           if (alx.isLessThan(blx)) {
26248             if (bly.isLessThan(aly) && bly.isLessThan(ary)) return 1;
26249             if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary)) return -1;
26250             const aCmpBLeft = a4.comparePoint(b3.leftSE.point);
26251             if (aCmpBLeft < 0) return 1;
26252             if (aCmpBLeft > 0) return -1;
26253             const bCmpARight = b3.comparePoint(a4.rightSE.point);
26254             if (bCmpARight !== 0) return bCmpARight;
26255             return -1;
26256           }
26257           if (alx.isGreaterThan(blx)) {
26258             if (aly.isLessThan(bly) && aly.isLessThan(bry)) return -1;
26259             if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry)) return 1;
26260             const bCmpALeft = b3.comparePoint(a4.leftSE.point);
26261             if (bCmpALeft !== 0) return bCmpALeft;
26262             const aCmpBRight = a4.comparePoint(b3.rightSE.point);
26263             if (aCmpBRight < 0) return 1;
26264             if (aCmpBRight > 0) return -1;
26265             return 1;
26266           }
26267           if (aly.isLessThan(bly)) return -1;
26268           if (aly.isGreaterThan(bly)) return 1;
26269           if (arx.isLessThan(brx)) {
26270             const bCmpARight = b3.comparePoint(a4.rightSE.point);
26271             if (bCmpARight !== 0) return bCmpARight;
26272           }
26273           if (arx.isGreaterThan(brx)) {
26274             const aCmpBRight = a4.comparePoint(b3.rightSE.point);
26275             if (aCmpBRight < 0) return 1;
26276             if (aCmpBRight > 0) return -1;
26277           }
26278           if (!arx.eq(brx)) {
26279             const ay = ary.minus(aly);
26280             const ax = arx.minus(alx);
26281             const by = bry.minus(bly);
26282             const bx = brx.minus(blx);
26283             if (ay.isGreaterThan(ax) && by.isLessThan(bx)) return 1;
26284             if (ay.isLessThan(ax) && by.isGreaterThan(bx)) return -1;
26285           }
26286           if (arx.isGreaterThan(brx)) return 1;
26287           if (arx.isLessThan(brx)) return -1;
26288           if (ary.isLessThan(bry)) return -1;
26289           if (ary.isGreaterThan(bry)) return 1;
26290           if (a4.id < b3.id) return -1;
26291           if (a4.id > b3.id) return 1;
26292           return 0;
26293         }
26294         static fromRing(pt1, pt2, ring) {
26295           let leftPt, rightPt, winding;
26296           const cmpPts = SweepEvent.comparePoints(pt1, pt2);
26297           if (cmpPts < 0) {
26298             leftPt = pt1;
26299             rightPt = pt2;
26300             winding = 1;
26301           } else if (cmpPts > 0) {
26302             leftPt = pt2;
26303             rightPt = pt1;
26304             winding = -1;
26305           } else
26306             throw new Error(
26307               `Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`
26308             );
26309           const leftSE = new SweepEvent(leftPt, true);
26310           const rightSE = new SweepEvent(rightPt, false);
26311           return new _Segment(leftSE, rightSE, [ring], [winding]);
26312         }
26313         /* When a segment is split, the rightSE is replaced with a new sweep event */
26314         replaceRightSE(newRightSE) {
26315           this.rightSE = newRightSE;
26316           this.rightSE.segment = this;
26317           this.rightSE.otherSE = this.leftSE;
26318           this.leftSE.otherSE = this.rightSE;
26319         }
26320         bbox() {
26321           const y12 = this.leftSE.point.y;
26322           const y2 = this.rightSE.point.y;
26323           return {
26324             ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
26325             ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
26326           };
26327         }
26328         /* A vector from the left point to the right */
26329         vector() {
26330           return {
26331             x: this.rightSE.point.x.minus(this.leftSE.point.x),
26332             y: this.rightSE.point.y.minus(this.leftSE.point.y)
26333           };
26334         }
26335         isAnEndpoint(pt2) {
26336           return pt2.x.eq(this.leftSE.point.x) && pt2.y.eq(this.leftSE.point.y) || pt2.x.eq(this.rightSE.point.x) && pt2.y.eq(this.rightSE.point.y);
26337         }
26338         /* Compare this segment with a point.
26339          *
26340          * A point P is considered to be colinear to a segment if there
26341          * exists a distance D such that if we travel along the segment
26342          * from one * endpoint towards the other a distance D, we find
26343          * ourselves at point P.
26344          *
26345          * Return value indicates:
26346          *
26347          *   1: point lies above the segment (to the left of vertical)
26348          *   0: point is colinear to segment
26349          *  -1: point lies below the segment (to the right of vertical)
26350          */
26351         comparePoint(point) {
26352           return precision.orient(this.leftSE.point, point, this.rightSE.point);
26353         }
26354         /**
26355          * Given another segment, returns the first non-trivial intersection
26356          * between the two segments (in terms of sweep line ordering), if it exists.
26357          *
26358          * A 'non-trivial' intersection is one that will cause one or both of the
26359          * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
26360          *
26361          *   * endpoint of segA with endpoint of segB --> trivial
26362          *   * endpoint of segA with point along segB --> non-trivial
26363          *   * endpoint of segB with point along segA --> non-trivial
26364          *   * point along segA with point along segB --> non-trivial
26365          *
26366          * If no non-trivial intersection exists, return null
26367          * Else, return null.
26368          */
26369         getIntersection(other) {
26370           const tBbox = this.bbox();
26371           const oBbox = other.bbox();
26372           const bboxOverlap = getBboxOverlap(tBbox, oBbox);
26373           if (bboxOverlap === null) return null;
26374           const tlp = this.leftSE.point;
26375           const trp = this.rightSE.point;
26376           const olp = other.leftSE.point;
26377           const orp = other.rightSE.point;
26378           const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
26379           const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
26380           const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
26381           const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
26382           if (touchesThisLSE && touchesOtherLSE) {
26383             if (touchesThisRSE && !touchesOtherRSE) return trp;
26384             if (!touchesThisRSE && touchesOtherRSE) return orp;
26385             return null;
26386           }
26387           if (touchesThisLSE) {
26388             if (touchesOtherRSE) {
26389               if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y)) return null;
26390             }
26391             return tlp;
26392           }
26393           if (touchesOtherLSE) {
26394             if (touchesThisRSE) {
26395               if (trp.x.eq(olp.x) && trp.y.eq(olp.y)) return null;
26396             }
26397             return olp;
26398           }
26399           if (touchesThisRSE && touchesOtherRSE) return null;
26400           if (touchesThisRSE) return trp;
26401           if (touchesOtherRSE) return orp;
26402           const pt2 = intersection(tlp, this.vector(), olp, other.vector());
26403           if (pt2 === null) return null;
26404           if (!isInBbox(bboxOverlap, pt2)) return null;
26405           return precision.snap(pt2);
26406         }
26407         /**
26408          * Split the given segment into multiple segments on the given points.
26409          *  * Each existing segment will retain its leftSE and a new rightSE will be
26410          *    generated for it.
26411          *  * A new segment will be generated which will adopt the original segment's
26412          *    rightSE, and a new leftSE will be generated for it.
26413          *  * If there are more than two points given to split on, new segments
26414          *    in the middle will be generated with new leftSE and rightSE's.
26415          *  * An array of the newly generated SweepEvents will be returned.
26416          *
26417          * Warning: input array of points is modified
26418          */
26419         split(point) {
26420           const newEvents = [];
26421           const alreadyLinked = point.events !== void 0;
26422           const newLeftSE = new SweepEvent(point, true);
26423           const newRightSE = new SweepEvent(point, false);
26424           const oldRightSE = this.rightSE;
26425           this.replaceRightSE(newRightSE);
26426           newEvents.push(newRightSE);
26427           newEvents.push(newLeftSE);
26428           const newSeg = new _Segment(
26429             newLeftSE,
26430             oldRightSE,
26431             this.rings.slice(),
26432             this.windings.slice()
26433           );
26434           if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
26435             newSeg.swapEvents();
26436           }
26437           if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
26438             this.swapEvents();
26439           }
26440           if (alreadyLinked) {
26441             newLeftSE.checkForConsuming();
26442             newRightSE.checkForConsuming();
26443           }
26444           return newEvents;
26445         }
26446         /* Swap which event is left and right */
26447         swapEvents() {
26448           const tmpEvt = this.rightSE;
26449           this.rightSE = this.leftSE;
26450           this.leftSE = tmpEvt;
26451           this.leftSE.isLeft = true;
26452           this.rightSE.isLeft = false;
26453           for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
26454             this.windings[i3] *= -1;
26455           }
26456         }
26457         /* Consume another segment. We take their rings under our wing
26458          * and mark them as consumed. Use for perfectly overlapping segments */
26459         consume(other) {
26460           let consumer = this;
26461           let consumee = other;
26462           while (consumer.consumedBy) consumer = consumer.consumedBy;
26463           while (consumee.consumedBy) consumee = consumee.consumedBy;
26464           const cmp = _Segment.compare(consumer, consumee);
26465           if (cmp === 0) return;
26466           if (cmp > 0) {
26467             const tmp = consumer;
26468             consumer = consumee;
26469             consumee = tmp;
26470           }
26471           if (consumer.prev === consumee) {
26472             const tmp = consumer;
26473             consumer = consumee;
26474             consumee = tmp;
26475           }
26476           for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
26477             const ring = consumee.rings[i3];
26478             const winding = consumee.windings[i3];
26479             const index = consumer.rings.indexOf(ring);
26480             if (index === -1) {
26481               consumer.rings.push(ring);
26482               consumer.windings.push(winding);
26483             } else consumer.windings[index] += winding;
26484           }
26485           consumee.rings = null;
26486           consumee.windings = null;
26487           consumee.consumedBy = consumer;
26488           consumee.leftSE.consumedBy = consumer.leftSE;
26489           consumee.rightSE.consumedBy = consumer.rightSE;
26490         }
26491         /* The first segment previous segment chain that is in the result */
26492         prevInResult() {
26493           if (this._prevInResult !== void 0) return this._prevInResult;
26494           if (!this.prev) this._prevInResult = null;
26495           else if (this.prev.isInResult()) this._prevInResult = this.prev;
26496           else this._prevInResult = this.prev.prevInResult();
26497           return this._prevInResult;
26498         }
26499         beforeState() {
26500           if (this._beforeState !== void 0) return this._beforeState;
26501           if (!this.prev)
26502             this._beforeState = {
26503               rings: [],
26504               windings: [],
26505               multiPolys: []
26506             };
26507           else {
26508             const seg = this.prev.consumedBy || this.prev;
26509             this._beforeState = seg.afterState();
26510           }
26511           return this._beforeState;
26512         }
26513         afterState() {
26514           if (this._afterState !== void 0) return this._afterState;
26515           const beforeState = this.beforeState();
26516           this._afterState = {
26517             rings: beforeState.rings.slice(0),
26518             windings: beforeState.windings.slice(0),
26519             multiPolys: []
26520           };
26521           const ringsAfter = this._afterState.rings;
26522           const windingsAfter = this._afterState.windings;
26523           const mpsAfter = this._afterState.multiPolys;
26524           for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
26525             const ring = this.rings[i3];
26526             const winding = this.windings[i3];
26527             const index = ringsAfter.indexOf(ring);
26528             if (index === -1) {
26529               ringsAfter.push(ring);
26530               windingsAfter.push(winding);
26531             } else windingsAfter[index] += winding;
26532           }
26533           const polysAfter = [];
26534           const polysExclude = [];
26535           for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
26536             if (windingsAfter[i3] === 0) continue;
26537             const ring = ringsAfter[i3];
26538             const poly = ring.poly;
26539             if (polysExclude.indexOf(poly) !== -1) continue;
26540             if (ring.isExterior) polysAfter.push(poly);
26541             else {
26542               if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
26543               const index = polysAfter.indexOf(ring.poly);
26544               if (index !== -1) polysAfter.splice(index, 1);
26545             }
26546           }
26547           for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
26548             const mp = polysAfter[i3].multiPoly;
26549             if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
26550           }
26551           return this._afterState;
26552         }
26553         /* Is this segment part of the final result? */
26554         isInResult() {
26555           if (this.consumedBy) return false;
26556           if (this._isInResult !== void 0) return this._isInResult;
26557           const mpsBefore = this.beforeState().multiPolys;
26558           const mpsAfter = this.afterState().multiPolys;
26559           switch (operation_default.type) {
26560             case "union": {
26561               const noBefores = mpsBefore.length === 0;
26562               const noAfters = mpsAfter.length === 0;
26563               this._isInResult = noBefores !== noAfters;
26564               break;
26565             }
26566             case "intersection": {
26567               let least;
26568               let most;
26569               if (mpsBefore.length < mpsAfter.length) {
26570                 least = mpsBefore.length;
26571                 most = mpsAfter.length;
26572               } else {
26573                 least = mpsAfter.length;
26574                 most = mpsBefore.length;
26575               }
26576               this._isInResult = most === operation_default.numMultiPolys && least < most;
26577               break;
26578             }
26579             case "xor": {
26580               const diff = Math.abs(mpsBefore.length - mpsAfter.length);
26581               this._isInResult = diff % 2 === 1;
26582               break;
26583             }
26584             case "difference": {
26585               const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
26586               this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
26587               break;
26588             }
26589           }
26590           return this._isInResult;
26591         }
26592       };
26593       RingIn = class {
26594         constructor(geomRing, poly, isExterior) {
26595           __publicField(this, "poly");
26596           __publicField(this, "isExterior");
26597           __publicField(this, "segments");
26598           __publicField(this, "bbox");
26599           if (!Array.isArray(geomRing) || geomRing.length === 0) {
26600             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26601           }
26602           this.poly = poly;
26603           this.isExterior = isExterior;
26604           this.segments = [];
26605           if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
26606             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26607           }
26608           const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
26609           this.bbox = {
26610             ll: { x: firstPoint.x, y: firstPoint.y },
26611             ur: { x: firstPoint.x, y: firstPoint.y }
26612           };
26613           let prevPoint = firstPoint;
26614           for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
26615             if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
26616               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26617             }
26618             const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
26619             if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y)) continue;
26620             this.segments.push(Segment.fromRing(prevPoint, point, this));
26621             if (point.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = point.x;
26622             if (point.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = point.y;
26623             if (point.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = point.x;
26624             if (point.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = point.y;
26625             prevPoint = point;
26626           }
26627           if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
26628             this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
26629           }
26630         }
26631         getSweepEvents() {
26632           const sweepEvents = [];
26633           for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
26634             const segment = this.segments[i3];
26635             sweepEvents.push(segment.leftSE);
26636             sweepEvents.push(segment.rightSE);
26637           }
26638           return sweepEvents;
26639         }
26640       };
26641       PolyIn = class {
26642         constructor(geomPoly, multiPoly) {
26643           __publicField(this, "multiPoly");
26644           __publicField(this, "exteriorRing");
26645           __publicField(this, "interiorRings");
26646           __publicField(this, "bbox");
26647           if (!Array.isArray(geomPoly)) {
26648             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26649           }
26650           this.exteriorRing = new RingIn(geomPoly[0], this, true);
26651           this.bbox = {
26652             ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
26653             ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
26654           };
26655           this.interiorRings = [];
26656           for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
26657             const ring = new RingIn(geomPoly[i3], this, false);
26658             if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = ring.bbox.ll.x;
26659             if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = ring.bbox.ll.y;
26660             if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = ring.bbox.ur.x;
26661             if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = ring.bbox.ur.y;
26662             this.interiorRings.push(ring);
26663           }
26664           this.multiPoly = multiPoly;
26665         }
26666         getSweepEvents() {
26667           const sweepEvents = this.exteriorRing.getSweepEvents();
26668           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
26669             const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
26670             for (let j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
26671               sweepEvents.push(ringSweepEvents[j3]);
26672             }
26673           }
26674           return sweepEvents;
26675         }
26676       };
26677       MultiPolyIn = class {
26678         constructor(geom, isSubject) {
26679           __publicField(this, "isSubject");
26680           __publicField(this, "polys");
26681           __publicField(this, "bbox");
26682           if (!Array.isArray(geom)) {
26683             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26684           }
26685           try {
26686             if (typeof geom[0][0][0] === "number") geom = [geom];
26687           } catch (ex) {
26688           }
26689           this.polys = [];
26690           this.bbox = {
26691             ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
26692             ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
26693           };
26694           for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
26695             const poly = new PolyIn(geom[i3], this);
26696             if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = poly.bbox.ll.x;
26697             if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = poly.bbox.ll.y;
26698             if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = poly.bbox.ur.x;
26699             if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = poly.bbox.ur.y;
26700             this.polys.push(poly);
26701           }
26702           this.isSubject = isSubject;
26703         }
26704         getSweepEvents() {
26705           const sweepEvents = [];
26706           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26707             const polySweepEvents = this.polys[i3].getSweepEvents();
26708             for (let j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
26709               sweepEvents.push(polySweepEvents[j3]);
26710             }
26711           }
26712           return sweepEvents;
26713         }
26714       };
26715       union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
26716       difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
26717       setPrecision = precision.set;
26718     }
26719   });
26720
26721   // node_modules/wgs84/index.js
26722   var require_wgs84 = __commonJS({
26723     "node_modules/wgs84/index.js"(exports2, module2) {
26724       module2.exports.RADIUS = 6378137;
26725       module2.exports.FLATTENING = 1 / 298.257223563;
26726       module2.exports.POLAR_RADIUS = 63567523142e-4;
26727     }
26728   });
26729
26730   // node_modules/@mapbox/geojson-area/index.js
26731   var require_geojson_area = __commonJS({
26732     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
26733       var wgs84 = require_wgs84();
26734       module2.exports.geometry = geometry;
26735       module2.exports.ring = ringArea;
26736       function geometry(_3) {
26737         var area = 0, i3;
26738         switch (_3.type) {
26739           case "Polygon":
26740             return polygonArea(_3.coordinates);
26741           case "MultiPolygon":
26742             for (i3 = 0; i3 < _3.coordinates.length; i3++) {
26743               area += polygonArea(_3.coordinates[i3]);
26744             }
26745             return area;
26746           case "Point":
26747           case "MultiPoint":
26748           case "LineString":
26749           case "MultiLineString":
26750             return 0;
26751           case "GeometryCollection":
26752             for (i3 = 0; i3 < _3.geometries.length; i3++) {
26753               area += geometry(_3.geometries[i3]);
26754             }
26755             return area;
26756         }
26757       }
26758       function polygonArea(coords) {
26759         var area = 0;
26760         if (coords && coords.length > 0) {
26761           area += Math.abs(ringArea(coords[0]));
26762           for (var i3 = 1; i3 < coords.length; i3++) {
26763             area -= Math.abs(ringArea(coords[i3]));
26764           }
26765         }
26766         return area;
26767       }
26768       function ringArea(coords) {
26769         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
26770         if (coordsLength > 2) {
26771           for (i3 = 0; i3 < coordsLength; i3++) {
26772             if (i3 === coordsLength - 2) {
26773               lowerIndex = coordsLength - 2;
26774               middleIndex = coordsLength - 1;
26775               upperIndex = 0;
26776             } else if (i3 === coordsLength - 1) {
26777               lowerIndex = coordsLength - 1;
26778               middleIndex = 0;
26779               upperIndex = 1;
26780             } else {
26781               lowerIndex = i3;
26782               middleIndex = i3 + 1;
26783               upperIndex = i3 + 2;
26784             }
26785             p1 = coords[lowerIndex];
26786             p2 = coords[middleIndex];
26787             p3 = coords[upperIndex];
26788             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
26789           }
26790           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
26791         }
26792         return area;
26793       }
26794       function rad(_3) {
26795         return _3 * Math.PI / 180;
26796       }
26797     }
26798   });
26799
26800   // node_modules/circle-to-polygon/input-validation/validateCenter.js
26801   var require_validateCenter = __commonJS({
26802     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
26803       exports2.validateCenter = function validateCenter(center) {
26804         var validCenterLengths = [2, 3];
26805         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
26806           throw new Error("ERROR! Center has to be an array of length two or three");
26807         }
26808         var [lng, lat] = center;
26809         if (typeof lng !== "number" || typeof lat !== "number") {
26810           throw new Error(
26811             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
26812           );
26813         }
26814         if (lng > 180 || lng < -180) {
26815           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
26816         }
26817         if (lat > 90 || lat < -90) {
26818           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
26819         }
26820       };
26821     }
26822   });
26823
26824   // node_modules/circle-to-polygon/input-validation/validateRadius.js
26825   var require_validateRadius = __commonJS({
26826     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
26827       exports2.validateRadius = function validateRadius(radius) {
26828         if (typeof radius !== "number") {
26829           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
26830         }
26831         if (radius <= 0) {
26832           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
26833         }
26834       };
26835     }
26836   });
26837
26838   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
26839   var require_validateNumberOfEdges = __commonJS({
26840     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
26841       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
26842         if (typeof numberOfEdges !== "number") {
26843           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
26844           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
26845         }
26846         if (numberOfEdges < 3) {
26847           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
26848         }
26849       };
26850     }
26851   });
26852
26853   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
26854   var require_validateEarthRadius = __commonJS({
26855     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
26856       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
26857         if (typeof earthRadius2 !== "number") {
26858           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
26859           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
26860         }
26861         if (earthRadius2 <= 0) {
26862           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
26863         }
26864       };
26865     }
26866   });
26867
26868   // node_modules/circle-to-polygon/input-validation/validateBearing.js
26869   var require_validateBearing = __commonJS({
26870     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
26871       exports2.validateBearing = function validateBearing(bearing) {
26872         if (typeof bearing !== "number") {
26873           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
26874           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
26875         }
26876       };
26877     }
26878   });
26879
26880   // node_modules/circle-to-polygon/input-validation/index.js
26881   var require_input_validation = __commonJS({
26882     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
26883       var validateCenter = require_validateCenter().validateCenter;
26884       var validateRadius = require_validateRadius().validateRadius;
26885       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
26886       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
26887       var validateBearing = require_validateBearing().validateBearing;
26888       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
26889         validateCenter(center);
26890         validateRadius(radius);
26891         validateNumberOfEdges(numberOfEdges);
26892         validateEarthRadius(earthRadius2);
26893         validateBearing(bearing);
26894       }
26895       exports2.validateCenter = validateCenter;
26896       exports2.validateRadius = validateRadius;
26897       exports2.validateNumberOfEdges = validateNumberOfEdges;
26898       exports2.validateEarthRadius = validateEarthRadius;
26899       exports2.validateBearing = validateBearing;
26900       exports2.validateInput = validateInput;
26901     }
26902   });
26903
26904   // node_modules/circle-to-polygon/index.js
26905   var require_circle_to_polygon = __commonJS({
26906     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
26907       "use strict";
26908       var { validateInput } = require_input_validation();
26909       var defaultEarthRadius = 6378137;
26910       function toRadians(angleInDegrees) {
26911         return angleInDegrees * Math.PI / 180;
26912       }
26913       function toDegrees(angleInRadians) {
26914         return angleInRadians * 180 / Math.PI;
26915       }
26916       function offset(c1, distance, earthRadius2, bearing) {
26917         var lat1 = toRadians(c1[1]);
26918         var lon1 = toRadians(c1[0]);
26919         var dByR = distance / earthRadius2;
26920         var lat = Math.asin(
26921           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
26922         );
26923         var lon = lon1 + Math.atan2(
26924           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
26925           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
26926         );
26927         return [toDegrees(lon), toDegrees(lat)];
26928       }
26929       module2.exports = function circleToPolygon2(center, radius, options) {
26930         var n3 = getNumberOfEdges(options);
26931         var earthRadius2 = getEarthRadius(options);
26932         var bearing = getBearing(options);
26933         var direction = getDirection(options);
26934         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
26935         var start2 = toRadians(bearing);
26936         var coordinates = [];
26937         for (var i3 = 0; i3 < n3; ++i3) {
26938           coordinates.push(
26939             offset(
26940               center,
26941               radius,
26942               earthRadius2,
26943               start2 + direction * 2 * Math.PI * -i3 / n3
26944             )
26945           );
26946         }
26947         coordinates.push(coordinates[0]);
26948         return {
26949           type: "Polygon",
26950           coordinates: [coordinates]
26951         };
26952       };
26953       function getNumberOfEdges(options) {
26954         if (isUndefinedOrNull(options)) {
26955           return 32;
26956         } else if (isObjectNotArray(options)) {
26957           var numberOfEdges = options.numberOfEdges;
26958           return numberOfEdges === void 0 ? 32 : numberOfEdges;
26959         }
26960         return options;
26961       }
26962       function getEarthRadius(options) {
26963         if (isUndefinedOrNull(options)) {
26964           return defaultEarthRadius;
26965         } else if (isObjectNotArray(options)) {
26966           var earthRadius2 = options.earthRadius;
26967           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
26968         }
26969         return defaultEarthRadius;
26970       }
26971       function getDirection(options) {
26972         if (isObjectNotArray(options) && options.rightHandRule) {
26973           return -1;
26974         }
26975         return 1;
26976       }
26977       function getBearing(options) {
26978         if (isUndefinedOrNull(options)) {
26979           return 0;
26980         } else if (isObjectNotArray(options)) {
26981           var bearing = options.bearing;
26982           return bearing === void 0 ? 0 : bearing;
26983         }
26984         return 0;
26985       }
26986       function isObjectNotArray(argument) {
26987         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
26988       }
26989       function isUndefinedOrNull(argument) {
26990         return argument === null || argument === void 0;
26991       }
26992     }
26993   });
26994
26995   // node_modules/geojson-precision/index.js
26996   var require_geojson_precision = __commonJS({
26997     "node_modules/geojson-precision/index.js"(exports2, module2) {
26998       (function() {
26999         function parse(t2, coordinatePrecision, extrasPrecision) {
27000           function point(p2) {
27001             return p2.map(function(e3, index) {
27002               if (index < 2) {
27003                 return 1 * e3.toFixed(coordinatePrecision);
27004               } else {
27005                 return 1 * e3.toFixed(extrasPrecision);
27006               }
27007             });
27008           }
27009           function multi(l2) {
27010             return l2.map(point);
27011           }
27012           function poly(p2) {
27013             return p2.map(multi);
27014           }
27015           function multiPoly(m3) {
27016             return m3.map(poly);
27017           }
27018           function geometry(obj) {
27019             if (!obj) {
27020               return {};
27021             }
27022             switch (obj.type) {
27023               case "Point":
27024                 obj.coordinates = point(obj.coordinates);
27025                 return obj;
27026               case "LineString":
27027               case "MultiPoint":
27028                 obj.coordinates = multi(obj.coordinates);
27029                 return obj;
27030               case "Polygon":
27031               case "MultiLineString":
27032                 obj.coordinates = poly(obj.coordinates);
27033                 return obj;
27034               case "MultiPolygon":
27035                 obj.coordinates = multiPoly(obj.coordinates);
27036                 return obj;
27037               case "GeometryCollection":
27038                 obj.geometries = obj.geometries.map(geometry);
27039                 return obj;
27040               default:
27041                 return {};
27042             }
27043           }
27044           function feature3(obj) {
27045             obj.geometry = geometry(obj.geometry);
27046             return obj;
27047           }
27048           function featureCollection(f2) {
27049             f2.features = f2.features.map(feature3);
27050             return f2;
27051           }
27052           function geometryCollection(g3) {
27053             g3.geometries = g3.geometries.map(geometry);
27054             return g3;
27055           }
27056           if (!t2) {
27057             return t2;
27058           }
27059           switch (t2.type) {
27060             case "Feature":
27061               return feature3(t2);
27062             case "GeometryCollection":
27063               return geometryCollection(t2);
27064             case "FeatureCollection":
27065               return featureCollection(t2);
27066             case "Point":
27067             case "LineString":
27068             case "Polygon":
27069             case "MultiPoint":
27070             case "MultiPolygon":
27071             case "MultiLineString":
27072               return geometry(t2);
27073             default:
27074               return t2;
27075           }
27076         }
27077         module2.exports = parse;
27078         module2.exports.parse = parse;
27079       })();
27080     }
27081   });
27082
27083   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
27084   var require_json_stringify_pretty_compact = __commonJS({
27085     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
27086       function isObject2(obj) {
27087         return typeof obj === "object" && obj !== null;
27088       }
27089       function forEach(obj, cb) {
27090         if (Array.isArray(obj)) {
27091           obj.forEach(cb);
27092         } else if (isObject2(obj)) {
27093           Object.keys(obj).forEach(function(key) {
27094             var val = obj[key];
27095             cb(val, key);
27096           });
27097         }
27098       }
27099       function getTreeDepth(obj) {
27100         var depth = 0;
27101         if (Array.isArray(obj) || isObject2(obj)) {
27102           forEach(obj, function(val) {
27103             if (Array.isArray(val) || isObject2(val)) {
27104               var tmpDepth = getTreeDepth(val);
27105               if (tmpDepth > depth) {
27106                 depth = tmpDepth;
27107               }
27108             }
27109           });
27110           return depth + 1;
27111         }
27112         return depth;
27113       }
27114       function stringify3(obj, options) {
27115         options = options || {};
27116         var indent = JSON.stringify([1], null, get4(options, "indent", 2)).slice(2, -3);
27117         var addMargin = get4(options, "margins", false);
27118         var addArrayMargin = get4(options, "arrayMargins", false);
27119         var addObjectMargin = get4(options, "objectMargins", false);
27120         var maxLength = indent === "" ? Infinity : get4(options, "maxLength", 80);
27121         var maxNesting = get4(options, "maxNesting", Infinity);
27122         return function _stringify(obj2, currentIndent, reserved) {
27123           if (obj2 && typeof obj2.toJSON === "function") {
27124             obj2 = obj2.toJSON();
27125           }
27126           var string = JSON.stringify(obj2);
27127           if (string === void 0) {
27128             return string;
27129           }
27130           var length2 = maxLength - currentIndent.length - reserved;
27131           var treeDepth = getTreeDepth(obj2);
27132           if (treeDepth <= maxNesting && string.length <= length2) {
27133             var prettified = prettify(string, {
27134               addMargin,
27135               addArrayMargin,
27136               addObjectMargin
27137             });
27138             if (prettified.length <= length2) {
27139               return prettified;
27140             }
27141           }
27142           if (isObject2(obj2)) {
27143             var nextIndent = currentIndent + indent;
27144             var items = [];
27145             var delimiters;
27146             var comma = function(array2, index2) {
27147               return index2 === array2.length - 1 ? 0 : 1;
27148             };
27149             if (Array.isArray(obj2)) {
27150               for (var index = 0; index < obj2.length; index++) {
27151                 items.push(
27152                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
27153                 );
27154               }
27155               delimiters = "[]";
27156             } else {
27157               Object.keys(obj2).forEach(function(key, index2, array2) {
27158                 var keyPart = JSON.stringify(key) + ": ";
27159                 var value = _stringify(
27160                   obj2[key],
27161                   nextIndent,
27162                   keyPart.length + comma(array2, index2)
27163                 );
27164                 if (value !== void 0) {
27165                   items.push(keyPart + value);
27166                 }
27167               });
27168               delimiters = "{}";
27169             }
27170             if (items.length > 0) {
27171               return [
27172                 delimiters[0],
27173                 indent + items.join(",\n" + nextIndent),
27174                 delimiters[1]
27175               ].join("\n" + currentIndent);
27176             }
27177           }
27178           return string;
27179         }(obj, "", 0);
27180       }
27181       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
27182       function prettify(string, options) {
27183         options = options || {};
27184         var tokens = {
27185           "{": "{",
27186           "}": "}",
27187           "[": "[",
27188           "]": "]",
27189           ",": ", ",
27190           ":": ": "
27191         };
27192         if (options.addMargin || options.addObjectMargin) {
27193           tokens["{"] = "{ ";
27194           tokens["}"] = " }";
27195         }
27196         if (options.addMargin || options.addArrayMargin) {
27197           tokens["["] = "[ ";
27198           tokens["]"] = " ]";
27199         }
27200         return string.replace(stringOrChar, function(match, string2) {
27201           return string2 ? match : tokens[match];
27202         });
27203       }
27204       function get4(options, name, defaultValue) {
27205         return name in options ? options[name] : defaultValue;
27206       }
27207       module2.exports = stringify3;
27208     }
27209   });
27210
27211   // node_modules/@rapideditor/location-conflation/index.mjs
27212   function _clip(features, which) {
27213     if (!Array.isArray(features) || !features.length) return null;
27214     const fn = { UNION: union, DIFFERENCE: difference }[which];
27215     const args = features.map((feature3) => feature3.geometry.coordinates);
27216     const coords = fn.apply(null, args);
27217     return {
27218       type: "Feature",
27219       properties: {},
27220       geometry: {
27221         type: whichType(coords),
27222         coordinates: coords
27223       }
27224     };
27225     function whichType(coords2) {
27226       const a4 = Array.isArray(coords2);
27227       const b3 = a4 && Array.isArray(coords2[0]);
27228       const c2 = b3 && Array.isArray(coords2[0][0]);
27229       const d2 = c2 && Array.isArray(coords2[0][0][0]);
27230       return d2 ? "MultiPolygon" : "Polygon";
27231     }
27232   }
27233   function _cloneDeep(obj) {
27234     return JSON.parse(JSON.stringify(obj));
27235   }
27236   function _sortLocations(a4, b3) {
27237     const rank = { countrycoder: 1, geojson: 2, point: 3 };
27238     const aRank = rank[a4.type];
27239     const bRank = rank[b3.type];
27240     return aRank > bRank ? 1 : aRank < bRank ? -1 : a4.id.localeCompare(b3.id);
27241   }
27242   var import_geojson_area, import_circle_to_polygon, import_geojson_precision, import_json_stringify_pretty_compact, LocationConflation;
27243   var init_location_conflation = __esm({
27244     "node_modules/@rapideditor/location-conflation/index.mjs"() {
27245       init_country_coder();
27246       init_esm2();
27247       import_geojson_area = __toESM(require_geojson_area(), 1);
27248       import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
27249       import_geojson_precision = __toESM(require_geojson_precision(), 1);
27250       import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
27251       LocationConflation = class {
27252         // constructor
27253         //
27254         // `fc`  Optional FeatureCollection of known features
27255         //
27256         // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
27257         // Each feature must have a filename-like `id`, for example: `something.geojson`
27258         //
27259         // {
27260         //   "type": "FeatureCollection"
27261         //   "features": [
27262         //     {
27263         //       "type": "Feature",
27264         //       "id": "philly_metro.geojson",
27265         //       "properties": { … },
27266         //       "geometry": { … }
27267         //     }
27268         //   ]
27269         // }
27270         constructor(fc) {
27271           this._cache = {};
27272           this.strict = true;
27273           if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
27274             fc.features.forEach((feature3) => {
27275               feature3.properties = feature3.properties || {};
27276               let props = feature3.properties;
27277               let id2 = feature3.id || props.id;
27278               if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
27279               id2 = id2.toLowerCase();
27280               feature3.id = id2;
27281               props.id = id2;
27282               if (!props.area) {
27283                 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
27284                 props.area = Number(area.toFixed(2));
27285               }
27286               this._cache[id2] = feature3;
27287             });
27288           }
27289           let world = _cloneDeep(feature("Q2"));
27290           world.geometry = {
27291             type: "Polygon",
27292             coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
27293           };
27294           world.id = "Q2";
27295           world.properties.id = "Q2";
27296           world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
27297           this._cache.Q2 = world;
27298         }
27299         // validateLocation
27300         // `location`  The location to validate
27301         //
27302         // Pass a `location` value to validate
27303         //
27304         // Returns a result like:
27305         //   {
27306         //     type:     'point', 'geojson', or 'countrycoder'
27307         //     location:  the queried location
27308         //     id:        the stable identifier for the feature
27309         //   }
27310         // or `null` if the location is invalid
27311         //
27312         validateLocation(location) {
27313           if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
27314             const lon = location[0];
27315             const lat = location[1];
27316             const radius = location[2];
27317             if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
27318               const id2 = "[" + location.toString() + "]";
27319               return { type: "point", location, id: id2 };
27320             }
27321           } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
27322             const id2 = location.toLowerCase();
27323             if (this._cache[id2]) {
27324               return { type: "geojson", location, id: id2 };
27325             }
27326           } else if (typeof location === "string" || typeof location === "number") {
27327             const feature3 = feature(location);
27328             if (feature3) {
27329               const id2 = feature3.properties.wikidata;
27330               return { type: "countrycoder", location, id: id2 };
27331             }
27332           }
27333           if (this.strict) {
27334             throw new Error(`validateLocation:  Invalid location: "${location}".`);
27335           } else {
27336             return null;
27337           }
27338         }
27339         // resolveLocation
27340         // `location`  The location to resolve
27341         //
27342         // Pass a `location` value to resolve
27343         //
27344         // Returns a result like:
27345         //   {
27346         //     type:      'point', 'geojson', or 'countrycoder'
27347         //     location:  the queried location
27348         //     id:        a stable identifier for the feature
27349         //     feature:   the resolved GeoJSON feature
27350         //   }
27351         //  or `null` if the location is invalid
27352         //
27353         resolveLocation(location) {
27354           const valid = this.validateLocation(location);
27355           if (!valid) return null;
27356           const id2 = valid.id;
27357           if (this._cache[id2]) {
27358             return Object.assign(valid, { feature: this._cache[id2] });
27359           }
27360           if (valid.type === "point") {
27361             const lon = location[0];
27362             const lat = location[1];
27363             const radius = location[2] || 25;
27364             const EDGES = 10;
27365             const PRECISION = 3;
27366             const area = Math.PI * radius * radius;
27367             const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
27368               type: "Feature",
27369               id: id2,
27370               properties: { id: id2, area: Number(area.toFixed(2)) },
27371               geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
27372               // km to m
27373             }, PRECISION);
27374             return Object.assign(valid, { feature: feature3 });
27375           } else if (valid.type === "geojson") {
27376           } else if (valid.type === "countrycoder") {
27377             let feature3 = _cloneDeep(feature(id2));
27378             let props = feature3.properties;
27379             if (Array.isArray(props.members)) {
27380               let aggregate = aggregateFeature(id2);
27381               aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
27382               feature3.geometry = aggregate.geometry;
27383             }
27384             if (!props.area) {
27385               const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
27386               props.area = Number(area.toFixed(2));
27387             }
27388             feature3.id = id2;
27389             props.id = id2;
27390             this._cache[id2] = feature3;
27391             return Object.assign(valid, { feature: feature3 });
27392           }
27393           if (this.strict) {
27394             throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
27395           } else {
27396             return null;
27397           }
27398         }
27399         // validateLocationSet
27400         // `locationSet`  the locationSet to validate
27401         //
27402         // Pass a locationSet Object to validate like:
27403         //   {
27404         //     include: [ Array of locations ],
27405         //     exclude: [ Array of locations ]
27406         //   }
27407         //
27408         // Returns a result like:
27409         //   {
27410         //     type:         'locationset'
27411         //     locationSet:  the queried locationSet
27412         //     id:           the stable identifier for the feature
27413         //   }
27414         // or `null` if the locationSet is invalid
27415         //
27416         validateLocationSet(locationSet) {
27417           locationSet = locationSet || {};
27418           const validator = this.validateLocation.bind(this);
27419           let include = (locationSet.include || []).map(validator).filter(Boolean);
27420           let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
27421           if (!include.length) {
27422             if (this.strict) {
27423               throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
27424             } else {
27425               locationSet.include = ["Q2"];
27426               include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
27427             }
27428           }
27429           include.sort(_sortLocations);
27430           let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
27431           if (exclude.length) {
27432             exclude.sort(_sortLocations);
27433             id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
27434           }
27435           return { type: "locationset", locationSet, id: id2 };
27436         }
27437         // resolveLocationSet
27438         // `locationSet`  the locationSet to resolve
27439         //
27440         // Pass a locationSet Object to validate like:
27441         //   {
27442         //     include: [ Array of locations ],
27443         //     exclude: [ Array of locations ]
27444         //   }
27445         //
27446         // Returns a result like:
27447         //   {
27448         //     type:         'locationset'
27449         //     locationSet:  the queried locationSet
27450         //     id:           the stable identifier for the feature
27451         //     feature:      the resolved GeoJSON feature
27452         //   }
27453         // or `null` if the locationSet is invalid
27454         //
27455         resolveLocationSet(locationSet) {
27456           locationSet = locationSet || {};
27457           const valid = this.validateLocationSet(locationSet);
27458           if (!valid) return null;
27459           const id2 = valid.id;
27460           if (this._cache[id2]) {
27461             return Object.assign(valid, { feature: this._cache[id2] });
27462           }
27463           const resolver = this.resolveLocation.bind(this);
27464           const includes = (locationSet.include || []).map(resolver).filter(Boolean);
27465           const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
27466           if (includes.length === 1 && excludes.length === 0) {
27467             return Object.assign(valid, { feature: includes[0].feature });
27468           }
27469           const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
27470           const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
27471           let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
27472           const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
27473           resultGeoJSON.id = id2;
27474           resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
27475           this._cache[id2] = resultGeoJSON;
27476           return Object.assign(valid, { feature: resultGeoJSON });
27477         }
27478         // stringify
27479         // convenience method to prettyStringify the given object
27480         stringify(obj, options) {
27481           return (0, import_json_stringify_pretty_compact.default)(obj, options);
27482         }
27483       };
27484     }
27485   });
27486
27487   // modules/core/LocationManager.js
27488   var LocationManager_exports = {};
27489   __export(LocationManager_exports, {
27490     LocationManager: () => LocationManager,
27491     locationManager: () => _sharedLocationManager
27492   });
27493   var import_which_polygon2, import_geojson_area2, _loco, LocationManager, _sharedLocationManager;
27494   var init_LocationManager = __esm({
27495     "modules/core/LocationManager.js"() {
27496       "use strict";
27497       init_location_conflation();
27498       import_which_polygon2 = __toESM(require_which_polygon());
27499       import_geojson_area2 = __toESM(require_geojson_area());
27500       _loco = new LocationConflation();
27501       LocationManager = class {
27502         /**
27503          * @constructor
27504          */
27505         constructor() {
27506           this._wp = null;
27507           this._resolved = /* @__PURE__ */ new Map();
27508           this._knownLocationSets = /* @__PURE__ */ new Map();
27509           this._locationIncludedIn = /* @__PURE__ */ new Map();
27510           this._locationExcludedIn = /* @__PURE__ */ new Map();
27511           const world = { locationSet: { include: ["Q2"] } };
27512           this._resolveLocationSet(world);
27513           this._rebuildIndex();
27514         }
27515         /**
27516          * _validateLocationSet
27517          * Pass an Object with a `locationSet` property.
27518          * Validates the `locationSet` and sets a `locationSetID` property on the object.
27519          * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
27520          *
27521          * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
27522          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
27523          *
27524          * @param  `obj`  Object to check, it should have `locationSet` property
27525          */
27526         _validateLocationSet(obj) {
27527           if (obj.locationSetID) return;
27528           try {
27529             let locationSet = obj.locationSet;
27530             if (!locationSet) {
27531               throw new Error("object missing locationSet property");
27532             }
27533             if (!locationSet.include) {
27534               locationSet.include = ["Q2"];
27535             }
27536             const locationSetID = _loco.validateLocationSet(locationSet).id;
27537             obj.locationSetID = locationSetID;
27538             if (this._knownLocationSets.has(locationSetID)) return;
27539             let area = 0;
27540             (locationSet.include || []).forEach((location) => {
27541               const locationID = _loco.validateLocation(location).id;
27542               let geojson = this._resolved.get(locationID);
27543               if (!geojson) {
27544                 geojson = _loco.resolveLocation(location).feature;
27545                 this._resolved.set(locationID, geojson);
27546               }
27547               area += geojson.properties.area;
27548               let s2 = this._locationIncludedIn.get(locationID);
27549               if (!s2) {
27550                 s2 = /* @__PURE__ */ new Set();
27551                 this._locationIncludedIn.set(locationID, s2);
27552               }
27553               s2.add(locationSetID);
27554             });
27555             (locationSet.exclude || []).forEach((location) => {
27556               const locationID = _loco.validateLocation(location).id;
27557               let geojson = this._resolved.get(locationID);
27558               if (!geojson) {
27559                 geojson = _loco.resolveLocation(location).feature;
27560                 this._resolved.set(locationID, geojson);
27561               }
27562               area -= geojson.properties.area;
27563               let s2 = this._locationExcludedIn.get(locationID);
27564               if (!s2) {
27565                 s2 = /* @__PURE__ */ new Set();
27566                 this._locationExcludedIn.set(locationID, s2);
27567               }
27568               s2.add(locationSetID);
27569             });
27570             this._knownLocationSets.set(locationSetID, area);
27571           } catch {
27572             obj.locationSet = { include: ["Q2"] };
27573             obj.locationSetID = "+[Q2]";
27574           }
27575         }
27576         /**
27577          * _resolveLocationSet
27578          * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
27579          * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
27580          *
27581          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
27582          *
27583          * @param  `obj`  Object to check, it should have `locationSet` property
27584          */
27585         _resolveLocationSet(obj) {
27586           this._validateLocationSet(obj);
27587           if (this._resolved.has(obj.locationSetID)) return;
27588           try {
27589             const result = _loco.resolveLocationSet(obj.locationSet);
27590             const locationSetID = result.id;
27591             obj.locationSetID = locationSetID;
27592             if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
27593               throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
27594             }
27595             let geojson = JSON.parse(JSON.stringify(result.feature));
27596             geojson.id = locationSetID;
27597             geojson.properties.id = locationSetID;
27598             this._resolved.set(locationSetID, geojson);
27599           } catch {
27600             obj.locationSet = { include: ["Q2"] };
27601             obj.locationSetID = "+[Q2]";
27602           }
27603         }
27604         /**
27605          * _rebuildIndex
27606          * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
27607          */
27608         _rebuildIndex() {
27609           this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
27610         }
27611         /**
27612          * mergeCustomGeoJSON
27613          * Accepts a FeatureCollection-like object containing custom locations
27614          * Each feature must have a filename-like `id`, for example: `something.geojson`
27615          * {
27616          *   "type": "FeatureCollection"
27617          *   "features": [
27618          *     {
27619          *       "type": "Feature",
27620          *       "id": "philly_metro.geojson",
27621          *       "properties": { … },
27622          *       "geometry": { … }
27623          *     }
27624          *   ]
27625          * }
27626          *
27627          * @param  `fc`  FeatureCollection-like Object containing custom locations
27628          */
27629         mergeCustomGeoJSON(fc) {
27630           if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
27631           fc.features.forEach((feature3) => {
27632             feature3.properties = feature3.properties || {};
27633             let props = feature3.properties;
27634             let id2 = feature3.id || props.id;
27635             if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
27636             id2 = id2.toLowerCase();
27637             feature3.id = id2;
27638             props.id = id2;
27639             if (!props.area) {
27640               const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
27641               props.area = Number(area.toFixed(2));
27642             }
27643             _loco._cache[id2] = feature3;
27644           });
27645         }
27646         /**
27647          * mergeLocationSets
27648          * Accepts an Array of Objects containing `locationSet` properties:
27649          * [
27650          *  { id: 'preset1', locationSet: {…} },
27651          *  { id: 'preset2', locationSet: {…} },
27652          *  …
27653          * ]
27654          * After validating, the Objects will be decorated with a `locationSetID` property:
27655          * [
27656          *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
27657          *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
27658          *  …
27659          * ]
27660          *
27661          * @param  `objects`  Objects to check - they should have `locationSet` property
27662          * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
27663          */
27664         mergeLocationSets(objects) {
27665           if (!Array.isArray(objects)) return Promise.reject("nothing to do");
27666           objects.forEach((obj) => this._validateLocationSet(obj));
27667           this._rebuildIndex();
27668           return Promise.resolve(objects);
27669         }
27670         /**
27671          * locationSetID
27672          * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
27673          * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
27674          *
27675          * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
27676          * @return  String locationSetID, e.g. `+[Q30]`
27677          */
27678         locationSetID(locationSet) {
27679           let locationSetID;
27680           try {
27681             locationSetID = _loco.validateLocationSet(locationSet).id;
27682           } catch {
27683             locationSetID = "+[Q2]";
27684           }
27685           return locationSetID;
27686         }
27687         /**
27688          * feature
27689          * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
27690          * A GeoJSON feature:
27691          * {
27692          *   type: 'Feature',
27693          *   id: '+[Q30]',
27694          *   properties: { id: '+[Q30]', area: 21817019.17, … },
27695          *   geometry: { … }
27696          * }
27697          *
27698          * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
27699          * @return  GeoJSON object (fallback to world)
27700          */
27701         feature(locationSetID = "+[Q2]") {
27702           const feature3 = this._resolved.get(locationSetID);
27703           return feature3 || this._resolved.get("+[Q2]");
27704         }
27705         /**
27706          * locationSetsAt
27707          * Find all the locationSets valid at the given location.
27708          * Results include the area (in km²) to facilitate sorting.
27709          *
27710          * Object of locationSetIDs to areas (in km²)
27711          * {
27712          *   "+[Q2]": 511207893.3958111,
27713          *   "+[Q30]": 21817019.17,
27714          *   "+[new_jersey.geojson]": 22390.77,
27715          *   …
27716          * }
27717          *
27718          * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
27719          * @return  Object of locationSetIDs valid at given location
27720          */
27721         locationSetsAt(loc) {
27722           let result = {};
27723           const hits = this._wp(loc, true) || [];
27724           const thiz = this;
27725           hits.forEach((prop) => {
27726             if (prop.id[0] !== "+") return;
27727             const locationSetID = prop.id;
27728             const area = thiz._knownLocationSets.get(locationSetID);
27729             if (area) {
27730               result[locationSetID] = area;
27731             }
27732           });
27733           hits.forEach((prop) => {
27734             if (prop.id[0] === "+") return;
27735             const locationID = prop.id;
27736             const included = thiz._locationIncludedIn.get(locationID);
27737             (included || []).forEach((locationSetID) => {
27738               const area = thiz._knownLocationSets.get(locationSetID);
27739               if (area) {
27740                 result[locationSetID] = area;
27741               }
27742             });
27743           });
27744           hits.forEach((prop) => {
27745             if (prop.id[0] === "+") return;
27746             const locationID = prop.id;
27747             const excluded = thiz._locationExcludedIn.get(locationID);
27748             (excluded || []).forEach((locationSetID) => {
27749               delete result[locationSetID];
27750             });
27751           });
27752           return result;
27753         }
27754         // Direct access to the location-conflation resolver
27755         loco() {
27756           return _loco;
27757         }
27758       };
27759       _sharedLocationManager = new LocationManager();
27760     }
27761   });
27762
27763   // modules/presets/collection.js
27764   var collection_exports = {};
27765   __export(collection_exports, {
27766     presetCollection: () => presetCollection
27767   });
27768   function presetCollection(collection) {
27769     const MAXRESULTS = 50;
27770     let _this = {};
27771     let _memo = {};
27772     _this.collection = collection;
27773     _this.item = (id2) => {
27774       if (_memo[id2]) return _memo[id2];
27775       const found = _this.collection.find((d2) => d2.id === id2);
27776       if (found) _memo[id2] = found;
27777       return found;
27778     };
27779     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
27780     _this.matchGeometry = (geometry) => {
27781       return presetCollection(
27782         _this.collection.filter((d2) => d2.matchGeometry(geometry))
27783       );
27784     };
27785     _this.matchAllGeometry = (geometries) => {
27786       return presetCollection(
27787         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
27788       );
27789     };
27790     _this.matchAnyGeometry = (geometries) => {
27791       return presetCollection(
27792         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
27793       );
27794     };
27795     _this.fallback = (geometry) => {
27796       let id2 = geometry;
27797       if (id2 === "vertex") id2 = "point";
27798       return _this.item(id2);
27799     };
27800     _this.search = (value, geometry, loc) => {
27801       if (!value) return _this;
27802       value = value.toLowerCase().trim();
27803       function leading(a4) {
27804         const index = a4.indexOf(value);
27805         return index === 0 || a4[index - 1] === " ";
27806       }
27807       function leadingStrict(a4) {
27808         const index = a4.indexOf(value);
27809         return index === 0;
27810       }
27811       function sortPresets(nameProp, aliasesProp) {
27812         return function sortNames(a4, b3) {
27813           let aCompare = a4[nameProp]();
27814           let bCompare = b3[nameProp]();
27815           if (aliasesProp) {
27816             const findMatchingAlias = (strings) => {
27817               if (strings.some((s2) => s2 === value)) {
27818                 return strings.find((s2) => s2 === value);
27819               } else {
27820                 return strings.filter((s2) => s2.includes(value)).sort((a5, b4) => a5.length - b4.length)[0];
27821               }
27822             };
27823             aCompare = findMatchingAlias([aCompare].concat(a4[aliasesProp]()));
27824             bCompare = findMatchingAlias([bCompare].concat(b3[aliasesProp]()));
27825           }
27826           if (value === aCompare) return -1;
27827           if (value === bCompare) return 1;
27828           let i3 = b3.originalScore - a4.originalScore;
27829           if (i3 !== 0) return i3;
27830           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
27831           if (i3 !== 0) return i3;
27832           return aCompare.length - bCompare.length;
27833         };
27834       }
27835       let pool = _this.collection;
27836       if (Array.isArray(loc)) {
27837         const validHere = _sharedLocationManager.locationSetsAt(loc);
27838         pool = pool.filter((a4) => !a4.locationSetID || validHere[a4.locationSetID]);
27839       }
27840       const searchable = pool.filter((a4) => a4.searchable !== false && a4.suggestion !== true);
27841       const suggestions = pool.filter((a4) => a4.suggestion === true);
27842       const leadingNames = searchable.filter((a4) => leading(a4.searchName()) || a4.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27843       const leadingSuggestions = suggestions.filter((a4) => leadingStrict(a4.searchName())).sort(sortPresets("searchName"));
27844       const leadingNamesStripped = searchable.filter((a4) => leading(a4.searchNameStripped()) || a4.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27845       const leadingSuggestionsStripped = suggestions.filter((a4) => leadingStrict(a4.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27846       const leadingTerms = searchable.filter((a4) => (a4.terms() || []).some(leading));
27847       const leadingSuggestionTerms = suggestions.filter((a4) => (a4.terms() || []).some(leading));
27848       const leadingTagValues = searchable.filter((a4) => Object.values(a4.tags || {}).filter((val) => val !== "*").some(leading));
27849       const similarName = searchable.map((a4) => ({ preset: a4, dist: utilEditDistance(value, a4.searchName()) })).filter((a4) => a4.dist + Math.min(value.length - a4.preset.searchName().length, 0) < 3).sort((a4, b3) => a4.dist - b3.dist).map((a4) => a4.preset);
27850       const similarSuggestions = suggestions.map((a4) => ({ preset: a4, dist: utilEditDistance(value, a4.searchName()) })).filter((a4) => a4.dist + Math.min(value.length - a4.preset.searchName().length, 0) < 1).sort((a4, b3) => a4.dist - b3.dist).map((a4) => a4.preset);
27851       const similarTerms = searchable.filter((a4) => {
27852         return (a4.terms() || []).some((b3) => {
27853           return utilEditDistance(value, b3) + Math.min(value.length - b3.length, 0) < 3;
27854         });
27855       });
27856       let leadingTagKeyValues = [];
27857       if (value.includes("=")) {
27858         leadingTagKeyValues = searchable.filter((a4) => a4.tags && Object.keys(a4.tags).some((key) => key + "=" + a4.tags[key] === value)).concat(searchable.filter((a4) => a4.tags && Object.keys(a4.tags).some((key) => leading(key + "=" + a4.tags[key]))));
27859       }
27860       let results = leadingNames.concat(
27861         leadingSuggestions,
27862         leadingNamesStripped,
27863         leadingSuggestionsStripped,
27864         leadingTerms,
27865         leadingSuggestionTerms,
27866         leadingTagValues,
27867         similarName,
27868         similarSuggestions,
27869         similarTerms,
27870         leadingTagKeyValues
27871       ).slice(0, MAXRESULTS - 1);
27872       if (geometry) {
27873         if (typeof geometry === "string") {
27874           results.push(_this.fallback(geometry));
27875         } else {
27876           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27877         }
27878       }
27879       return presetCollection(utilArrayUniq(results));
27880     };
27881     return _this;
27882   }
27883   var init_collection = __esm({
27884     "modules/presets/collection.js"() {
27885       "use strict";
27886       init_LocationManager();
27887       init_array3();
27888       init_util();
27889     }
27890   });
27891
27892   // modules/presets/category.js
27893   var category_exports = {};
27894   __export(category_exports, {
27895     presetCategory: () => presetCategory
27896   });
27897   function presetCategory(categoryID, category, allPresets) {
27898     let _this = Object.assign({}, category);
27899     let _searchName;
27900     let _searchNameStripped;
27901     _this.id = categoryID;
27902     _this.members = presetCollection(
27903       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27904     );
27905     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27906       for (let i3 in preset.geometry) {
27907         const geometry = preset.geometry[i3];
27908         if (acc.indexOf(geometry) === -1) {
27909           acc.push(geometry);
27910         }
27911       }
27912       return acc;
27913     }, []);
27914     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27915     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27916     _this.matchScore = () => -1;
27917     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27918     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
27919     _this.terms = () => [];
27920     _this.searchName = () => {
27921       if (!_searchName) {
27922         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27923       }
27924       return _searchName;
27925     };
27926     _this.searchNameStripped = () => {
27927       if (!_searchNameStripped) {
27928         _searchNameStripped = _this.searchName();
27929         if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
27930         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27931       }
27932       return _searchNameStripped;
27933     };
27934     _this.searchAliases = () => [];
27935     _this.searchAliasesStripped = () => [];
27936     return _this;
27937   }
27938   var init_category = __esm({
27939     "modules/presets/category.js"() {
27940       "use strict";
27941       init_localizer();
27942       init_collection();
27943     }
27944   });
27945
27946   // modules/presets/field.js
27947   var field_exports = {};
27948   __export(field_exports, {
27949     presetField: () => presetField
27950   });
27951   function presetField(fieldID, field, allFields) {
27952     allFields = allFields || {};
27953     let _this = Object.assign({}, field);
27954     _this.id = fieldID;
27955     _this.safeid = utilSafeClassName(fieldID);
27956     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27957     _this.matchAllGeometry = (geometries) => {
27958       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27959     };
27960     _this.t = (scope, options) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27961     _this.t.html = (scope, options) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27962     _this.t.append = (scope, options) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options);
27963     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
27964     _this.resolveReference = (which) => {
27965       const referenceRegex = /^\{(.*)\}$/;
27966       const match = (field[which] || "").match(referenceRegex);
27967       if (match) {
27968         const field2 = allFields[match[1]];
27969         if (field2) {
27970           return field2;
27971         }
27972         console.error(`Unable to resolve referenced field: ${match[1]}`);
27973       }
27974       return _this;
27975     };
27976     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27977     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27978     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27979     _this.originalTerms = (_this.terms || []).join();
27980     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27981     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27982     return _this;
27983   }
27984   var init_field = __esm({
27985     "modules/presets/field.js"() {
27986       "use strict";
27987       init_localizer();
27988       init_util2();
27989     }
27990   });
27991
27992   // modules/presets/preset.js
27993   var preset_exports = {};
27994   __export(preset_exports, {
27995     presetPreset: () => presetPreset
27996   });
27997   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27998     allFields = allFields || {};
27999     allPresets = allPresets || {};
28000     let _this = Object.assign({}, preset);
28001     let _addable = addable || false;
28002     let _searchName;
28003     let _searchNameStripped;
28004     let _searchAliases;
28005     let _searchAliasesStripped;
28006     const referenceRegex = /^\{(.*)\}$/;
28007     _this.id = presetID;
28008     _this.safeid = utilSafeClassName(presetID);
28009     _this.originalTerms = (_this.terms || []).join();
28010     _this.originalName = _this.name || "";
28011     _this.originalAliases = (_this.aliases || []).join("\n");
28012     _this.originalScore = _this.matchScore || 1;
28013     _this.originalReference = _this.reference || {};
28014     _this.originalFields = _this.fields || [];
28015     _this.originalMoreFields = _this.moreFields || [];
28016     _this.fields = (loc) => resolveFields("fields", loc);
28017     _this.moreFields = (loc) => resolveFields("moreFields", loc);
28018     _this.tags = _this.tags || {};
28019     _this.addTags = _this.addTags || _this.tags;
28020     _this.removeTags = _this.removeTags || _this.addTags;
28021     _this.geometry = _this.geometry || [];
28022     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
28023     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
28024     _this.matchScore = (entityTags) => {
28025       const tags = _this.tags;
28026       let seen = {};
28027       let score = 0;
28028       for (let k3 in tags) {
28029         seen[k3] = true;
28030         if (entityTags[k3] === tags[k3]) {
28031           score += _this.originalScore;
28032         } else if (tags[k3] === "*" && k3 in entityTags) {
28033           score += _this.originalScore / 2;
28034         } else {
28035           return -1;
28036         }
28037       }
28038       const addTags = _this.addTags;
28039       for (let k3 in addTags) {
28040         if (!seen[k3] && entityTags[k3] === addTags[k3]) {
28041           score += _this.originalScore;
28042         }
28043       }
28044       if (_this.searchable === false) {
28045         score *= 0.999;
28046       }
28047       return score;
28048     };
28049     _this.t = (scope, options) => {
28050       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
28051       return _t(textID, options);
28052     };
28053     _this.t.append = (scope, options) => {
28054       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
28055       return _t.append(textID, options);
28056     };
28057     function resolveReference(which) {
28058       const match = (_this[which] || "").match(referenceRegex);
28059       if (match) {
28060         const preset2 = allPresets[match[1]];
28061         if (preset2) {
28062           return preset2;
28063         }
28064         console.error(`Unable to resolve referenced preset: ${match[1]}`);
28065       }
28066       return _this;
28067     }
28068     _this.name = () => {
28069       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
28070     };
28071     _this.nameLabel = () => {
28072       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
28073     };
28074     _this.subtitle = () => {
28075       if (_this.suggestion) {
28076         let path = presetID.split("/");
28077         path.pop();
28078         return _t("_tagging.presets.presets." + path.join("/") + ".name");
28079       }
28080       return null;
28081     };
28082     _this.subtitleLabel = () => {
28083       if (_this.suggestion) {
28084         let path = presetID.split("/");
28085         path.pop();
28086         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
28087       }
28088       return null;
28089     };
28090     _this.aliases = () => {
28091       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/).filter(Boolean);
28092     };
28093     _this.terms = () => {
28094       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
28095     };
28096     _this.searchName = () => {
28097       if (!_searchName) {
28098         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
28099       }
28100       return _searchName;
28101     };
28102     _this.searchNameStripped = () => {
28103       if (!_searchNameStripped) {
28104         _searchNameStripped = stripDiacritics(_this.searchName());
28105       }
28106       return _searchNameStripped;
28107     };
28108     _this.searchAliases = () => {
28109       if (!_searchAliases) {
28110         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
28111       }
28112       return _searchAliases;
28113     };
28114     _this.searchAliasesStripped = () => {
28115       if (!_searchAliasesStripped) {
28116         _searchAliasesStripped = _this.searchAliases();
28117         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
28118       }
28119       return _searchAliasesStripped;
28120     };
28121     _this.isFallback = () => {
28122       const tagCount = Object.keys(_this.tags).length;
28123       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
28124     };
28125     _this.addable = function(val) {
28126       if (!arguments.length) return _addable;
28127       _addable = val;
28128       return _this;
28129     };
28130     _this.reference = () => {
28131       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
28132       if (qid) {
28133         return { qid };
28134       }
28135       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
28136       let value = _this.originalReference.value || _this.tags[key];
28137       if (value === "*") {
28138         return { key };
28139       } else {
28140         return { key, value };
28141       }
28142     };
28143     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
28144       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
28145       tags = utilObjectOmit(tags, Object.keys(removeTags));
28146       if (geometry && !skipFieldDefaults) {
28147         _this.fields(loc).forEach((field) => {
28148           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
28149             delete tags[field.key];
28150           }
28151         });
28152       }
28153       delete tags.area;
28154       return tags;
28155     };
28156     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
28157       const addTags = _this.addTags;
28158       tags = Object.assign({}, tags);
28159       for (let k3 in addTags) {
28160         if (addTags[k3] === "*") {
28161           if (_this.tags[k3] || !tags[k3]) {
28162             tags[k3] = "yes";
28163           }
28164         } else {
28165           tags[k3] = addTags[k3];
28166         }
28167       }
28168       if (!addTags.hasOwnProperty("area")) {
28169         delete tags.area;
28170         if (geometry === "area") {
28171           let needsAreaTag = true;
28172           for (let k3 in addTags) {
28173             if (_this.geometry.indexOf("line") === -1 && k3 in osmAreaKeys || k3 in osmAreaKeysExceptions && addTags[k3] in osmAreaKeysExceptions[k3]) {
28174               needsAreaTag = false;
28175               break;
28176             }
28177           }
28178           if (needsAreaTag) {
28179             tags.area = "yes";
28180           }
28181         }
28182       }
28183       if (geometry && !skipFieldDefaults) {
28184         _this.fields(loc).forEach((field) => {
28185           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
28186             tags[field.key] = field.default;
28187           }
28188         });
28189       }
28190       return tags;
28191     };
28192     function resolveFields(which, loc) {
28193       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
28194       let resolved = [];
28195       fieldIDs.forEach((fieldID) => {
28196         const match = fieldID.match(referenceRegex);
28197         if (match !== null) {
28198           resolved = resolved.concat(inheritFields(allPresets[match[1]], which, loc));
28199         } else if (allFields[fieldID]) {
28200           resolved.push(allFields[fieldID]);
28201         } else {
28202           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
28203         }
28204       });
28205       if (!resolved.length) {
28206         const endIndex = _this.id.lastIndexOf("/");
28207         const parentID = endIndex && _this.id.substring(0, endIndex);
28208         if (parentID) {
28209           let parent2 = allPresets[parentID];
28210           if (loc) {
28211             const validHere = _sharedLocationManager.locationSetsAt(loc);
28212             if ((parent2 == null ? void 0 : parent2.locationSetID) && !validHere[parent2.locationSetID]) {
28213               const candidateIDs = Object.keys(allPresets).filter((k3) => k3.startsWith(parentID));
28214               parent2 = allPresets[candidateIDs.find((candidateID) => {
28215                 const candidate = allPresets[candidateID];
28216                 return validHere[candidate.locationSetID] && isEqual_default(candidate.tags, parent2.tags);
28217               })];
28218             }
28219           }
28220           resolved = inheritFields(parent2, which, loc);
28221         }
28222       }
28223       if (loc) {
28224         const validHere = _sharedLocationManager.locationSetsAt(loc);
28225         resolved = resolved.filter((field) => !field.locationSetID || validHere[field.locationSetID]);
28226       }
28227       return resolved;
28228       function inheritFields(parent2, which2, loc2) {
28229         if (!parent2) return [];
28230         if (which2 === "fields") {
28231           return parent2.fields(loc2).filter(shouldInherit);
28232         } else if (which2 === "moreFields") {
28233           return parent2.moreFields(loc2).filter(shouldInherit);
28234         } else {
28235           return [];
28236         }
28237       }
28238       function shouldInherit(f2) {
28239         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
28240         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
28241         if (f2.key && (_this.originalFields.some((originalField) => {
28242           var _a4;
28243           return f2.key === ((_a4 = allFields[originalField]) == null ? void 0 : _a4.key);
28244         }) || _this.originalMoreFields.some((originalField) => {
28245           var _a4;
28246           return f2.key === ((_a4 = allFields[originalField]) == null ? void 0 : _a4.key);
28247         }))) {
28248           return false;
28249         }
28250         return true;
28251       }
28252     }
28253     function stripDiacritics(s2) {
28254       if (s2.normalize) s2 = s2.normalize("NFD");
28255       s2 = s2.replace(/[\u0300-\u036f]/g, "");
28256       return s2;
28257     }
28258     return _this;
28259   }
28260   var init_preset = __esm({
28261     "modules/presets/preset.js"() {
28262       "use strict";
28263       init_lodash();
28264       init_localizer();
28265       init_tags();
28266       init_util();
28267       init_util2();
28268       init_LocationManager();
28269     }
28270   });
28271
28272   // modules/presets/index.js
28273   var presets_exports = {};
28274   __export(presets_exports, {
28275     presetCategory: () => presetCategory,
28276     presetCollection: () => presetCollection,
28277     presetField: () => presetField,
28278     presetIndex: () => presetIndex,
28279     presetManager: () => _mainPresetIndex,
28280     presetPreset: () => presetPreset
28281   });
28282   function presetIndex() {
28283     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
28284     const MAXRECENTS = 30;
28285     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
28286     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
28287     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
28288     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
28289     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
28290     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
28291     let _defaults = {
28292       point: presetCollection([POINT]),
28293       vertex: presetCollection([POINT]),
28294       line: presetCollection([LINE]),
28295       area: presetCollection([AREA]),
28296       relation: presetCollection([RELATION])
28297     };
28298     let _fields = {};
28299     let _categories = {};
28300     let _universal = [];
28301     let _addablePresetIDs = null;
28302     let _recents;
28303     let _favorites;
28304     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28305     let _loadPromise;
28306     _this.ensureLoaded = (bypassCache) => {
28307       if (_loadPromise && !bypassCache) return _loadPromise;
28308       return _loadPromise = Promise.all([
28309         _mainFileFetcher.get("preset_categories"),
28310         _mainFileFetcher.get("preset_defaults"),
28311         _mainFileFetcher.get("preset_presets"),
28312         _mainFileFetcher.get("preset_fields")
28313       ]).then((vals) => {
28314         _this.merge({
28315           categories: vals[0],
28316           defaults: vals[1],
28317           presets: vals[2],
28318           fields: vals[3]
28319         });
28320         osmSetAreaKeys(_this.areaKeys());
28321         osmSetLineTags(_this.lineTags());
28322         osmSetPointTags(_this.pointTags());
28323         osmSetVertexTags(_this.vertexTags());
28324       });
28325     };
28326     _this.merge = (d2) => {
28327       let newLocationSets = [];
28328       if (d2.fields) {
28329         Object.keys(d2.fields).forEach((fieldID) => {
28330           let f2 = d2.fields[fieldID];
28331           if (f2) {
28332             f2 = presetField(fieldID, f2, _fields);
28333             if (f2.locationSet) newLocationSets.push(f2);
28334             _fields[fieldID] = f2;
28335           } else {
28336             delete _fields[fieldID];
28337           }
28338         });
28339       }
28340       if (d2.presets) {
28341         Object.keys(d2.presets).forEach((presetID) => {
28342           let p2 = d2.presets[presetID];
28343           if (p2) {
28344             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
28345             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
28346             if (p2.locationSet) newLocationSets.push(p2);
28347             _presets[presetID] = p2;
28348           } else {
28349             const existing = _presets[presetID];
28350             if (existing && !existing.isFallback()) {
28351               delete _presets[presetID];
28352             }
28353           }
28354         });
28355       }
28356       if (d2.categories) {
28357         Object.keys(d2.categories).forEach((categoryID) => {
28358           let c2 = d2.categories[categoryID];
28359           if (c2) {
28360             c2 = presetCategory(categoryID, c2, _presets);
28361             if (c2.locationSet) newLocationSets.push(c2);
28362             _categories[categoryID] = c2;
28363           } else {
28364             delete _categories[categoryID];
28365           }
28366         });
28367       }
28368       _this.collection = Object.values(_presets).concat(Object.values(_categories));
28369       if (d2.defaults) {
28370         Object.keys(d2.defaults).forEach((geometry) => {
28371           const def = d2.defaults[geometry];
28372           if (Array.isArray(def)) {
28373             _defaults[geometry] = presetCollection(
28374               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
28375             );
28376           } else {
28377             delete _defaults[geometry];
28378           }
28379         });
28380       }
28381       _universal = Object.values(_fields).filter((field) => field.universal);
28382       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28383       _this.collection.forEach((preset) => {
28384         (preset.geometry || []).forEach((geometry) => {
28385           let g3 = _geometryIndex[geometry];
28386           for (let key in preset.tags) {
28387             g3[key] = g3[key] || {};
28388             let value = preset.tags[key];
28389             (g3[key][value] = g3[key][value] || []).push(preset);
28390           }
28391         });
28392       });
28393       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
28394         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
28395       }
28396       if (newLocationSets.length) {
28397         _sharedLocationManager.mergeLocationSets(newLocationSets);
28398       }
28399       return _this;
28400     };
28401     _this.match = (entity, resolver) => {
28402       return resolver.transient(entity, "presetMatch", () => {
28403         let geometry = entity.geometry(resolver);
28404         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
28405           geometry = "point";
28406         }
28407         const entityExtent = entity.extent(resolver);
28408         return _this.matchTags(entity.tags, geometry, entityExtent.center());
28409       });
28410     };
28411     _this.matchTags = (tags, geometry, loc) => {
28412       const keyIndex = _geometryIndex[geometry];
28413       let bestScore = -1;
28414       let bestMatch;
28415       let matchCandidates = [];
28416       for (let k3 in tags) {
28417         let indexMatches = [];
28418         let valueIndex = keyIndex[k3];
28419         if (!valueIndex) continue;
28420         let keyValueMatches = valueIndex[tags[k3]];
28421         if (keyValueMatches) indexMatches.push(...keyValueMatches);
28422         let keyStarMatches = valueIndex["*"];
28423         if (keyStarMatches) indexMatches.push(...keyStarMatches);
28424         if (indexMatches.length === 0) continue;
28425         for (let i3 = 0; i3 < indexMatches.length; i3++) {
28426           const candidate = indexMatches[i3];
28427           const score = candidate.matchScore(tags);
28428           if (score === -1) {
28429             continue;
28430           }
28431           matchCandidates.push({ score, candidate });
28432           if (score > bestScore) {
28433             bestScore = score;
28434             bestMatch = candidate;
28435           }
28436         }
28437       }
28438       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
28439         const validHere = _sharedLocationManager.locationSetsAt(loc);
28440         if (!validHere[bestMatch.locationSetID]) {
28441           matchCandidates.sort((a4, b3) => a4.score < b3.score ? 1 : -1);
28442           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
28443             const candidateScore = matchCandidates[i3];
28444             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
28445               bestMatch = candidateScore.candidate;
28446               bestScore = candidateScore.score;
28447               break;
28448             }
28449           }
28450         }
28451       }
28452       if (!bestMatch || bestMatch.isFallback()) {
28453         for (let k3 in tags) {
28454           if (/^addr:/.test(k3) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
28455             bestMatch = keyIndex["addr:*"]["*"][0];
28456             break;
28457           }
28458         }
28459       }
28460       return bestMatch || _this.fallback(geometry);
28461     };
28462     _this.allowsVertex = (entity, resolver) => {
28463       if (entity.type !== "node") return false;
28464       if (Object.keys(entity.tags).length === 0) return true;
28465       return resolver.transient(entity, "vertexMatch", () => {
28466         if (entity.isOnAddressLine(resolver)) return true;
28467         const geometries = osmNodeGeometriesForTags(entity.tags);
28468         if (geometries.vertex) return true;
28469         if (geometries.point) return false;
28470         return true;
28471       });
28472     };
28473     _this.areaKeys = () => {
28474       const ignore = {
28475         barrier: true,
28476         highway: true,
28477         footway: true,
28478         railway: true,
28479         junction: true,
28480         type: true
28481       };
28482       let areaKeys = {};
28483       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
28484       presets.forEach((p2) => {
28485         const keys2 = p2.tags && Object.keys(p2.tags);
28486         const key = keys2 && keys2.length && keys2[0];
28487         if (!key) return;
28488         if (ignore[key]) return;
28489         if (p2.geometry.indexOf("area") !== -1) {
28490           areaKeys[key] = areaKeys[key] || {};
28491         }
28492       });
28493       presets.forEach((p2) => {
28494         let key;
28495         for (key in p2.addTags) {
28496           const value = p2.addTags[key];
28497           if (key in areaKeys && // probably an area...
28498           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
28499           value !== "*") {
28500             areaKeys[key][value] = true;
28501           }
28502         }
28503       });
28504       return areaKeys;
28505     };
28506     _this.lineTags = () => {
28507       return _this.collection.filter((lineTags, d2) => {
28508         if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
28509         const keys2 = d2.tags && Object.keys(d2.tags);
28510         const key = keys2 && keys2.length && keys2[0];
28511         if (!key) return lineTags;
28512         if (d2.geometry.indexOf("line") !== -1) {
28513           lineTags[key] = lineTags[key] || [];
28514           lineTags[key].push(d2.tags);
28515         }
28516         return lineTags;
28517       }, {});
28518     };
28519     _this.pointTags = () => {
28520       return _this.collection.reduce((pointTags, d2) => {
28521         if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
28522         const keys2 = d2.tags && Object.keys(d2.tags);
28523         const key = keys2 && keys2.length && keys2[0];
28524         if (!key) return pointTags;
28525         if (d2.geometry.indexOf("point") !== -1) {
28526           pointTags[key] = pointTags[key] || {};
28527           pointTags[key][d2.tags[key]] = true;
28528         }
28529         return pointTags;
28530       }, {});
28531     };
28532     _this.vertexTags = () => {
28533       return _this.collection.reduce((vertexTags, d2) => {
28534         if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
28535         const keys2 = d2.tags && Object.keys(d2.tags);
28536         const key = keys2 && keys2.length && keys2[0];
28537         if (!key) return vertexTags;
28538         if (d2.geometry.indexOf("vertex") !== -1) {
28539           vertexTags[key] = vertexTags[key] || {};
28540           vertexTags[key][d2.tags[key]] = true;
28541         }
28542         return vertexTags;
28543       }, {});
28544     };
28545     _this.field = (id2) => _fields[id2];
28546     _this.universal = () => _universal;
28547     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
28548       let recents = [];
28549       if (startWithRecents) {
28550         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
28551       }
28552       let defaults;
28553       if (_addablePresetIDs) {
28554         defaults = Array.from(_addablePresetIDs).map(function(id2) {
28555           var preset = _this.item(id2);
28556           if (preset && preset.matchGeometry(geometry)) return preset;
28557           return null;
28558         }).filter(Boolean);
28559       } else {
28560         defaults = _defaults[geometry].collection.concat(_this.fallback(geometry));
28561       }
28562       let result = presetCollection(
28563         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
28564       );
28565       if (Array.isArray(loc)) {
28566         const validHere = _sharedLocationManager.locationSetsAt(loc);
28567         result.collection = result.collection.filter((a4) => !a4.locationSetID || validHere[a4.locationSetID]);
28568       }
28569       return result;
28570     };
28571     _this.addablePresetIDs = function(val) {
28572       if (!arguments.length) return _addablePresetIDs;
28573       if (Array.isArray(val)) val = new Set(val);
28574       _addablePresetIDs = val;
28575       if (_addablePresetIDs) {
28576         _this.collection.forEach((p2) => {
28577           if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
28578         });
28579       } else {
28580         _this.collection.forEach((p2) => {
28581           if (p2.addable) p2.addable(true);
28582         });
28583       }
28584       return _this;
28585     };
28586     _this.recent = () => {
28587       return presetCollection(
28588         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
28589       );
28590     };
28591     function RibbonItem(preset, source) {
28592       let item = {};
28593       item.preset = preset;
28594       item.source = source;
28595       item.isFavorite = () => item.source === "favorite";
28596       item.isRecent = () => item.source === "recent";
28597       item.matches = (preset2) => item.preset.id === preset2.id;
28598       item.minified = () => ({ pID: item.preset.id });
28599       return item;
28600     }
28601     function ribbonItemForMinified(d2, source) {
28602       if (d2 && d2.pID) {
28603         const preset = _this.item(d2.pID);
28604         if (!preset) return null;
28605         return RibbonItem(preset, source);
28606       }
28607       return null;
28608     }
28609     _this.getGenericRibbonItems = () => {
28610       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
28611     };
28612     _this.getAddable = () => {
28613       if (!_addablePresetIDs) return [];
28614       return _addablePresetIDs.map((id2) => {
28615         const preset = _this.item(id2);
28616         if (preset) return RibbonItem(preset, "addable");
28617         return null;
28618       }).filter(Boolean);
28619     };
28620     function setRecents(items) {
28621       _recents = items;
28622       const minifiedItems = items.map((d2) => d2.minified());
28623       corePreferences("preset_recents", JSON.stringify(minifiedItems));
28624       dispatch14.call("recentsChange");
28625     }
28626     _this.getRecents = () => {
28627       if (!_recents) {
28628         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
28629           let item = ribbonItemForMinified(d2, "recent");
28630           if (item && item.preset.addable()) acc.push(item);
28631           return acc;
28632         }, []);
28633       }
28634       return _recents;
28635     };
28636     _this.addRecent = (preset, besidePreset, after) => {
28637       const recents = _this.getRecents();
28638       const beforeItem = _this.recentMatching(besidePreset);
28639       let toIndex = recents.indexOf(beforeItem);
28640       if (after) toIndex += 1;
28641       const newItem = RibbonItem(preset, "recent");
28642       recents.splice(toIndex, 0, newItem);
28643       setRecents(recents);
28644     };
28645     _this.removeRecent = (preset) => {
28646       const item = _this.recentMatching(preset);
28647       if (item) {
28648         let items = _this.getRecents();
28649         items.splice(items.indexOf(item), 1);
28650         setRecents(items);
28651       }
28652     };
28653     _this.recentMatching = (preset) => {
28654       const items = _this.getRecents();
28655       for (let i3 in items) {
28656         if (items[i3].matches(preset)) {
28657           return items[i3];
28658         }
28659       }
28660       return null;
28661     };
28662     _this.moveItem = (items, fromIndex, toIndex) => {
28663       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
28664       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
28665       return items;
28666     };
28667     _this.moveRecent = (item, beforeItem) => {
28668       const recents = _this.getRecents();
28669       const fromIndex = recents.indexOf(item);
28670       const toIndex = recents.indexOf(beforeItem);
28671       const items = _this.moveItem(recents, fromIndex, toIndex);
28672       if (items) setRecents(items);
28673     };
28674     _this.setMostRecent = (preset) => {
28675       if (preset.searchable === false) return;
28676       let items = _this.getRecents();
28677       let item = _this.recentMatching(preset);
28678       if (item) {
28679         items.splice(items.indexOf(item), 1);
28680       } else {
28681         item = RibbonItem(preset, "recent");
28682       }
28683       while (items.length >= MAXRECENTS) {
28684         items.pop();
28685       }
28686       items.unshift(item);
28687       setRecents(items);
28688     };
28689     function setFavorites(items) {
28690       _favorites = items;
28691       const minifiedItems = items.map((d2) => d2.minified());
28692       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
28693       dispatch14.call("favoritePreset");
28694     }
28695     _this.addFavorite = (preset, besidePreset, after) => {
28696       const favorites = _this.getFavorites();
28697       const beforeItem = _this.favoriteMatching(besidePreset);
28698       let toIndex = favorites.indexOf(beforeItem);
28699       if (after) toIndex += 1;
28700       const newItem = RibbonItem(preset, "favorite");
28701       favorites.splice(toIndex, 0, newItem);
28702       setFavorites(favorites);
28703     };
28704     _this.toggleFavorite = (preset) => {
28705       const favs = _this.getFavorites();
28706       const favorite = _this.favoriteMatching(preset);
28707       if (favorite) {
28708         favs.splice(favs.indexOf(favorite), 1);
28709       } else {
28710         if (favs.length === 10) {
28711           favs.pop();
28712         }
28713         favs.push(RibbonItem(preset, "favorite"));
28714       }
28715       setFavorites(favs);
28716     };
28717     _this.removeFavorite = (preset) => {
28718       const item = _this.favoriteMatching(preset);
28719       if (item) {
28720         const items = _this.getFavorites();
28721         items.splice(items.indexOf(item), 1);
28722         setFavorites(items);
28723       }
28724     };
28725     _this.getFavorites = () => {
28726       if (!_favorites) {
28727         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
28728         if (!rawFavorites) {
28729           rawFavorites = [];
28730           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
28731         }
28732         _favorites = rawFavorites.reduce((output, d2) => {
28733           const item = ribbonItemForMinified(d2, "favorite");
28734           if (item && item.preset.addable()) output.push(item);
28735           return output;
28736         }, []);
28737       }
28738       return _favorites;
28739     };
28740     _this.favoriteMatching = (preset) => {
28741       const favs = _this.getFavorites();
28742       for (let index in favs) {
28743         if (favs[index].matches(preset)) {
28744           return favs[index];
28745         }
28746       }
28747       return null;
28748     };
28749     return utilRebind(_this, dispatch14, "on");
28750   }
28751   var _mainPresetIndex;
28752   var init_presets = __esm({
28753     "modules/presets/index.js"() {
28754       "use strict";
28755       init_src4();
28756       init_preferences();
28757       init_file_fetcher();
28758       init_LocationManager();
28759       init_tags();
28760       init_category();
28761       init_collection();
28762       init_field();
28763       init_preset();
28764       init_util();
28765       _mainPresetIndex = presetIndex();
28766     }
28767   });
28768
28769   // modules/behavior/edit.js
28770   var edit_exports = {};
28771   __export(edit_exports, {
28772     behaviorEdit: () => behaviorEdit
28773   });
28774   function behaviorEdit(context) {
28775     function behavior() {
28776       context.map().minzoom(context.minEditableZoom());
28777     }
28778     behavior.off = function() {
28779       context.map().minzoom(0);
28780     };
28781     return behavior;
28782   }
28783   var init_edit = __esm({
28784     "modules/behavior/edit.js"() {
28785       "use strict";
28786     }
28787   });
28788
28789   // modules/behavior/hover.js
28790   var hover_exports = {};
28791   __export(hover_exports, {
28792     behaviorHover: () => behaviorHover
28793   });
28794   function behaviorHover(context) {
28795     var dispatch14 = dispatch_default("hover");
28796     var _selection = select_default2(null);
28797     var _newNodeId = null;
28798     var _initialNodeID = null;
28799     var _altDisables;
28800     var _ignoreVertex;
28801     var _targets = [];
28802     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
28803     function keydown(d3_event) {
28804       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
28805         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
28806         _selection.classed("hover-disabled", true);
28807         dispatch14.call("hover", this, null);
28808       }
28809     }
28810     function keyup(d3_event) {
28811       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
28812         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
28813         _selection.classed("hover-disabled", false);
28814         dispatch14.call("hover", this, _targets);
28815       }
28816     }
28817     function behavior(selection2) {
28818       _selection = selection2;
28819       _targets = [];
28820       if (_initialNodeID) {
28821         _newNodeId = _initialNodeID;
28822         _initialNodeID = null;
28823       } else {
28824         _newNodeId = null;
28825       }
28826       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
28827       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
28828       function eventTarget(d3_event) {
28829         var datum2 = d3_event.target && d3_event.target.__data__;
28830         if (typeof datum2 !== "object") return null;
28831         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
28832           return datum2.properties.entity;
28833         }
28834         return datum2;
28835       }
28836       function pointerover(d3_event) {
28837         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
28838         var target = eventTarget(d3_event);
28839         if (target && _targets.indexOf(target) === -1) {
28840           _targets.push(target);
28841           updateHover(d3_event, _targets);
28842         }
28843       }
28844       function pointerout(d3_event) {
28845         var target = eventTarget(d3_event);
28846         var index = _targets.indexOf(target);
28847         if (index !== -1) {
28848           _targets.splice(index);
28849           updateHover(d3_event, _targets);
28850         }
28851       }
28852       function allowsVertex(d2) {
28853         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
28854       }
28855       function modeAllowsHover(target) {
28856         var mode = context.mode();
28857         if (mode.id === "add-point") {
28858           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
28859         }
28860         return true;
28861       }
28862       function updateHover(d3_event, targets) {
28863         _selection.selectAll(".hover").classed("hover", false);
28864         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
28865         var mode = context.mode();
28866         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
28867           var node = targets.find(function(target) {
28868             return target instanceof osmEntity && target.type === "node";
28869           });
28870           _newNodeId = node && node.id;
28871         }
28872         targets = targets.filter(function(datum3) {
28873           if (datum3 instanceof osmEntity) {
28874             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
28875           }
28876           return true;
28877         });
28878         var selector = "";
28879         for (var i3 in targets) {
28880           var datum2 = targets[i3];
28881           if (datum2.__featurehash__) {
28882             selector += ", .data" + datum2.__featurehash__;
28883           } else if (datum2 instanceof QAItem) {
28884             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
28885           } else if (datum2 instanceof osmNote) {
28886             selector += ", .note-" + datum2.id;
28887           } else if (datum2 instanceof osmEntity) {
28888             selector += ", ." + datum2.id;
28889             if (datum2.type === "relation") {
28890               for (var j3 in datum2.members) {
28891                 selector += ", ." + datum2.members[j3].id;
28892               }
28893             }
28894           }
28895         }
28896         var suppressed = _altDisables && d3_event && d3_event.altKey;
28897         if (selector.trim().length) {
28898           selector = selector.slice(1);
28899           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
28900         }
28901         dispatch14.call("hover", this, !suppressed && targets);
28902       }
28903     }
28904     behavior.off = function(selection2) {
28905       selection2.selectAll(".hover").classed("hover", false);
28906       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
28907       selection2.classed("hover-disabled", false);
28908       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
28909       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
28910     };
28911     behavior.altDisables = function(val) {
28912       if (!arguments.length) return _altDisables;
28913       _altDisables = val;
28914       return behavior;
28915     };
28916     behavior.ignoreVertex = function(val) {
28917       if (!arguments.length) return _ignoreVertex;
28918       _ignoreVertex = val;
28919       return behavior;
28920     };
28921     behavior.initialNodeID = function(nodeId) {
28922       _initialNodeID = nodeId;
28923       return behavior;
28924     };
28925     return utilRebind(behavior, dispatch14, "on");
28926   }
28927   var init_hover = __esm({
28928     "modules/behavior/hover.js"() {
28929       "use strict";
28930       init_src4();
28931       init_src5();
28932       init_presets();
28933       init_osm();
28934       init_util();
28935     }
28936   });
28937
28938   // modules/behavior/draw.js
28939   var draw_exports = {};
28940   __export(draw_exports, {
28941     behaviorDraw: () => behaviorDraw
28942   });
28943   function behaviorDraw(context) {
28944     var dispatch14 = dispatch_default(
28945       "move",
28946       "down",
28947       "downcancel",
28948       "click",
28949       "clickWay",
28950       "clickNode",
28951       "undo",
28952       "cancel",
28953       "finish"
28954     );
28955     var keybinding = utilKeybinding("draw");
28956     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
28957     var _edit = behaviorEdit(context);
28958     var _closeTolerance = 4;
28959     var _tolerance = 12;
28960     var _mouseLeave = false;
28961     var _lastMouse = null;
28962     var _lastPointerUpEvent;
28963     var _downPointer;
28964     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
28965     function datum2(d3_event) {
28966       var mode = context.mode();
28967       var isNote = mode && mode.id.indexOf("note") !== -1;
28968       if (d3_event.altKey || isNote) return {};
28969       var element;
28970       if (d3_event.type === "keydown") {
28971         element = _lastMouse && _lastMouse.target;
28972       } else {
28973         element = d3_event.target;
28974       }
28975       var d2 = element.__data__;
28976       return d2 && d2.properties && d2.properties.target ? d2 : {};
28977     }
28978     function pointerdown(d3_event) {
28979       if (_downPointer) return;
28980       var pointerLocGetter = utilFastMouse(this);
28981       _downPointer = {
28982         id: d3_event.pointerId || "mouse",
28983         pointerLocGetter,
28984         downTime: +/* @__PURE__ */ new Date(),
28985         downLoc: pointerLocGetter(d3_event)
28986       };
28987       dispatch14.call("down", this, d3_event, datum2(d3_event));
28988     }
28989     function pointerup(d3_event) {
28990       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
28991       var downPointer = _downPointer;
28992       _downPointer = null;
28993       _lastPointerUpEvent = d3_event;
28994       if (downPointer.isCancelled) return;
28995       var t2 = +/* @__PURE__ */ new Date();
28996       var p2 = downPointer.pointerLocGetter(d3_event);
28997       var dist = geoVecLength(downPointer.downLoc, p2);
28998       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
28999         select_default2(window).on("click.draw-block", function() {
29000           d3_event.stopPropagation();
29001         }, true);
29002         context.map().dblclickZoomEnable(false);
29003         window.setTimeout(function() {
29004           context.map().dblclickZoomEnable(true);
29005           select_default2(window).on("click.draw-block", null);
29006         }, 500);
29007         click(d3_event, p2);
29008       }
29009     }
29010     function pointermove(d3_event) {
29011       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
29012         var p2 = _downPointer.pointerLocGetter(d3_event);
29013         var dist = geoVecLength(_downPointer.downLoc, p2);
29014         if (dist >= _closeTolerance) {
29015           _downPointer.isCancelled = true;
29016           dispatch14.call("downcancel", this);
29017         }
29018       }
29019       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
29020       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
29021       _lastMouse = d3_event;
29022       dispatch14.call("move", this, d3_event, datum2(d3_event));
29023     }
29024     function pointercancel(d3_event) {
29025       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
29026         if (!_downPointer.isCancelled) {
29027           dispatch14.call("downcancel", this);
29028         }
29029         _downPointer = null;
29030       }
29031     }
29032     function mouseenter() {
29033       _mouseLeave = false;
29034     }
29035     function mouseleave() {
29036       _mouseLeave = true;
29037     }
29038     function allowsVertex(d2) {
29039       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
29040     }
29041     function click(d3_event, loc) {
29042       var d2 = datum2(d3_event);
29043       var target = d2 && d2.properties && d2.properties.entity;
29044       var mode = context.mode();
29045       if (target && target.type === "node" && allowsVertex(target)) {
29046         dispatch14.call("clickNode", this, target, d2);
29047         return;
29048       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
29049         var choice = geoChooseEdge(
29050           context.graph().childNodes(target),
29051           loc,
29052           context.projection,
29053           context.activeID()
29054         );
29055         if (choice) {
29056           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
29057           dispatch14.call("clickWay", this, choice.loc, edge, d2);
29058           return;
29059         }
29060       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
29061         var locLatLng = context.projection.invert(loc);
29062         dispatch14.call("click", this, locLatLng, d2);
29063       }
29064     }
29065     function space(d3_event) {
29066       d3_event.preventDefault();
29067       d3_event.stopPropagation();
29068       var currSpace = context.map().mouse();
29069       if (_disableSpace && _lastSpace) {
29070         var dist = geoVecLength(_lastSpace, currSpace);
29071         if (dist > _tolerance) {
29072           _disableSpace = false;
29073         }
29074       }
29075       if (_disableSpace || _mouseLeave || !_lastMouse) return;
29076       _lastSpace = currSpace;
29077       _disableSpace = true;
29078       select_default2(window).on("keyup.space-block", function() {
29079         d3_event.preventDefault();
29080         d3_event.stopPropagation();
29081         _disableSpace = false;
29082         select_default2(window).on("keyup.space-block", null);
29083       });
29084       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
29085       context.projection(context.map().center());
29086       click(d3_event, loc);
29087     }
29088     function backspace(d3_event) {
29089       d3_event.preventDefault();
29090       dispatch14.call("undo");
29091     }
29092     function del(d3_event) {
29093       d3_event.preventDefault();
29094       dispatch14.call("cancel");
29095     }
29096     function ret(d3_event) {
29097       d3_event.preventDefault();
29098       dispatch14.call("finish");
29099     }
29100     function behavior(selection2) {
29101       context.install(_hover);
29102       context.install(_edit);
29103       _downPointer = null;
29104       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
29105       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
29106       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
29107       select_default2(document).call(keybinding);
29108       return behavior;
29109     }
29110     behavior.off = function(selection2) {
29111       context.ui().sidebar.hover.cancel();
29112       context.uninstall(_hover);
29113       context.uninstall(_edit);
29114       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
29115       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
29116       select_default2(document).call(keybinding.unbind);
29117     };
29118     behavior.hover = function() {
29119       return _hover;
29120     };
29121     return utilRebind(behavior, dispatch14, "on");
29122   }
29123   var _disableSpace, _lastSpace;
29124   var init_draw = __esm({
29125     "modules/behavior/draw.js"() {
29126       "use strict";
29127       init_src4();
29128       init_src5();
29129       init_presets();
29130       init_edit();
29131       init_hover();
29132       init_geo2();
29133       init_util();
29134       _disableSpace = false;
29135       _lastSpace = null;
29136     }
29137   });
29138
29139   // node_modules/d3-scale/src/init.js
29140   function initRange(domain, range3) {
29141     switch (arguments.length) {
29142       case 0:
29143         break;
29144       case 1:
29145         this.range(domain);
29146         break;
29147       default:
29148         this.range(range3).domain(domain);
29149         break;
29150     }
29151     return this;
29152   }
29153   var init_init = __esm({
29154     "node_modules/d3-scale/src/init.js"() {
29155     }
29156   });
29157
29158   // node_modules/d3-scale/src/constant.js
29159   function constants(x2) {
29160     return function() {
29161       return x2;
29162     };
29163   }
29164   var init_constant6 = __esm({
29165     "node_modules/d3-scale/src/constant.js"() {
29166     }
29167   });
29168
29169   // node_modules/d3-scale/src/number.js
29170   function number2(x2) {
29171     return +x2;
29172   }
29173   var init_number3 = __esm({
29174     "node_modules/d3-scale/src/number.js"() {
29175     }
29176   });
29177
29178   // node_modules/d3-scale/src/continuous.js
29179   function identity4(x2) {
29180     return x2;
29181   }
29182   function normalize(a4, b3) {
29183     return (b3 -= a4 = +a4) ? function(x2) {
29184       return (x2 - a4) / b3;
29185     } : constants(isNaN(b3) ? NaN : 0.5);
29186   }
29187   function clamper(a4, b3) {
29188     var t2;
29189     if (a4 > b3) t2 = a4, a4 = b3, b3 = t2;
29190     return function(x2) {
29191       return Math.max(a4, Math.min(b3, x2));
29192     };
29193   }
29194   function bimap(domain, range3, interpolate) {
29195     var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
29196     if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
29197     else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
29198     return function(x2) {
29199       return r0(d0(x2));
29200     };
29201   }
29202   function polymap(domain, range3, interpolate) {
29203     var j3 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j3), r2 = new Array(j3), i3 = -1;
29204     if (domain[j3] < domain[0]) {
29205       domain = domain.slice().reverse();
29206       range3 = range3.slice().reverse();
29207     }
29208     while (++i3 < j3) {
29209       d2[i3] = normalize(domain[i3], domain[i3 + 1]);
29210       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
29211     }
29212     return function(x2) {
29213       var i4 = bisect_default(domain, x2, 1, j3) - 1;
29214       return r2[i4](d2[i4](x2));
29215     };
29216   }
29217   function copy(source, target) {
29218     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
29219   }
29220   function transformer2() {
29221     var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp2 = identity4, piecewise, output, input;
29222     function rescale() {
29223       var n3 = Math.min(domain.length, range3.length);
29224       if (clamp2 !== identity4) clamp2 = clamper(domain[0], domain[n3 - 1]);
29225       piecewise = n3 > 2 ? polymap : bimap;
29226       output = input = null;
29227       return scale;
29228     }
29229     function scale(x2) {
29230       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp2(x2)));
29231     }
29232     scale.invert = function(y2) {
29233       return clamp2(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
29234     };
29235     scale.domain = function(_3) {
29236       return arguments.length ? (domain = Array.from(_3, number2), rescale()) : domain.slice();
29237     };
29238     scale.range = function(_3) {
29239       return arguments.length ? (range3 = Array.from(_3), rescale()) : range3.slice();
29240     };
29241     scale.rangeRound = function(_3) {
29242       return range3 = Array.from(_3), interpolate = round_default, rescale();
29243     };
29244     scale.clamp = function(_3) {
29245       return arguments.length ? (clamp2 = _3 ? true : identity4, rescale()) : clamp2 !== identity4;
29246     };
29247     scale.interpolate = function(_3) {
29248       return arguments.length ? (interpolate = _3, rescale()) : interpolate;
29249     };
29250     scale.unknown = function(_3) {
29251       return arguments.length ? (unknown = _3, scale) : unknown;
29252     };
29253     return function(t2, u2) {
29254       transform2 = t2, untransform = u2;
29255       return rescale();
29256     };
29257   }
29258   function continuous() {
29259     return transformer2()(identity4, identity4);
29260   }
29261   var unit;
29262   var init_continuous = __esm({
29263     "node_modules/d3-scale/src/continuous.js"() {
29264       init_src();
29265       init_src8();
29266       init_constant6();
29267       init_number3();
29268       unit = [0, 1];
29269     }
29270   });
29271
29272   // node_modules/d3-format/src/formatDecimal.js
29273   function formatDecimal_default(x2) {
29274     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
29275   }
29276   function formatDecimalParts(x2, p2) {
29277     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
29278     var i3, coefficient = x2.slice(0, i3);
29279     return [
29280       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
29281       +x2.slice(i3 + 1)
29282     ];
29283   }
29284   var init_formatDecimal = __esm({
29285     "node_modules/d3-format/src/formatDecimal.js"() {
29286     }
29287   });
29288
29289   // node_modules/d3-format/src/exponent.js
29290   function exponent_default(x2) {
29291     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
29292   }
29293   var init_exponent = __esm({
29294     "node_modules/d3-format/src/exponent.js"() {
29295       init_formatDecimal();
29296     }
29297   });
29298
29299   // node_modules/d3-format/src/formatGroup.js
29300   function formatGroup_default(grouping, thousands) {
29301     return function(value, width) {
29302       var i3 = value.length, t2 = [], j3 = 0, g3 = grouping[0], length2 = 0;
29303       while (i3 > 0 && g3 > 0) {
29304         if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
29305         t2.push(value.substring(i3 -= g3, i3 + g3));
29306         if ((length2 += g3 + 1) > width) break;
29307         g3 = grouping[j3 = (j3 + 1) % grouping.length];
29308       }
29309       return t2.reverse().join(thousands);
29310     };
29311   }
29312   var init_formatGroup = __esm({
29313     "node_modules/d3-format/src/formatGroup.js"() {
29314     }
29315   });
29316
29317   // node_modules/d3-format/src/formatNumerals.js
29318   function formatNumerals_default(numerals) {
29319     return function(value) {
29320       return value.replace(/[0-9]/g, function(i3) {
29321         return numerals[+i3];
29322       });
29323     };
29324   }
29325   var init_formatNumerals = __esm({
29326     "node_modules/d3-format/src/formatNumerals.js"() {
29327     }
29328   });
29329
29330   // node_modules/d3-format/src/formatSpecifier.js
29331   function formatSpecifier(specifier) {
29332     if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
29333     var match;
29334     return new FormatSpecifier({
29335       fill: match[1],
29336       align: match[2],
29337       sign: match[3],
29338       symbol: match[4],
29339       zero: match[5],
29340       width: match[6],
29341       comma: match[7],
29342       precision: match[8] && match[8].slice(1),
29343       trim: match[9],
29344       type: match[10]
29345     });
29346   }
29347   function FormatSpecifier(specifier) {
29348     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
29349     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
29350     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
29351     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
29352     this.zero = !!specifier.zero;
29353     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
29354     this.comma = !!specifier.comma;
29355     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
29356     this.trim = !!specifier.trim;
29357     this.type = specifier.type === void 0 ? "" : specifier.type + "";
29358   }
29359   var re;
29360   var init_formatSpecifier = __esm({
29361     "node_modules/d3-format/src/formatSpecifier.js"() {
29362       re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
29363       formatSpecifier.prototype = FormatSpecifier.prototype;
29364       FormatSpecifier.prototype.toString = function() {
29365         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;
29366       };
29367     }
29368   });
29369
29370   // node_modules/d3-format/src/formatTrim.js
29371   function formatTrim_default(s2) {
29372     out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
29373       switch (s2[i3]) {
29374         case ".":
29375           i0 = i1 = i3;
29376           break;
29377         case "0":
29378           if (i0 === 0) i0 = i3;
29379           i1 = i3;
29380           break;
29381         default:
29382           if (!+s2[i3]) break out;
29383           if (i0 > 0) i0 = 0;
29384           break;
29385       }
29386     }
29387     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
29388   }
29389   var init_formatTrim = __esm({
29390     "node_modules/d3-format/src/formatTrim.js"() {
29391     }
29392   });
29393
29394   // node_modules/d3-format/src/formatPrefixAuto.js
29395   function formatPrefixAuto_default(x2, p2) {
29396     var d2 = formatDecimalParts(x2, p2);
29397     if (!d2) return x2 + "";
29398     var coefficient = d2[0], exponent = d2[1], i3 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n3 = coefficient.length;
29399     return i3 === n3 ? coefficient : i3 > n3 ? coefficient + new Array(i3 - n3 + 1).join("0") : i3 > 0 ? coefficient.slice(0, i3) + "." + coefficient.slice(i3) : "0." + new Array(1 - i3).join("0") + formatDecimalParts(x2, Math.max(0, p2 + i3 - 1))[0];
29400   }
29401   var prefixExponent;
29402   var init_formatPrefixAuto = __esm({
29403     "node_modules/d3-format/src/formatPrefixAuto.js"() {
29404       init_formatDecimal();
29405     }
29406   });
29407
29408   // node_modules/d3-format/src/formatRounded.js
29409   function formatRounded_default(x2, p2) {
29410     var d2 = formatDecimalParts(x2, p2);
29411     if (!d2) return x2 + "";
29412     var coefficient = d2[0], exponent = d2[1];
29413     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");
29414   }
29415   var init_formatRounded = __esm({
29416     "node_modules/d3-format/src/formatRounded.js"() {
29417       init_formatDecimal();
29418     }
29419   });
29420
29421   // node_modules/d3-format/src/formatTypes.js
29422   var formatTypes_default;
29423   var init_formatTypes = __esm({
29424     "node_modules/d3-format/src/formatTypes.js"() {
29425       init_formatDecimal();
29426       init_formatPrefixAuto();
29427       init_formatRounded();
29428       formatTypes_default = {
29429         "%": (x2, p2) => (x2 * 100).toFixed(p2),
29430         "b": (x2) => Math.round(x2).toString(2),
29431         "c": (x2) => x2 + "",
29432         "d": formatDecimal_default,
29433         "e": (x2, p2) => x2.toExponential(p2),
29434         "f": (x2, p2) => x2.toFixed(p2),
29435         "g": (x2, p2) => x2.toPrecision(p2),
29436         "o": (x2) => Math.round(x2).toString(8),
29437         "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
29438         "r": formatRounded_default,
29439         "s": formatPrefixAuto_default,
29440         "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
29441         "x": (x2) => Math.round(x2).toString(16)
29442       };
29443     }
29444   });
29445
29446   // node_modules/d3-format/src/identity.js
29447   function identity_default5(x2) {
29448     return x2;
29449   }
29450   var init_identity4 = __esm({
29451     "node_modules/d3-format/src/identity.js"() {
29452     }
29453   });
29454
29455   // node_modules/d3-format/src/locale.js
29456   function locale_default(locale3) {
29457     var group = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default5 : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default5 : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "\u2212" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + "";
29458     function newFormat(specifier) {
29459       specifier = formatSpecifier(specifier);
29460       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision3 = specifier.precision, trim = specifier.trim, type2 = specifier.type;
29461       if (type2 === "n") comma = true, type2 = "g";
29462       else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
29463       if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
29464       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
29465       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
29466       precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
29467       function format2(value) {
29468         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
29469         if (type2 === "c") {
29470           valueSuffix = formatType(value) + valueSuffix;
29471           value = "";
29472         } else {
29473           value = +value;
29474           var valueNegative = value < 0 || 1 / value < 0;
29475           value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
29476           if (trim) value = formatTrim_default(value);
29477           if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
29478           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
29479           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
29480           if (maybeSuffix) {
29481             i3 = -1, n3 = value.length;
29482             while (++i3 < n3) {
29483               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
29484                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
29485                 value = value.slice(0, i3);
29486                 break;
29487               }
29488             }
29489           }
29490         }
29491         if (comma && !zero3) value = group(value, Infinity);
29492         var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
29493         if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
29494         switch (align) {
29495           case "<":
29496             value = valuePrefix + value + valueSuffix + padding;
29497             break;
29498           case "=":
29499             value = valuePrefix + padding + value + valueSuffix;
29500             break;
29501           case "^":
29502             value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
29503             break;
29504           default:
29505             value = padding + valuePrefix + value + valueSuffix;
29506             break;
29507         }
29508         return numerals(value);
29509       }
29510       format2.toString = function() {
29511         return specifier + "";
29512       };
29513       return format2;
29514     }
29515     function formatPrefix2(specifier, value) {
29516       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k3 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
29517       return function(value2) {
29518         return f2(k3 * value2) + prefix;
29519       };
29520     }
29521     return {
29522       format: newFormat,
29523       formatPrefix: formatPrefix2
29524     };
29525   }
29526   var map, prefixes;
29527   var init_locale = __esm({
29528     "node_modules/d3-format/src/locale.js"() {
29529       init_exponent();
29530       init_formatGroup();
29531       init_formatNumerals();
29532       init_formatSpecifier();
29533       init_formatTrim();
29534       init_formatTypes();
29535       init_formatPrefixAuto();
29536       init_identity4();
29537       map = Array.prototype.map;
29538       prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
29539     }
29540   });
29541
29542   // node_modules/d3-format/src/defaultLocale.js
29543   function defaultLocale(definition) {
29544     locale = locale_default(definition);
29545     format = locale.format;
29546     formatPrefix = locale.formatPrefix;
29547     return locale;
29548   }
29549   var locale, format, formatPrefix;
29550   var init_defaultLocale = __esm({
29551     "node_modules/d3-format/src/defaultLocale.js"() {
29552       init_locale();
29553       defaultLocale({
29554         thousands: ",",
29555         grouping: [3],
29556         currency: ["$", ""]
29557       });
29558     }
29559   });
29560
29561   // node_modules/d3-format/src/precisionFixed.js
29562   function precisionFixed_default(step) {
29563     return Math.max(0, -exponent_default(Math.abs(step)));
29564   }
29565   var init_precisionFixed = __esm({
29566     "node_modules/d3-format/src/precisionFixed.js"() {
29567       init_exponent();
29568     }
29569   });
29570
29571   // node_modules/d3-format/src/precisionPrefix.js
29572   function precisionPrefix_default(step, value) {
29573     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
29574   }
29575   var init_precisionPrefix = __esm({
29576     "node_modules/d3-format/src/precisionPrefix.js"() {
29577       init_exponent();
29578     }
29579   });
29580
29581   // node_modules/d3-format/src/precisionRound.js
29582   function precisionRound_default(step, max3) {
29583     step = Math.abs(step), max3 = Math.abs(max3) - step;
29584     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
29585   }
29586   var init_precisionRound = __esm({
29587     "node_modules/d3-format/src/precisionRound.js"() {
29588       init_exponent();
29589     }
29590   });
29591
29592   // node_modules/d3-format/src/index.js
29593   var init_src13 = __esm({
29594     "node_modules/d3-format/src/index.js"() {
29595       init_defaultLocale();
29596       init_formatSpecifier();
29597       init_precisionFixed();
29598       init_precisionPrefix();
29599       init_precisionRound();
29600     }
29601   });
29602
29603   // node_modules/d3-scale/src/tickFormat.js
29604   function tickFormat(start2, stop, count, specifier) {
29605     var step = tickStep(start2, stop, count), precision3;
29606     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
29607     switch (specifier.type) {
29608       case "s": {
29609         var value = Math.max(Math.abs(start2), Math.abs(stop));
29610         if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
29611         return formatPrefix(specifier, value);
29612       }
29613       case "":
29614       case "e":
29615       case "g":
29616       case "p":
29617       case "r": {
29618         if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
29619         break;
29620       }
29621       case "f":
29622       case "%": {
29623         if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
29624         break;
29625       }
29626     }
29627     return format(specifier);
29628   }
29629   var init_tickFormat = __esm({
29630     "node_modules/d3-scale/src/tickFormat.js"() {
29631       init_src();
29632       init_src13();
29633     }
29634   });
29635
29636   // node_modules/d3-scale/src/linear.js
29637   function linearish(scale) {
29638     var domain = scale.domain;
29639     scale.ticks = function(count) {
29640       var d2 = domain();
29641       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
29642     };
29643     scale.tickFormat = function(count, specifier) {
29644       var d2 = domain();
29645       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
29646     };
29647     scale.nice = function(count) {
29648       if (count == null) count = 10;
29649       var d2 = domain();
29650       var i0 = 0;
29651       var i1 = d2.length - 1;
29652       var start2 = d2[i0];
29653       var stop = d2[i1];
29654       var prestep;
29655       var step;
29656       var maxIter = 10;
29657       if (stop < start2) {
29658         step = start2, start2 = stop, stop = step;
29659         step = i0, i0 = i1, i1 = step;
29660       }
29661       while (maxIter-- > 0) {
29662         step = tickIncrement(start2, stop, count);
29663         if (step === prestep) {
29664           d2[i0] = start2;
29665           d2[i1] = stop;
29666           return domain(d2);
29667         } else if (step > 0) {
29668           start2 = Math.floor(start2 / step) * step;
29669           stop = Math.ceil(stop / step) * step;
29670         } else if (step < 0) {
29671           start2 = Math.ceil(start2 * step) / step;
29672           stop = Math.floor(stop * step) / step;
29673         } else {
29674           break;
29675         }
29676         prestep = step;
29677       }
29678       return scale;
29679     };
29680     return scale;
29681   }
29682   function linear3() {
29683     var scale = continuous();
29684     scale.copy = function() {
29685       return copy(scale, linear3());
29686     };
29687     initRange.apply(scale, arguments);
29688     return linearish(scale);
29689   }
29690   var init_linear2 = __esm({
29691     "node_modules/d3-scale/src/linear.js"() {
29692       init_src();
29693       init_continuous();
29694       init_init();
29695       init_tickFormat();
29696     }
29697   });
29698
29699   // node_modules/d3-scale/src/quantize.js
29700   function quantize() {
29701     var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
29702     function scale(x2) {
29703       return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
29704     }
29705     function rescale() {
29706       var i3 = -1;
29707       domain = new Array(n3);
29708       while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
29709       return scale;
29710     }
29711     scale.domain = function(_3) {
29712       return arguments.length ? ([x05, x12] = _3, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
29713     };
29714     scale.range = function(_3) {
29715       return arguments.length ? (n3 = (range3 = Array.from(_3)).length - 1, rescale()) : range3.slice();
29716     };
29717     scale.invertExtent = function(y2) {
29718       var i3 = range3.indexOf(y2);
29719       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
29720     };
29721     scale.unknown = function(_3) {
29722       return arguments.length ? (unknown = _3, scale) : scale;
29723     };
29724     scale.thresholds = function() {
29725       return domain.slice();
29726     };
29727     scale.copy = function() {
29728       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
29729     };
29730     return initRange.apply(linearish(scale), arguments);
29731   }
29732   var init_quantize2 = __esm({
29733     "node_modules/d3-scale/src/quantize.js"() {
29734       init_src();
29735       init_linear2();
29736       init_init();
29737     }
29738   });
29739
29740   // node_modules/d3-time/src/interval.js
29741   function timeInterval(floori, offseti, count, field) {
29742     function interval2(date) {
29743       return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
29744     }
29745     interval2.floor = (date) => {
29746       return floori(date = /* @__PURE__ */ new Date(+date)), date;
29747     };
29748     interval2.ceil = (date) => {
29749       return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
29750     };
29751     interval2.round = (date) => {
29752       const d0 = interval2(date), d1 = interval2.ceil(date);
29753       return date - d0 < d1 - date ? d0 : d1;
29754     };
29755     interval2.offset = (date, step) => {
29756       return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
29757     };
29758     interval2.range = (start2, stop, step) => {
29759       const range3 = [];
29760       start2 = interval2.ceil(start2);
29761       step = step == null ? 1 : Math.floor(step);
29762       if (!(start2 < stop) || !(step > 0)) return range3;
29763       let previous;
29764       do
29765         range3.push(previous = /* @__PURE__ */ new Date(+start2)), offseti(start2, step), floori(start2);
29766       while (previous < start2 && start2 < stop);
29767       return range3;
29768     };
29769     interval2.filter = (test) => {
29770       return timeInterval((date) => {
29771         if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
29772       }, (date, step) => {
29773         if (date >= date) {
29774           if (step < 0) while (++step <= 0) {
29775             while (offseti(date, -1), !test(date)) {
29776             }
29777           }
29778           else while (--step >= 0) {
29779             while (offseti(date, 1), !test(date)) {
29780             }
29781           }
29782         }
29783       });
29784     };
29785     if (count) {
29786       interval2.count = (start2, end) => {
29787         t0.setTime(+start2), t1.setTime(+end);
29788         floori(t0), floori(t1);
29789         return Math.floor(count(t0, t1));
29790       };
29791       interval2.every = (step) => {
29792         step = Math.floor(step);
29793         return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? (d2) => field(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0);
29794       };
29795     }
29796     return interval2;
29797   }
29798   var t0, t1;
29799   var init_interval = __esm({
29800     "node_modules/d3-time/src/interval.js"() {
29801       t0 = /* @__PURE__ */ new Date();
29802       t1 = /* @__PURE__ */ new Date();
29803     }
29804   });
29805
29806   // node_modules/d3-time/src/duration.js
29807   var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear;
29808   var init_duration2 = __esm({
29809     "node_modules/d3-time/src/duration.js"() {
29810       durationSecond = 1e3;
29811       durationMinute = durationSecond * 60;
29812       durationHour = durationMinute * 60;
29813       durationDay = durationHour * 24;
29814       durationWeek = durationDay * 7;
29815       durationMonth = durationDay * 30;
29816       durationYear = durationDay * 365;
29817     }
29818   });
29819
29820   // node_modules/d3-time/src/day.js
29821   var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays;
29822   var init_day = __esm({
29823     "node_modules/d3-time/src/day.js"() {
29824       init_interval();
29825       init_duration2();
29826       timeDay = timeInterval(
29827         (date) => date.setHours(0, 0, 0, 0),
29828         (date, step) => date.setDate(date.getDate() + step),
29829         (start2, end) => (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay,
29830         (date) => date.getDate() - 1
29831       );
29832       timeDays = timeDay.range;
29833       utcDay = timeInterval((date) => {
29834         date.setUTCHours(0, 0, 0, 0);
29835       }, (date, step) => {
29836         date.setUTCDate(date.getUTCDate() + step);
29837       }, (start2, end) => {
29838         return (end - start2) / durationDay;
29839       }, (date) => {
29840         return date.getUTCDate() - 1;
29841       });
29842       utcDays = utcDay.range;
29843       unixDay = timeInterval((date) => {
29844         date.setUTCHours(0, 0, 0, 0);
29845       }, (date, step) => {
29846         date.setUTCDate(date.getUTCDate() + step);
29847       }, (start2, end) => {
29848         return (end - start2) / durationDay;
29849       }, (date) => {
29850         return Math.floor(date / durationDay);
29851       });
29852       unixDays = unixDay.range;
29853     }
29854   });
29855
29856   // node_modules/d3-time/src/week.js
29857   function timeWeekday(i3) {
29858     return timeInterval((date) => {
29859       date.setDate(date.getDate() - (date.getDay() + 7 - i3) % 7);
29860       date.setHours(0, 0, 0, 0);
29861     }, (date, step) => {
29862       date.setDate(date.getDate() + step * 7);
29863     }, (start2, end) => {
29864       return (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek;
29865     });
29866   }
29867   function utcWeekday(i3) {
29868     return timeInterval((date) => {
29869       date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i3) % 7);
29870       date.setUTCHours(0, 0, 0, 0);
29871     }, (date, step) => {
29872       date.setUTCDate(date.getUTCDate() + step * 7);
29873     }, (start2, end) => {
29874       return (end - start2) / durationWeek;
29875     });
29876   }
29877   var timeSunday, timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSundays, timeMondays, timeTuesdays, timeWednesdays, timeThursdays, timeFridays, timeSaturdays, utcSunday, utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSundays, utcMondays, utcTuesdays, utcWednesdays, utcThursdays, utcFridays, utcSaturdays;
29878   var init_week = __esm({
29879     "node_modules/d3-time/src/week.js"() {
29880       init_interval();
29881       init_duration2();
29882       timeSunday = timeWeekday(0);
29883       timeMonday = timeWeekday(1);
29884       timeTuesday = timeWeekday(2);
29885       timeWednesday = timeWeekday(3);
29886       timeThursday = timeWeekday(4);
29887       timeFriday = timeWeekday(5);
29888       timeSaturday = timeWeekday(6);
29889       timeSundays = timeSunday.range;
29890       timeMondays = timeMonday.range;
29891       timeTuesdays = timeTuesday.range;
29892       timeWednesdays = timeWednesday.range;
29893       timeThursdays = timeThursday.range;
29894       timeFridays = timeFriday.range;
29895       timeSaturdays = timeSaturday.range;
29896       utcSunday = utcWeekday(0);
29897       utcMonday = utcWeekday(1);
29898       utcTuesday = utcWeekday(2);
29899       utcWednesday = utcWeekday(3);
29900       utcThursday = utcWeekday(4);
29901       utcFriday = utcWeekday(5);
29902       utcSaturday = utcWeekday(6);
29903       utcSundays = utcSunday.range;
29904       utcMondays = utcMonday.range;
29905       utcTuesdays = utcTuesday.range;
29906       utcWednesdays = utcWednesday.range;
29907       utcThursdays = utcThursday.range;
29908       utcFridays = utcFriday.range;
29909       utcSaturdays = utcSaturday.range;
29910     }
29911   });
29912
29913   // node_modules/d3-time/src/year.js
29914   var timeYear, timeYears, utcYear, utcYears;
29915   var init_year = __esm({
29916     "node_modules/d3-time/src/year.js"() {
29917       init_interval();
29918       timeYear = timeInterval((date) => {
29919         date.setMonth(0, 1);
29920         date.setHours(0, 0, 0, 0);
29921       }, (date, step) => {
29922         date.setFullYear(date.getFullYear() + step);
29923       }, (start2, end) => {
29924         return end.getFullYear() - start2.getFullYear();
29925       }, (date) => {
29926         return date.getFullYear();
29927       });
29928       timeYear.every = (k3) => {
29929         return !isFinite(k3 = Math.floor(k3)) || !(k3 > 0) ? null : timeInterval((date) => {
29930           date.setFullYear(Math.floor(date.getFullYear() / k3) * k3);
29931           date.setMonth(0, 1);
29932           date.setHours(0, 0, 0, 0);
29933         }, (date, step) => {
29934           date.setFullYear(date.getFullYear() + step * k3);
29935         });
29936       };
29937       timeYears = timeYear.range;
29938       utcYear = timeInterval((date) => {
29939         date.setUTCMonth(0, 1);
29940         date.setUTCHours(0, 0, 0, 0);
29941       }, (date, step) => {
29942         date.setUTCFullYear(date.getUTCFullYear() + step);
29943       }, (start2, end) => {
29944         return end.getUTCFullYear() - start2.getUTCFullYear();
29945       }, (date) => {
29946         return date.getUTCFullYear();
29947       });
29948       utcYear.every = (k3) => {
29949         return !isFinite(k3 = Math.floor(k3)) || !(k3 > 0) ? null : timeInterval((date) => {
29950           date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k3) * k3);
29951           date.setUTCMonth(0, 1);
29952           date.setUTCHours(0, 0, 0, 0);
29953         }, (date, step) => {
29954           date.setUTCFullYear(date.getUTCFullYear() + step * k3);
29955         });
29956       };
29957       utcYears = utcYear.range;
29958     }
29959   });
29960
29961   // node_modules/d3-time/src/index.js
29962   var init_src14 = __esm({
29963     "node_modules/d3-time/src/index.js"() {
29964       init_day();
29965       init_week();
29966       init_year();
29967     }
29968   });
29969
29970   // node_modules/d3-time-format/src/locale.js
29971   function localDate(d2) {
29972     if (0 <= d2.y && d2.y < 100) {
29973       var date = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
29974       date.setFullYear(d2.y);
29975       return date;
29976     }
29977     return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
29978   }
29979   function utcDate(d2) {
29980     if (0 <= d2.y && d2.y < 100) {
29981       var date = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
29982       date.setUTCFullYear(d2.y);
29983       return date;
29984     }
29985     return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
29986   }
29987   function newDate(y2, m3, d2) {
29988     return { y: y2, m: m3, d: d2, H: 0, M: 0, S: 0, L: 0 };
29989   }
29990   function formatLocale(locale3) {
29991     var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths;
29992     var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
29993     var formats = {
29994       "a": formatShortWeekday,
29995       "A": formatWeekday,
29996       "b": formatShortMonth,
29997       "B": formatMonth,
29998       "c": null,
29999       "d": formatDayOfMonth,
30000       "e": formatDayOfMonth,
30001       "f": formatMicroseconds,
30002       "g": formatYearISO,
30003       "G": formatFullYearISO,
30004       "H": formatHour24,
30005       "I": formatHour12,
30006       "j": formatDayOfYear,
30007       "L": formatMilliseconds,
30008       "m": formatMonthNumber,
30009       "M": formatMinutes,
30010       "p": formatPeriod,
30011       "q": formatQuarter,
30012       "Q": formatUnixTimestamp,
30013       "s": formatUnixTimestampSeconds,
30014       "S": formatSeconds,
30015       "u": formatWeekdayNumberMonday,
30016       "U": formatWeekNumberSunday,
30017       "V": formatWeekNumberISO,
30018       "w": formatWeekdayNumberSunday,
30019       "W": formatWeekNumberMonday,
30020       "x": null,
30021       "X": null,
30022       "y": formatYear,
30023       "Y": formatFullYear,
30024       "Z": formatZone,
30025       "%": formatLiteralPercent
30026     };
30027     var utcFormats = {
30028       "a": formatUTCShortWeekday,
30029       "A": formatUTCWeekday,
30030       "b": formatUTCShortMonth,
30031       "B": formatUTCMonth,
30032       "c": null,
30033       "d": formatUTCDayOfMonth,
30034       "e": formatUTCDayOfMonth,
30035       "f": formatUTCMicroseconds,
30036       "g": formatUTCYearISO,
30037       "G": formatUTCFullYearISO,
30038       "H": formatUTCHour24,
30039       "I": formatUTCHour12,
30040       "j": formatUTCDayOfYear,
30041       "L": formatUTCMilliseconds,
30042       "m": formatUTCMonthNumber,
30043       "M": formatUTCMinutes,
30044       "p": formatUTCPeriod,
30045       "q": formatUTCQuarter,
30046       "Q": formatUnixTimestamp,
30047       "s": formatUnixTimestampSeconds,
30048       "S": formatUTCSeconds,
30049       "u": formatUTCWeekdayNumberMonday,
30050       "U": formatUTCWeekNumberSunday,
30051       "V": formatUTCWeekNumberISO,
30052       "w": formatUTCWeekdayNumberSunday,
30053       "W": formatUTCWeekNumberMonday,
30054       "x": null,
30055       "X": null,
30056       "y": formatUTCYear,
30057       "Y": formatUTCFullYear,
30058       "Z": formatUTCZone,
30059       "%": formatLiteralPercent
30060     };
30061     var parses = {
30062       "a": parseShortWeekday,
30063       "A": parseWeekday,
30064       "b": parseShortMonth,
30065       "B": parseMonth,
30066       "c": parseLocaleDateTime,
30067       "d": parseDayOfMonth,
30068       "e": parseDayOfMonth,
30069       "f": parseMicroseconds,
30070       "g": parseYear,
30071       "G": parseFullYear,
30072       "H": parseHour24,
30073       "I": parseHour24,
30074       "j": parseDayOfYear,
30075       "L": parseMilliseconds,
30076       "m": parseMonthNumber,
30077       "M": parseMinutes,
30078       "p": parsePeriod,
30079       "q": parseQuarter,
30080       "Q": parseUnixTimestamp,
30081       "s": parseUnixTimestampSeconds,
30082       "S": parseSeconds,
30083       "u": parseWeekdayNumberMonday,
30084       "U": parseWeekNumberSunday,
30085       "V": parseWeekNumberISO,
30086       "w": parseWeekdayNumberSunday,
30087       "W": parseWeekNumberMonday,
30088       "x": parseLocaleDate,
30089       "X": parseLocaleTime,
30090       "y": parseYear,
30091       "Y": parseFullYear,
30092       "Z": parseZone,
30093       "%": parseLiteralPercent
30094     };
30095     formats.x = newFormat(locale_date, formats);
30096     formats.X = newFormat(locale_time, formats);
30097     formats.c = newFormat(locale_dateTime, formats);
30098     utcFormats.x = newFormat(locale_date, utcFormats);
30099     utcFormats.X = newFormat(locale_time, utcFormats);
30100     utcFormats.c = newFormat(locale_dateTime, utcFormats);
30101     function newFormat(specifier, formats2) {
30102       return function(date) {
30103         var string = [], i3 = -1, j3 = 0, n3 = specifier.length, c2, pad3, format2;
30104         if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
30105         while (++i3 < n3) {
30106           if (specifier.charCodeAt(i3) === 37) {
30107             string.push(specifier.slice(j3, i3));
30108             if ((pad3 = pads[c2 = specifier.charAt(++i3)]) != null) c2 = specifier.charAt(++i3);
30109             else pad3 = c2 === "e" ? " " : "0";
30110             if (format2 = formats2[c2]) c2 = format2(date, pad3);
30111             string.push(c2);
30112             j3 = i3 + 1;
30113           }
30114         }
30115         string.push(specifier.slice(j3, i3));
30116         return string.join("");
30117       };
30118     }
30119     function newParse(specifier, Z3) {
30120       return function(string) {
30121         var d2 = newDate(1900, void 0, 1), i3 = parseSpecifier(d2, specifier, string += "", 0), week, day;
30122         if (i3 != string.length) return null;
30123         if ("Q" in d2) return new Date(d2.Q);
30124         if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0));
30125         if (Z3 && !("Z" in d2)) d2.Z = 0;
30126         if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12;
30127         if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0;
30128         if ("V" in d2) {
30129           if (d2.V < 1 || d2.V > 53) return null;
30130           if (!("w" in d2)) d2.w = 1;
30131           if ("Z" in d2) {
30132             week = utcDate(newDate(d2.y, 0, 1)), day = week.getUTCDay();
30133             week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
30134             week = utcDay.offset(week, (d2.V - 1) * 7);
30135             d2.y = week.getUTCFullYear();
30136             d2.m = week.getUTCMonth();
30137             d2.d = week.getUTCDate() + (d2.w + 6) % 7;
30138           } else {
30139             week = localDate(newDate(d2.y, 0, 1)), day = week.getDay();
30140             week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
30141             week = timeDay.offset(week, (d2.V - 1) * 7);
30142             d2.y = week.getFullYear();
30143             d2.m = week.getMonth();
30144             d2.d = week.getDate() + (d2.w + 6) % 7;
30145           }
30146         } else if ("W" in d2 || "U" in d2) {
30147           if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0;
30148           day = "Z" in d2 ? utcDate(newDate(d2.y, 0, 1)).getUTCDay() : localDate(newDate(d2.y, 0, 1)).getDay();
30149           d2.m = 0;
30150           d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7;
30151         }
30152         if ("Z" in d2) {
30153           d2.H += d2.Z / 100 | 0;
30154           d2.M += d2.Z % 100;
30155           return utcDate(d2);
30156         }
30157         return localDate(d2);
30158       };
30159     }
30160     function parseSpecifier(d2, specifier, string, j3) {
30161       var i3 = 0, n3 = specifier.length, m3 = string.length, c2, parse;
30162       while (i3 < n3) {
30163         if (j3 >= m3) return -1;
30164         c2 = specifier.charCodeAt(i3++);
30165         if (c2 === 37) {
30166           c2 = specifier.charAt(i3++);
30167           parse = parses[c2 in pads ? specifier.charAt(i3++) : c2];
30168           if (!parse || (j3 = parse(d2, string, j3)) < 0) return -1;
30169         } else if (c2 != string.charCodeAt(j3++)) {
30170           return -1;
30171         }
30172       }
30173       return j3;
30174     }
30175     function parsePeriod(d2, string, i3) {
30176       var n3 = periodRe.exec(string.slice(i3));
30177       return n3 ? (d2.p = periodLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30178     }
30179     function parseShortWeekday(d2, string, i3) {
30180       var n3 = shortWeekdayRe.exec(string.slice(i3));
30181       return n3 ? (d2.w = shortWeekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30182     }
30183     function parseWeekday(d2, string, i3) {
30184       var n3 = weekdayRe.exec(string.slice(i3));
30185       return n3 ? (d2.w = weekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30186     }
30187     function parseShortMonth(d2, string, i3) {
30188       var n3 = shortMonthRe.exec(string.slice(i3));
30189       return n3 ? (d2.m = shortMonthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30190     }
30191     function parseMonth(d2, string, i3) {
30192       var n3 = monthRe.exec(string.slice(i3));
30193       return n3 ? (d2.m = monthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
30194     }
30195     function parseLocaleDateTime(d2, string, i3) {
30196       return parseSpecifier(d2, locale_dateTime, string, i3);
30197     }
30198     function parseLocaleDate(d2, string, i3) {
30199       return parseSpecifier(d2, locale_date, string, i3);
30200     }
30201     function parseLocaleTime(d2, string, i3) {
30202       return parseSpecifier(d2, locale_time, string, i3);
30203     }
30204     function formatShortWeekday(d2) {
30205       return locale_shortWeekdays[d2.getDay()];
30206     }
30207     function formatWeekday(d2) {
30208       return locale_weekdays[d2.getDay()];
30209     }
30210     function formatShortMonth(d2) {
30211       return locale_shortMonths[d2.getMonth()];
30212     }
30213     function formatMonth(d2) {
30214       return locale_months[d2.getMonth()];
30215     }
30216     function formatPeriod(d2) {
30217       return locale_periods[+(d2.getHours() >= 12)];
30218     }
30219     function formatQuarter(d2) {
30220       return 1 + ~~(d2.getMonth() / 3);
30221     }
30222     function formatUTCShortWeekday(d2) {
30223       return locale_shortWeekdays[d2.getUTCDay()];
30224     }
30225     function formatUTCWeekday(d2) {
30226       return locale_weekdays[d2.getUTCDay()];
30227     }
30228     function formatUTCShortMonth(d2) {
30229       return locale_shortMonths[d2.getUTCMonth()];
30230     }
30231     function formatUTCMonth(d2) {
30232       return locale_months[d2.getUTCMonth()];
30233     }
30234     function formatUTCPeriod(d2) {
30235       return locale_periods[+(d2.getUTCHours() >= 12)];
30236     }
30237     function formatUTCQuarter(d2) {
30238       return 1 + ~~(d2.getUTCMonth() / 3);
30239     }
30240     return {
30241       format: function(specifier) {
30242         var f2 = newFormat(specifier += "", formats);
30243         f2.toString = function() {
30244           return specifier;
30245         };
30246         return f2;
30247       },
30248       parse: function(specifier) {
30249         var p2 = newParse(specifier += "", false);
30250         p2.toString = function() {
30251           return specifier;
30252         };
30253         return p2;
30254       },
30255       utcFormat: function(specifier) {
30256         var f2 = newFormat(specifier += "", utcFormats);
30257         f2.toString = function() {
30258           return specifier;
30259         };
30260         return f2;
30261       },
30262       utcParse: function(specifier) {
30263         var p2 = newParse(specifier += "", true);
30264         p2.toString = function() {
30265           return specifier;
30266         };
30267         return p2;
30268       }
30269     };
30270   }
30271   function pad(value, fill, width) {
30272     var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length;
30273     return sign2 + (length2 < width ? new Array(width - length2 + 1).join(fill) + string : string);
30274   }
30275   function requote(s2) {
30276     return s2.replace(requoteRe, "\\$&");
30277   }
30278   function formatRe(names) {
30279     return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
30280   }
30281   function formatLookup(names) {
30282     return new Map(names.map((name, i3) => [name.toLowerCase(), i3]));
30283   }
30284   function parseWeekdayNumberSunday(d2, string, i3) {
30285     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30286     return n3 ? (d2.w = +n3[0], i3 + n3[0].length) : -1;
30287   }
30288   function parseWeekdayNumberMonday(d2, string, i3) {
30289     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30290     return n3 ? (d2.u = +n3[0], i3 + n3[0].length) : -1;
30291   }
30292   function parseWeekNumberSunday(d2, string, i3) {
30293     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30294     return n3 ? (d2.U = +n3[0], i3 + n3[0].length) : -1;
30295   }
30296   function parseWeekNumberISO(d2, string, i3) {
30297     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30298     return n3 ? (d2.V = +n3[0], i3 + n3[0].length) : -1;
30299   }
30300   function parseWeekNumberMonday(d2, string, i3) {
30301     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30302     return n3 ? (d2.W = +n3[0], i3 + n3[0].length) : -1;
30303   }
30304   function parseFullYear(d2, string, i3) {
30305     var n3 = numberRe.exec(string.slice(i3, i3 + 4));
30306     return n3 ? (d2.y = +n3[0], i3 + n3[0].length) : -1;
30307   }
30308   function parseYear(d2, string, i3) {
30309     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30310     return n3 ? (d2.y = +n3[0] + (+n3[0] > 68 ? 1900 : 2e3), i3 + n3[0].length) : -1;
30311   }
30312   function parseZone(d2, string, i3) {
30313     var n3 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i3, i3 + 6));
30314     return n3 ? (d2.Z = n3[1] ? 0 : -(n3[2] + (n3[3] || "00")), i3 + n3[0].length) : -1;
30315   }
30316   function parseQuarter(d2, string, i3) {
30317     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
30318     return n3 ? (d2.q = n3[0] * 3 - 3, i3 + n3[0].length) : -1;
30319   }
30320   function parseMonthNumber(d2, string, i3) {
30321     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30322     return n3 ? (d2.m = n3[0] - 1, i3 + n3[0].length) : -1;
30323   }
30324   function parseDayOfMonth(d2, string, i3) {
30325     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30326     return n3 ? (d2.d = +n3[0], i3 + n3[0].length) : -1;
30327   }
30328   function parseDayOfYear(d2, string, i3) {
30329     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
30330     return n3 ? (d2.m = 0, d2.d = +n3[0], i3 + n3[0].length) : -1;
30331   }
30332   function parseHour24(d2, string, i3) {
30333     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30334     return n3 ? (d2.H = +n3[0], i3 + n3[0].length) : -1;
30335   }
30336   function parseMinutes(d2, string, i3) {
30337     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30338     return n3 ? (d2.M = +n3[0], i3 + n3[0].length) : -1;
30339   }
30340   function parseSeconds(d2, string, i3) {
30341     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
30342     return n3 ? (d2.S = +n3[0], i3 + n3[0].length) : -1;
30343   }
30344   function parseMilliseconds(d2, string, i3) {
30345     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
30346     return n3 ? (d2.L = +n3[0], i3 + n3[0].length) : -1;
30347   }
30348   function parseMicroseconds(d2, string, i3) {
30349     var n3 = numberRe.exec(string.slice(i3, i3 + 6));
30350     return n3 ? (d2.L = Math.floor(n3[0] / 1e3), i3 + n3[0].length) : -1;
30351   }
30352   function parseLiteralPercent(d2, string, i3) {
30353     var n3 = percentRe.exec(string.slice(i3, i3 + 1));
30354     return n3 ? i3 + n3[0].length : -1;
30355   }
30356   function parseUnixTimestamp(d2, string, i3) {
30357     var n3 = numberRe.exec(string.slice(i3));
30358     return n3 ? (d2.Q = +n3[0], i3 + n3[0].length) : -1;
30359   }
30360   function parseUnixTimestampSeconds(d2, string, i3) {
30361     var n3 = numberRe.exec(string.slice(i3));
30362     return n3 ? (d2.s = +n3[0], i3 + n3[0].length) : -1;
30363   }
30364   function formatDayOfMonth(d2, p2) {
30365     return pad(d2.getDate(), p2, 2);
30366   }
30367   function formatHour24(d2, p2) {
30368     return pad(d2.getHours(), p2, 2);
30369   }
30370   function formatHour12(d2, p2) {
30371     return pad(d2.getHours() % 12 || 12, p2, 2);
30372   }
30373   function formatDayOfYear(d2, p2) {
30374     return pad(1 + timeDay.count(timeYear(d2), d2), p2, 3);
30375   }
30376   function formatMilliseconds(d2, p2) {
30377     return pad(d2.getMilliseconds(), p2, 3);
30378   }
30379   function formatMicroseconds(d2, p2) {
30380     return formatMilliseconds(d2, p2) + "000";
30381   }
30382   function formatMonthNumber(d2, p2) {
30383     return pad(d2.getMonth() + 1, p2, 2);
30384   }
30385   function formatMinutes(d2, p2) {
30386     return pad(d2.getMinutes(), p2, 2);
30387   }
30388   function formatSeconds(d2, p2) {
30389     return pad(d2.getSeconds(), p2, 2);
30390   }
30391   function formatWeekdayNumberMonday(d2) {
30392     var day = d2.getDay();
30393     return day === 0 ? 7 : day;
30394   }
30395   function formatWeekNumberSunday(d2, p2) {
30396     return pad(timeSunday.count(timeYear(d2) - 1, d2), p2, 2);
30397   }
30398   function dISO(d2) {
30399     var day = d2.getDay();
30400     return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
30401   }
30402   function formatWeekNumberISO(d2, p2) {
30403     d2 = dISO(d2);
30404     return pad(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p2, 2);
30405   }
30406   function formatWeekdayNumberSunday(d2) {
30407     return d2.getDay();
30408   }
30409   function formatWeekNumberMonday(d2, p2) {
30410     return pad(timeMonday.count(timeYear(d2) - 1, d2), p2, 2);
30411   }
30412   function formatYear(d2, p2) {
30413     return pad(d2.getFullYear() % 100, p2, 2);
30414   }
30415   function formatYearISO(d2, p2) {
30416     d2 = dISO(d2);
30417     return pad(d2.getFullYear() % 100, p2, 2);
30418   }
30419   function formatFullYear(d2, p2) {
30420     return pad(d2.getFullYear() % 1e4, p2, 4);
30421   }
30422   function formatFullYearISO(d2, p2) {
30423     var day = d2.getDay();
30424     d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
30425     return pad(d2.getFullYear() % 1e4, p2, 4);
30426   }
30427   function formatZone(d2) {
30428     var z3 = d2.getTimezoneOffset();
30429     return (z3 > 0 ? "-" : (z3 *= -1, "+")) + pad(z3 / 60 | 0, "0", 2) + pad(z3 % 60, "0", 2);
30430   }
30431   function formatUTCDayOfMonth(d2, p2) {
30432     return pad(d2.getUTCDate(), p2, 2);
30433   }
30434   function formatUTCHour24(d2, p2) {
30435     return pad(d2.getUTCHours(), p2, 2);
30436   }
30437   function formatUTCHour12(d2, p2) {
30438     return pad(d2.getUTCHours() % 12 || 12, p2, 2);
30439   }
30440   function formatUTCDayOfYear(d2, p2) {
30441     return pad(1 + utcDay.count(utcYear(d2), d2), p2, 3);
30442   }
30443   function formatUTCMilliseconds(d2, p2) {
30444     return pad(d2.getUTCMilliseconds(), p2, 3);
30445   }
30446   function formatUTCMicroseconds(d2, p2) {
30447     return formatUTCMilliseconds(d2, p2) + "000";
30448   }
30449   function formatUTCMonthNumber(d2, p2) {
30450     return pad(d2.getUTCMonth() + 1, p2, 2);
30451   }
30452   function formatUTCMinutes(d2, p2) {
30453     return pad(d2.getUTCMinutes(), p2, 2);
30454   }
30455   function formatUTCSeconds(d2, p2) {
30456     return pad(d2.getUTCSeconds(), p2, 2);
30457   }
30458   function formatUTCWeekdayNumberMonday(d2) {
30459     var dow = d2.getUTCDay();
30460     return dow === 0 ? 7 : dow;
30461   }
30462   function formatUTCWeekNumberSunday(d2, p2) {
30463     return pad(utcSunday.count(utcYear(d2) - 1, d2), p2, 2);
30464   }
30465   function UTCdISO(d2) {
30466     var day = d2.getUTCDay();
30467     return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
30468   }
30469   function formatUTCWeekNumberISO(d2, p2) {
30470     d2 = UTCdISO(d2);
30471     return pad(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p2, 2);
30472   }
30473   function formatUTCWeekdayNumberSunday(d2) {
30474     return d2.getUTCDay();
30475   }
30476   function formatUTCWeekNumberMonday(d2, p2) {
30477     return pad(utcMonday.count(utcYear(d2) - 1, d2), p2, 2);
30478   }
30479   function formatUTCYear(d2, p2) {
30480     return pad(d2.getUTCFullYear() % 100, p2, 2);
30481   }
30482   function formatUTCYearISO(d2, p2) {
30483     d2 = UTCdISO(d2);
30484     return pad(d2.getUTCFullYear() % 100, p2, 2);
30485   }
30486   function formatUTCFullYear(d2, p2) {
30487     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
30488   }
30489   function formatUTCFullYearISO(d2, p2) {
30490     var day = d2.getUTCDay();
30491     d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
30492     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
30493   }
30494   function formatUTCZone() {
30495     return "+0000";
30496   }
30497   function formatLiteralPercent() {
30498     return "%";
30499   }
30500   function formatUnixTimestamp(d2) {
30501     return +d2;
30502   }
30503   function formatUnixTimestampSeconds(d2) {
30504     return Math.floor(+d2 / 1e3);
30505   }
30506   var pads, numberRe, percentRe, requoteRe;
30507   var init_locale2 = __esm({
30508     "node_modules/d3-time-format/src/locale.js"() {
30509       init_src14();
30510       pads = { "-": "", "_": " ", "0": "0" };
30511       numberRe = /^\s*\d+/;
30512       percentRe = /^%/;
30513       requoteRe = /[\\^$*+?|[\]().{}]/g;
30514     }
30515   });
30516
30517   // node_modules/d3-time-format/src/defaultLocale.js
30518   function defaultLocale2(definition) {
30519     locale2 = formatLocale(definition);
30520     timeFormat = locale2.format;
30521     timeParse = locale2.parse;
30522     utcFormat = locale2.utcFormat;
30523     utcParse = locale2.utcParse;
30524     return locale2;
30525   }
30526   var locale2, timeFormat, timeParse, utcFormat, utcParse;
30527   var init_defaultLocale2 = __esm({
30528     "node_modules/d3-time-format/src/defaultLocale.js"() {
30529       init_locale2();
30530       defaultLocale2({
30531         dateTime: "%x, %X",
30532         date: "%-m/%-d/%Y",
30533         time: "%-I:%M:%S %p",
30534         periods: ["AM", "PM"],
30535         days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
30536         shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
30537         months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
30538         shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
30539       });
30540     }
30541   });
30542
30543   // node_modules/d3-time-format/src/index.js
30544   var init_src15 = __esm({
30545     "node_modules/d3-time-format/src/index.js"() {
30546       init_defaultLocale2();
30547     }
30548   });
30549
30550   // node_modules/d3-scale/src/index.js
30551   var init_src16 = __esm({
30552     "node_modules/d3-scale/src/index.js"() {
30553       init_linear2();
30554       init_quantize2();
30555     }
30556   });
30557
30558   // modules/behavior/breathe.js
30559   var breathe_exports = {};
30560   __export(breathe_exports, {
30561     behaviorBreathe: () => behaviorBreathe
30562   });
30563   function behaviorBreathe() {
30564     var duration = 800;
30565     var steps = 4;
30566     var selector = ".selected.shadow, .selected .shadow";
30567     var _selected = select_default2(null);
30568     var _classed = "";
30569     var _params = {};
30570     var _done = false;
30571     var _timer;
30572     function ratchetyInterpolator(a4, b3, steps2, units) {
30573       a4 = Number(a4);
30574       b3 = Number(b3);
30575       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a4, b3), steps2));
30576       return function(t2) {
30577         return String(sample(t2)) + (units || "");
30578       };
30579     }
30580     function reset(selection2) {
30581       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
30582     }
30583     function setAnimationParams(transition2, fromTo) {
30584       var toFrom = fromTo === "from" ? "to" : "from";
30585       transition2.styleTween("stroke-opacity", function(d2) {
30586         return ratchetyInterpolator(
30587           _params[d2.id][toFrom].opacity,
30588           _params[d2.id][fromTo].opacity,
30589           steps
30590         );
30591       }).styleTween("stroke-width", function(d2) {
30592         return ratchetyInterpolator(
30593           _params[d2.id][toFrom].width,
30594           _params[d2.id][fromTo].width,
30595           steps,
30596           "px"
30597         );
30598       }).styleTween("fill-opacity", function(d2) {
30599         return ratchetyInterpolator(
30600           _params[d2.id][toFrom].opacity,
30601           _params[d2.id][fromTo].opacity,
30602           steps
30603         );
30604       }).styleTween("r", function(d2) {
30605         return ratchetyInterpolator(
30606           _params[d2.id][toFrom].width,
30607           _params[d2.id][fromTo].width,
30608           steps,
30609           "px"
30610         );
30611       });
30612     }
30613     function calcAnimationParams(selection2) {
30614       selection2.call(reset).each(function(d2) {
30615         var s2 = select_default2(this);
30616         var tag = s2.node().tagName;
30617         var p2 = { "from": {}, "to": {} };
30618         var opacity;
30619         var width;
30620         if (tag === "circle") {
30621           opacity = Number(s2.style("fill-opacity") || 0.5);
30622           width = Number(s2.style("r") || 15.5);
30623         } else {
30624           opacity = Number(s2.style("stroke-opacity") || 0.7);
30625           width = Number(s2.style("stroke-width") || 10);
30626         }
30627         p2.tag = tag;
30628         p2.from.opacity = opacity * 0.6;
30629         p2.to.opacity = opacity * 1.25;
30630         p2.from.width = width * 0.7;
30631         p2.to.width = width * (tag === "circle" ? 1.5 : 1);
30632         _params[d2.id] = p2;
30633       });
30634     }
30635     function run(surface, fromTo) {
30636       var toFrom = fromTo === "from" ? "to" : "from";
30637       var currSelected = surface.selectAll(selector);
30638       var currClassed = surface.attr("class");
30639       if (_done || currSelected.empty()) {
30640         _selected.call(reset);
30641         _selected = select_default2(null);
30642         return;
30643       }
30644       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
30645         _selected.call(reset);
30646         _classed = currClassed;
30647         _selected = currSelected.call(calcAnimationParams);
30648       }
30649       var didCallNextRun = false;
30650       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
30651         if (!didCallNextRun) {
30652           surface.call(run, toFrom);
30653           didCallNextRun = true;
30654         }
30655         if (!select_default2(this).classed("selected")) {
30656           reset(select_default2(this));
30657         }
30658       });
30659     }
30660     function behavior(surface) {
30661       _done = false;
30662       _timer = timer(function() {
30663         if (surface.selectAll(selector).empty()) {
30664           return false;
30665         }
30666         surface.call(run, "from");
30667         _timer.stop();
30668         return true;
30669       }, 20);
30670     }
30671     behavior.restartIfNeeded = function(surface) {
30672       if (_selected.empty()) {
30673         surface.call(run, "from");
30674         if (_timer) {
30675           _timer.stop();
30676         }
30677       }
30678     };
30679     behavior.off = function() {
30680       _done = true;
30681       if (_timer) {
30682         _timer.stop();
30683       }
30684       _selected.interrupt().call(reset);
30685     };
30686     return behavior;
30687   }
30688   var import_fast_deep_equal2;
30689   var init_breathe = __esm({
30690     "modules/behavior/breathe.js"() {
30691       "use strict";
30692       import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
30693       init_src8();
30694       init_src5();
30695       init_src16();
30696       init_src9();
30697     }
30698   });
30699
30700   // node_modules/d3-dsv/src/index.js
30701   var init_src17 = __esm({
30702     "node_modules/d3-dsv/src/index.js"() {
30703     }
30704   });
30705
30706   // node_modules/d3-fetch/src/text.js
30707   function responseText(response) {
30708     if (!response.ok) throw new Error(response.status + " " + response.statusText);
30709     return response.text();
30710   }
30711   function text_default3(input, init2) {
30712     return fetch(input, init2).then(responseText);
30713   }
30714   var init_text3 = __esm({
30715     "node_modules/d3-fetch/src/text.js"() {
30716     }
30717   });
30718
30719   // node_modules/d3-fetch/src/json.js
30720   function responseJson(response) {
30721     if (!response.ok) throw new Error(response.status + " " + response.statusText);
30722     if (response.status === 204 || response.status === 205) return;
30723     return response.json();
30724   }
30725   function json_default(input, init2) {
30726     return fetch(input, init2).then(responseJson);
30727   }
30728   var init_json = __esm({
30729     "node_modules/d3-fetch/src/json.js"() {
30730     }
30731   });
30732
30733   // node_modules/d3-fetch/src/xml.js
30734   function parser(type2) {
30735     return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
30736   }
30737   var xml_default, html, svg;
30738   var init_xml = __esm({
30739     "node_modules/d3-fetch/src/xml.js"() {
30740       init_text3();
30741       xml_default = parser("application/xml");
30742       html = parser("text/html");
30743       svg = parser("image/svg+xml");
30744     }
30745   });
30746
30747   // node_modules/d3-fetch/src/index.js
30748   var init_src18 = __esm({
30749     "node_modules/d3-fetch/src/index.js"() {
30750       init_json();
30751       init_text3();
30752       init_xml();
30753     }
30754   });
30755
30756   // modules/core/difference.js
30757   var difference_exports = {};
30758   __export(difference_exports, {
30759     coreDifference: () => coreDifference
30760   });
30761   function coreDifference(base, head) {
30762     var _changes = {};
30763     var _didChange = {};
30764     var _diff = {};
30765     function checkEntityID(id2) {
30766       var h3 = head.entities[id2];
30767       var b3 = base.entities[id2];
30768       if (h3 === b3) return;
30769       if (_changes[id2]) return;
30770       if (!h3 && b3) {
30771         _changes[id2] = { base: b3, head: h3 };
30772         _didChange.deletion = true;
30773         return;
30774       }
30775       if (h3 && !b3) {
30776         _changes[id2] = { base: b3, head: h3 };
30777         _didChange.addition = true;
30778         return;
30779       }
30780       if (h3 && b3) {
30781         if (h3.members && b3.members && !(0, import_fast_deep_equal3.default)(h3.members, b3.members)) {
30782           _changes[id2] = { base: b3, head: h3 };
30783           _didChange.geometry = true;
30784           _didChange.properties = true;
30785           return;
30786         }
30787         if (h3.loc && b3.loc && !geoVecEqual(h3.loc, b3.loc)) {
30788           _changes[id2] = { base: b3, head: h3 };
30789           _didChange.geometry = true;
30790         }
30791         if (h3.nodes && b3.nodes && !(0, import_fast_deep_equal3.default)(h3.nodes, b3.nodes)) {
30792           _changes[id2] = { base: b3, head: h3 };
30793           _didChange.geometry = true;
30794         }
30795         if (h3.tags && b3.tags && !(0, import_fast_deep_equal3.default)(h3.tags, b3.tags)) {
30796           _changes[id2] = { base: b3, head: h3 };
30797           _didChange.properties = true;
30798         }
30799       }
30800     }
30801     function load() {
30802       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
30803       for (var i3 = 0; i3 < ids.length; i3++) {
30804         checkEntityID(ids[i3]);
30805       }
30806     }
30807     load();
30808     _diff.length = function length2() {
30809       return Object.keys(_changes).length;
30810     };
30811     _diff.changes = function changes() {
30812       return _changes;
30813     };
30814     _diff.didChange = _didChange;
30815     _diff.extantIDs = function extantIDs(includeRelMembers) {
30816       var result = /* @__PURE__ */ new Set();
30817       Object.keys(_changes).forEach(function(id2) {
30818         if (_changes[id2].head) {
30819           result.add(id2);
30820         }
30821         var h3 = _changes[id2].head;
30822         var b3 = _changes[id2].base;
30823         var entity = h3 || b3;
30824         if (includeRelMembers && entity.type === "relation") {
30825           var mh = h3 ? h3.members.map(function(m3) {
30826             return m3.id;
30827           }) : [];
30828           var mb = b3 ? b3.members.map(function(m3) {
30829             return m3.id;
30830           }) : [];
30831           utilArrayUnion(mh, mb).forEach(function(memberID) {
30832             if (head.hasEntity(memberID)) {
30833               result.add(memberID);
30834             }
30835           });
30836         }
30837       });
30838       return Array.from(result);
30839     };
30840     _diff.modified = function modified() {
30841       var result = [];
30842       Object.values(_changes).forEach(function(change) {
30843         if (change.base && change.head) {
30844           result.push(change.head);
30845         }
30846       });
30847       return result;
30848     };
30849     _diff.created = function created() {
30850       var result = [];
30851       Object.values(_changes).forEach(function(change) {
30852         if (!change.base && change.head) {
30853           result.push(change.head);
30854         }
30855       });
30856       return result;
30857     };
30858     _diff.deleted = function deleted() {
30859       var result = [];
30860       Object.values(_changes).forEach(function(change) {
30861         if (change.base && !change.head) {
30862           result.push(change.base);
30863         }
30864       });
30865       return result;
30866     };
30867     _diff.summary = function summary() {
30868       var relevant = {};
30869       var keys2 = Object.keys(_changes);
30870       for (var i3 = 0; i3 < keys2.length; i3++) {
30871         var change = _changes[keys2[i3]];
30872         if (change.head && change.head.geometry(head) !== "vertex") {
30873           addEntity(change.head, head, change.base ? "modified" : "created");
30874         } else if (change.base && change.base.geometry(base) !== "vertex") {
30875           addEntity(change.base, base, "deleted");
30876         } else if (change.base && change.head) {
30877           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
30878           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
30879           if (moved) {
30880             addParents(change.head);
30881           }
30882           if (retagged || moved && change.head.hasInterestingTags()) {
30883             addEntity(change.head, head, "modified");
30884           }
30885         } else if (change.head && change.head.hasInterestingTags()) {
30886           addEntity(change.head, head, "created");
30887         } else if (change.base && change.base.hasInterestingTags()) {
30888           addEntity(change.base, base, "deleted");
30889         }
30890       }
30891       return Object.values(relevant);
30892       function addEntity(entity, graph, changeType) {
30893         relevant[entity.id] = {
30894           entity,
30895           graph,
30896           changeType
30897         };
30898       }
30899       function addParents(entity) {
30900         var parents = head.parentWays(entity);
30901         for (var j3 = parents.length - 1; j3 >= 0; j3--) {
30902           var parent2 = parents[j3];
30903           if (!(parent2.id in relevant)) {
30904             addEntity(parent2, head, "modified");
30905           }
30906         }
30907       }
30908     };
30909     _diff.complete = function complete(extent) {
30910       var result = {};
30911       var id2, change;
30912       for (id2 in _changes) {
30913         change = _changes[id2];
30914         var h3 = change.head;
30915         var b3 = change.base;
30916         var entity = h3 || b3;
30917         var i3;
30918         if (extent && (!h3 || !h3.intersects(extent, head)) && (!b3 || !b3.intersects(extent, base))) {
30919           continue;
30920         }
30921         result[id2] = h3;
30922         if (entity.type === "way") {
30923           var nh = h3 ? h3.nodes : [];
30924           var nb = b3 ? b3.nodes : [];
30925           var diff;
30926           diff = utilArrayDifference(nh, nb);
30927           for (i3 = 0; i3 < diff.length; i3++) {
30928             result[diff[i3]] = head.hasEntity(diff[i3]);
30929           }
30930           diff = utilArrayDifference(nb, nh);
30931           for (i3 = 0; i3 < diff.length; i3++) {
30932             result[diff[i3]] = head.hasEntity(diff[i3]);
30933           }
30934         }
30935         if (entity.type === "relation" && entity.isMultipolygon()) {
30936           var mh = h3 ? h3.members.map(function(m3) {
30937             return m3.id;
30938           }) : [];
30939           var mb = b3 ? b3.members.map(function(m3) {
30940             return m3.id;
30941           }) : [];
30942           var ids = utilArrayUnion(mh, mb);
30943           for (i3 = 0; i3 < ids.length; i3++) {
30944             var member = head.hasEntity(ids[i3]);
30945             if (!member) continue;
30946             if (extent && !member.intersects(extent, head)) continue;
30947             result[ids[i3]] = member;
30948           }
30949         }
30950         addParents(head.parentWays(entity), result);
30951         addParents(head.parentRelations(entity), result);
30952       }
30953       return result;
30954       function addParents(parents, result2) {
30955         for (var i4 = 0; i4 < parents.length; i4++) {
30956           var parent2 = parents[i4];
30957           if (parent2.id in result2) continue;
30958           result2[parent2.id] = parent2;
30959           addParents(head.parentRelations(parent2), result2);
30960         }
30961       }
30962     };
30963     return _diff;
30964   }
30965   var import_fast_deep_equal3;
30966   var init_difference = __esm({
30967     "modules/core/difference.js"() {
30968       "use strict";
30969       import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
30970       init_geo2();
30971       init_array3();
30972     }
30973   });
30974
30975   // node_modules/quickselect/index.js
30976   function quickselect2(arr, k3, left = 0, right = arr.length - 1, compare2 = defaultCompare) {
30977     while (right > left) {
30978       if (right - left > 600) {
30979         const n3 = right - left + 1;
30980         const m3 = k3 - left + 1;
30981         const z3 = Math.log(n3);
30982         const s2 = 0.5 * Math.exp(2 * z3 / 3);
30983         const sd = 0.5 * Math.sqrt(z3 * s2 * (n3 - s2) / n3) * (m3 - n3 / 2 < 0 ? -1 : 1);
30984         const newLeft = Math.max(left, Math.floor(k3 - m3 * s2 / n3 + sd));
30985         const newRight = Math.min(right, Math.floor(k3 + (n3 - m3) * s2 / n3 + sd));
30986         quickselect2(arr, k3, newLeft, newRight, compare2);
30987       }
30988       const t2 = arr[k3];
30989       let i3 = left;
30990       let j3 = right;
30991       swap2(arr, left, k3);
30992       if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
30993       while (i3 < j3) {
30994         swap2(arr, i3, j3);
30995         i3++;
30996         j3--;
30997         while (compare2(arr[i3], t2) < 0) i3++;
30998         while (compare2(arr[j3], t2) > 0) j3--;
30999       }
31000       if (compare2(arr[left], t2) === 0) swap2(arr, left, j3);
31001       else {
31002         j3++;
31003         swap2(arr, j3, right);
31004       }
31005       if (j3 <= k3) left = j3 + 1;
31006       if (k3 <= j3) right = j3 - 1;
31007     }
31008   }
31009   function swap2(arr, i3, j3) {
31010     const tmp = arr[i3];
31011     arr[i3] = arr[j3];
31012     arr[j3] = tmp;
31013   }
31014   function defaultCompare(a4, b3) {
31015     return a4 < b3 ? -1 : a4 > b3 ? 1 : 0;
31016   }
31017   var init_quickselect2 = __esm({
31018     "node_modules/quickselect/index.js"() {
31019     }
31020   });
31021
31022   // node_modules/rbush/index.js
31023   function findItem(item, items, equalsFn) {
31024     if (!equalsFn) return items.indexOf(item);
31025     for (let i3 = 0; i3 < items.length; i3++) {
31026       if (equalsFn(item, items[i3])) return i3;
31027     }
31028     return -1;
31029   }
31030   function calcBBox(node, toBBox) {
31031     distBBox(node, 0, node.children.length, toBBox, node);
31032   }
31033   function distBBox(node, k3, p2, toBBox, destNode) {
31034     if (!destNode) destNode = createNode(null);
31035     destNode.minX = Infinity;
31036     destNode.minY = Infinity;
31037     destNode.maxX = -Infinity;
31038     destNode.maxY = -Infinity;
31039     for (let i3 = k3; i3 < p2; i3++) {
31040       const child = node.children[i3];
31041       extend2(destNode, node.leaf ? toBBox(child) : child);
31042     }
31043     return destNode;
31044   }
31045   function extend2(a4, b3) {
31046     a4.minX = Math.min(a4.minX, b3.minX);
31047     a4.minY = Math.min(a4.minY, b3.minY);
31048     a4.maxX = Math.max(a4.maxX, b3.maxX);
31049     a4.maxY = Math.max(a4.maxY, b3.maxY);
31050     return a4;
31051   }
31052   function compareNodeMinX(a4, b3) {
31053     return a4.minX - b3.minX;
31054   }
31055   function compareNodeMinY(a4, b3) {
31056     return a4.minY - b3.minY;
31057   }
31058   function bboxArea(a4) {
31059     return (a4.maxX - a4.minX) * (a4.maxY - a4.minY);
31060   }
31061   function bboxMargin(a4) {
31062     return a4.maxX - a4.minX + (a4.maxY - a4.minY);
31063   }
31064   function enlargedArea(a4, b3) {
31065     return (Math.max(b3.maxX, a4.maxX) - Math.min(b3.minX, a4.minX)) * (Math.max(b3.maxY, a4.maxY) - Math.min(b3.minY, a4.minY));
31066   }
31067   function intersectionArea(a4, b3) {
31068     const minX = Math.max(a4.minX, b3.minX);
31069     const minY = Math.max(a4.minY, b3.minY);
31070     const maxX = Math.min(a4.maxX, b3.maxX);
31071     const maxY = Math.min(a4.maxY, b3.maxY);
31072     return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
31073   }
31074   function contains(a4, b3) {
31075     return a4.minX <= b3.minX && a4.minY <= b3.minY && b3.maxX <= a4.maxX && b3.maxY <= a4.maxY;
31076   }
31077   function intersects(a4, b3) {
31078     return b3.minX <= a4.maxX && b3.minY <= a4.maxY && b3.maxX >= a4.minX && b3.maxY >= a4.minY;
31079   }
31080   function createNode(children2) {
31081     return {
31082       children: children2,
31083       height: 1,
31084       leaf: true,
31085       minX: Infinity,
31086       minY: Infinity,
31087       maxX: -Infinity,
31088       maxY: -Infinity
31089     };
31090   }
31091   function multiSelect(arr, left, right, n3, compare2) {
31092     const stack = [left, right];
31093     while (stack.length) {
31094       right = stack.pop();
31095       left = stack.pop();
31096       if (right - left <= n3) continue;
31097       const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
31098       quickselect2(arr, mid, left, right, compare2);
31099       stack.push(left, mid, mid, right);
31100     }
31101   }
31102   var RBush;
31103   var init_rbush = __esm({
31104     "node_modules/rbush/index.js"() {
31105       init_quickselect2();
31106       RBush = class {
31107         constructor(maxEntries = 9) {
31108           this._maxEntries = Math.max(4, maxEntries);
31109           this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
31110           this.clear();
31111         }
31112         all() {
31113           return this._all(this.data, []);
31114         }
31115         search(bbox2) {
31116           let node = this.data;
31117           const result = [];
31118           if (!intersects(bbox2, node)) return result;
31119           const toBBox = this.toBBox;
31120           const nodesToSearch = [];
31121           while (node) {
31122             for (let i3 = 0; i3 < node.children.length; i3++) {
31123               const child = node.children[i3];
31124               const childBBox = node.leaf ? toBBox(child) : child;
31125               if (intersects(bbox2, childBBox)) {
31126                 if (node.leaf) result.push(child);
31127                 else if (contains(bbox2, childBBox)) this._all(child, result);
31128                 else nodesToSearch.push(child);
31129               }
31130             }
31131             node = nodesToSearch.pop();
31132           }
31133           return result;
31134         }
31135         collides(bbox2) {
31136           let node = this.data;
31137           if (!intersects(bbox2, node)) return false;
31138           const nodesToSearch = [];
31139           while (node) {
31140             for (let i3 = 0; i3 < node.children.length; i3++) {
31141               const child = node.children[i3];
31142               const childBBox = node.leaf ? this.toBBox(child) : child;
31143               if (intersects(bbox2, childBBox)) {
31144                 if (node.leaf || contains(bbox2, childBBox)) return true;
31145                 nodesToSearch.push(child);
31146               }
31147             }
31148             node = nodesToSearch.pop();
31149           }
31150           return false;
31151         }
31152         load(data) {
31153           if (!(data && data.length)) return this;
31154           if (data.length < this._minEntries) {
31155             for (let i3 = 0; i3 < data.length; i3++) {
31156               this.insert(data[i3]);
31157             }
31158             return this;
31159           }
31160           let node = this._build(data.slice(), 0, data.length - 1, 0);
31161           if (!this.data.children.length) {
31162             this.data = node;
31163           } else if (this.data.height === node.height) {
31164             this._splitRoot(this.data, node);
31165           } else {
31166             if (this.data.height < node.height) {
31167               const tmpNode = this.data;
31168               this.data = node;
31169               node = tmpNode;
31170             }
31171             this._insert(node, this.data.height - node.height - 1, true);
31172           }
31173           return this;
31174         }
31175         insert(item) {
31176           if (item) this._insert(item, this.data.height - 1);
31177           return this;
31178         }
31179         clear() {
31180           this.data = createNode([]);
31181           return this;
31182         }
31183         remove(item, equalsFn) {
31184           if (!item) return this;
31185           let node = this.data;
31186           const bbox2 = this.toBBox(item);
31187           const path = [];
31188           const indexes = [];
31189           let i3, parent2, goingUp;
31190           while (node || path.length) {
31191             if (!node) {
31192               node = path.pop();
31193               parent2 = path[path.length - 1];
31194               i3 = indexes.pop();
31195               goingUp = true;
31196             }
31197             if (node.leaf) {
31198               const index = findItem(item, node.children, equalsFn);
31199               if (index !== -1) {
31200                 node.children.splice(index, 1);
31201                 path.push(node);
31202                 this._condense(path);
31203                 return this;
31204               }
31205             }
31206             if (!goingUp && !node.leaf && contains(node, bbox2)) {
31207               path.push(node);
31208               indexes.push(i3);
31209               i3 = 0;
31210               parent2 = node;
31211               node = node.children[0];
31212             } else if (parent2) {
31213               i3++;
31214               node = parent2.children[i3];
31215               goingUp = false;
31216             } else node = null;
31217           }
31218           return this;
31219         }
31220         toBBox(item) {
31221           return item;
31222         }
31223         compareMinX(a4, b3) {
31224           return a4.minX - b3.minX;
31225         }
31226         compareMinY(a4, b3) {
31227           return a4.minY - b3.minY;
31228         }
31229         toJSON() {
31230           return this.data;
31231         }
31232         fromJSON(data) {
31233           this.data = data;
31234           return this;
31235         }
31236         _all(node, result) {
31237           const nodesToSearch = [];
31238           while (node) {
31239             if (node.leaf) result.push(...node.children);
31240             else nodesToSearch.push(...node.children);
31241             node = nodesToSearch.pop();
31242           }
31243           return result;
31244         }
31245         _build(items, left, right, height) {
31246           const N3 = right - left + 1;
31247           let M3 = this._maxEntries;
31248           let node;
31249           if (N3 <= M3) {
31250             node = createNode(items.slice(left, right + 1));
31251             calcBBox(node, this.toBBox);
31252             return node;
31253           }
31254           if (!height) {
31255             height = Math.ceil(Math.log(N3) / Math.log(M3));
31256             M3 = Math.ceil(N3 / Math.pow(M3, height - 1));
31257           }
31258           node = createNode([]);
31259           node.leaf = false;
31260           node.height = height;
31261           const N22 = Math.ceil(N3 / M3);
31262           const N1 = N22 * Math.ceil(Math.sqrt(M3));
31263           multiSelect(items, left, right, N1, this.compareMinX);
31264           for (let i3 = left; i3 <= right; i3 += N1) {
31265             const right2 = Math.min(i3 + N1 - 1, right);
31266             multiSelect(items, i3, right2, N22, this.compareMinY);
31267             for (let j3 = i3; j3 <= right2; j3 += N22) {
31268               const right3 = Math.min(j3 + N22 - 1, right2);
31269               node.children.push(this._build(items, j3, right3, height - 1));
31270             }
31271           }
31272           calcBBox(node, this.toBBox);
31273           return node;
31274         }
31275         _chooseSubtree(bbox2, node, level, path) {
31276           while (true) {
31277             path.push(node);
31278             if (node.leaf || path.length - 1 === level) break;
31279             let minArea = Infinity;
31280             let minEnlargement = Infinity;
31281             let targetNode;
31282             for (let i3 = 0; i3 < node.children.length; i3++) {
31283               const child = node.children[i3];
31284               const area = bboxArea(child);
31285               const enlargement = enlargedArea(bbox2, child) - area;
31286               if (enlargement < minEnlargement) {
31287                 minEnlargement = enlargement;
31288                 minArea = area < minArea ? area : minArea;
31289                 targetNode = child;
31290               } else if (enlargement === minEnlargement) {
31291                 if (area < minArea) {
31292                   minArea = area;
31293                   targetNode = child;
31294                 }
31295               }
31296             }
31297             node = targetNode || node.children[0];
31298           }
31299           return node;
31300         }
31301         _insert(item, level, isNode) {
31302           const bbox2 = isNode ? item : this.toBBox(item);
31303           const insertPath = [];
31304           const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
31305           node.children.push(item);
31306           extend2(node, bbox2);
31307           while (level >= 0) {
31308             if (insertPath[level].children.length > this._maxEntries) {
31309               this._split(insertPath, level);
31310               level--;
31311             } else break;
31312           }
31313           this._adjustParentBBoxes(bbox2, insertPath, level);
31314         }
31315         // split overflowed node into two
31316         _split(insertPath, level) {
31317           const node = insertPath[level];
31318           const M3 = node.children.length;
31319           const m3 = this._minEntries;
31320           this._chooseSplitAxis(node, m3, M3);
31321           const splitIndex = this._chooseSplitIndex(node, m3, M3);
31322           const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
31323           newNode.height = node.height;
31324           newNode.leaf = node.leaf;
31325           calcBBox(node, this.toBBox);
31326           calcBBox(newNode, this.toBBox);
31327           if (level) insertPath[level - 1].children.push(newNode);
31328           else this._splitRoot(node, newNode);
31329         }
31330         _splitRoot(node, newNode) {
31331           this.data = createNode([node, newNode]);
31332           this.data.height = node.height + 1;
31333           this.data.leaf = false;
31334           calcBBox(this.data, this.toBBox);
31335         }
31336         _chooseSplitIndex(node, m3, M3) {
31337           let index;
31338           let minOverlap = Infinity;
31339           let minArea = Infinity;
31340           for (let i3 = m3; i3 <= M3 - m3; i3++) {
31341             const bbox1 = distBBox(node, 0, i3, this.toBBox);
31342             const bbox2 = distBBox(node, i3, M3, this.toBBox);
31343             const overlap = intersectionArea(bbox1, bbox2);
31344             const area = bboxArea(bbox1) + bboxArea(bbox2);
31345             if (overlap < minOverlap) {
31346               minOverlap = overlap;
31347               index = i3;
31348               minArea = area < minArea ? area : minArea;
31349             } else if (overlap === minOverlap) {
31350               if (area < minArea) {
31351                 minArea = area;
31352                 index = i3;
31353               }
31354             }
31355           }
31356           return index || M3 - m3;
31357         }
31358         // sorts node children by the best axis for split
31359         _chooseSplitAxis(node, m3, M3) {
31360           const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
31361           const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
31362           const xMargin = this._allDistMargin(node, m3, M3, compareMinX);
31363           const yMargin = this._allDistMargin(node, m3, M3, compareMinY);
31364           if (xMargin < yMargin) node.children.sort(compareMinX);
31365         }
31366         // total margin of all possible split distributions where each node is at least m full
31367         _allDistMargin(node, m3, M3, compare2) {
31368           node.children.sort(compare2);
31369           const toBBox = this.toBBox;
31370           const leftBBox = distBBox(node, 0, m3, toBBox);
31371           const rightBBox = distBBox(node, M3 - m3, M3, toBBox);
31372           let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
31373           for (let i3 = m3; i3 < M3 - m3; i3++) {
31374             const child = node.children[i3];
31375             extend2(leftBBox, node.leaf ? toBBox(child) : child);
31376             margin += bboxMargin(leftBBox);
31377           }
31378           for (let i3 = M3 - m3 - 1; i3 >= m3; i3--) {
31379             const child = node.children[i3];
31380             extend2(rightBBox, node.leaf ? toBBox(child) : child);
31381             margin += bboxMargin(rightBBox);
31382           }
31383           return margin;
31384         }
31385         _adjustParentBBoxes(bbox2, path, level) {
31386           for (let i3 = level; i3 >= 0; i3--) {
31387             extend2(path[i3], bbox2);
31388           }
31389         }
31390         _condense(path) {
31391           for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
31392             if (path[i3].children.length === 0) {
31393               if (i3 > 0) {
31394                 siblings = path[i3 - 1].children;
31395                 siblings.splice(siblings.indexOf(path[i3]), 1);
31396               } else this.clear();
31397             } else calcBBox(path[i3], this.toBBox);
31398           }
31399         }
31400       };
31401     }
31402   });
31403
31404   // modules/core/tree.js
31405   var tree_exports = {};
31406   __export(tree_exports, {
31407     coreTree: () => coreTree
31408   });
31409   function coreTree(head) {
31410     var _rtree = new RBush();
31411     var _bboxes = {};
31412     var _segmentsRTree = new RBush();
31413     var _segmentsBBoxes = {};
31414     var _segmentsByWayId = {};
31415     var tree = {};
31416     function entityBBox(entity) {
31417       var bbox2 = entity.extent(head).bbox();
31418       bbox2.id = entity.id;
31419       _bboxes[entity.id] = bbox2;
31420       return bbox2;
31421     }
31422     function segmentBBox(segment) {
31423       var extent = segment.extent(head);
31424       if (!extent) return null;
31425       var bbox2 = extent.bbox();
31426       bbox2.segment = segment;
31427       _segmentsBBoxes[segment.id] = bbox2;
31428       return bbox2;
31429     }
31430     function removeEntity(entity) {
31431       _rtree.remove(_bboxes[entity.id]);
31432       delete _bboxes[entity.id];
31433       if (_segmentsByWayId[entity.id]) {
31434         _segmentsByWayId[entity.id].forEach(function(segment) {
31435           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
31436           delete _segmentsBBoxes[segment.id];
31437         });
31438         delete _segmentsByWayId[entity.id];
31439       }
31440     }
31441     function loadEntities(entities) {
31442       _rtree.load(entities.map(entityBBox));
31443       var segments = [];
31444       entities.forEach(function(entity) {
31445         if (entity.segments) {
31446           var entitySegments = entity.segments(head);
31447           _segmentsByWayId[entity.id] = entitySegments;
31448           segments = segments.concat(entitySegments);
31449         }
31450       });
31451       if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
31452     }
31453     function updateParents(entity, insertions, memo) {
31454       head.parentWays(entity).forEach(function(way) {
31455         if (_bboxes[way.id]) {
31456           removeEntity(way);
31457           insertions[way.id] = way;
31458         }
31459         updateParents(way, insertions, memo);
31460       });
31461       head.parentRelations(entity).forEach(function(relation) {
31462         if (memo[relation.id]) return;
31463         memo[relation.id] = true;
31464         if (_bboxes[relation.id]) {
31465           removeEntity(relation);
31466           insertions[relation.id] = relation;
31467         }
31468         updateParents(relation, insertions, memo);
31469       });
31470     }
31471     tree.rebase = function(entities, force) {
31472       var insertions = {};
31473       for (var i3 = 0; i3 < entities.length; i3++) {
31474         var entity = entities[i3];
31475         if (!entity.visible) continue;
31476         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
31477           if (!force) {
31478             continue;
31479           } else if (_bboxes[entity.id]) {
31480             removeEntity(entity);
31481           }
31482         }
31483         insertions[entity.id] = entity;
31484         updateParents(entity, insertions, {});
31485       }
31486       loadEntities(Object.values(insertions));
31487       return tree;
31488     };
31489     function updateToGraph(graph) {
31490       if (graph === head) return;
31491       var diff = coreDifference(head, graph);
31492       head = graph;
31493       var changed = diff.didChange;
31494       if (!changed.addition && !changed.deletion && !changed.geometry) return;
31495       var insertions = {};
31496       if (changed.deletion) {
31497         diff.deleted().forEach(function(entity) {
31498           removeEntity(entity);
31499         });
31500       }
31501       if (changed.geometry) {
31502         diff.modified().forEach(function(entity) {
31503           removeEntity(entity);
31504           insertions[entity.id] = entity;
31505           updateParents(entity, insertions, {});
31506         });
31507       }
31508       if (changed.addition) {
31509         diff.created().forEach(function(entity) {
31510           insertions[entity.id] = entity;
31511         });
31512       }
31513       loadEntities(Object.values(insertions));
31514     }
31515     tree.intersects = function(extent, graph) {
31516       updateToGraph(graph);
31517       return _rtree.search(extent.bbox()).map(function(bbox2) {
31518         return graph.entity(bbox2.id);
31519       });
31520     };
31521     tree.waySegments = function(extent, graph) {
31522       updateToGraph(graph);
31523       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
31524         return bbox2.segment;
31525       });
31526     };
31527     return tree;
31528   }
31529   var init_tree = __esm({
31530     "modules/core/tree.js"() {
31531       "use strict";
31532       init_rbush();
31533       init_difference();
31534     }
31535   });
31536
31537   // modules/svg/icon.js
31538   var icon_exports = {};
31539   __export(icon_exports, {
31540     svgIcon: () => svgIcon
31541   });
31542   function svgIcon(name, svgklass, useklass) {
31543     return function drawIcon(selection2) {
31544       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);
31545     };
31546   }
31547   var init_icon = __esm({
31548     "modules/svg/icon.js"() {
31549       "use strict";
31550     }
31551   });
31552
31553   // modules/ui/modal.js
31554   var modal_exports = {};
31555   __export(modal_exports, {
31556     uiModal: () => uiModal
31557   });
31558   function uiModal(selection2, blocking) {
31559     let keybinding = utilKeybinding("modal");
31560     let previous = selection2.select("div.modal");
31561     let animate = previous.empty();
31562     previous.transition().duration(200).style("opacity", 0).remove();
31563     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
31564     shaded.close = () => {
31565       shaded.transition().duration(200).style("opacity", 0).remove();
31566       modal.transition().duration(200).style("top", "0px");
31567       select_default2(document).call(keybinding.unbind);
31568     };
31569     let modal = shaded.append("div").attr("class", "modal fillL");
31570     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
31571     if (!blocking) {
31572       shaded.on("click.remove-modal", (d3_event) => {
31573         if (d3_event.target === this) {
31574           shaded.close();
31575         }
31576       });
31577       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
31578       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
31579       select_default2(document).call(keybinding);
31580     }
31581     modal.append("div").attr("class", "content");
31582     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
31583     if (animate) {
31584       shaded.transition().style("opacity", 1);
31585     } else {
31586       shaded.style("opacity", 1);
31587     }
31588     return shaded;
31589     function moveFocusToFirst() {
31590       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
31591       if (node) {
31592         node.focus();
31593       } else {
31594         select_default2(this).node().blur();
31595       }
31596     }
31597     function moveFocusToLast() {
31598       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
31599       if (nodes.length) {
31600         nodes[nodes.length - 1].focus();
31601       } else {
31602         select_default2(this).node().blur();
31603       }
31604     }
31605   }
31606   var init_modal = __esm({
31607     "modules/ui/modal.js"() {
31608       "use strict";
31609       init_src5();
31610       init_localizer();
31611       init_icon();
31612       init_util();
31613     }
31614   });
31615
31616   // modules/ui/loading.js
31617   var loading_exports = {};
31618   __export(loading_exports, {
31619     uiLoading: () => uiLoading
31620   });
31621   function uiLoading(context) {
31622     let _modalSelection = select_default2(null);
31623     let _message = "";
31624     let _blocking = false;
31625     let loading = (selection2) => {
31626       _modalSelection = uiModal(selection2, _blocking);
31627       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
31628       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
31629       loadertext.append("h3").html(_message);
31630       _modalSelection.select("button.close").attr("class", "hide");
31631       return loading;
31632     };
31633     loading.message = function(val) {
31634       if (!arguments.length) return _message;
31635       _message = val;
31636       return loading;
31637     };
31638     loading.blocking = function(val) {
31639       if (!arguments.length) return _blocking;
31640       _blocking = val;
31641       return loading;
31642     };
31643     loading.close = () => {
31644       _modalSelection.remove();
31645     };
31646     loading.isShown = () => {
31647       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
31648     };
31649     return loading;
31650   }
31651   var init_loading = __esm({
31652     "modules/ui/loading.js"() {
31653       "use strict";
31654       init_src5();
31655       init_modal();
31656     }
31657   });
31658
31659   // modules/core/history.js
31660   var history_exports = {};
31661   __export(history_exports, {
31662     coreHistory: () => coreHistory
31663   });
31664   function coreHistory(context) {
31665     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
31666     var lock = utilSessionMutex("lock");
31667     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
31668     var duration = 150;
31669     var _imageryUsed = [];
31670     var _photoOverlaysUsed = [];
31671     var _checkpoints = {};
31672     var _pausedGraph;
31673     var _stack;
31674     var _index;
31675     var _tree;
31676     function _act(actions, t2) {
31677       actions = Array.prototype.slice.call(actions);
31678       var annotation;
31679       if (typeof actions[actions.length - 1] !== "function") {
31680         annotation = actions.pop();
31681       }
31682       var graph = _stack[_index].graph;
31683       for (var i3 = 0; i3 < actions.length; i3++) {
31684         graph = actions[i3](graph, t2);
31685       }
31686       return {
31687         graph,
31688         annotation,
31689         imageryUsed: _imageryUsed,
31690         photoOverlaysUsed: _photoOverlaysUsed,
31691         transform: context.projection.transform(),
31692         selectedIDs: context.selectedIDs()
31693       };
31694     }
31695     function _perform(args, t2) {
31696       var previous = _stack[_index].graph;
31697       _stack = _stack.slice(0, _index + 1);
31698       var actionResult = _act(args, t2);
31699       _stack.push(actionResult);
31700       _index++;
31701       return change(previous);
31702     }
31703     function _replace(args, t2) {
31704       var previous = _stack[_index].graph;
31705       var actionResult = _act(args, t2);
31706       _stack[_index] = actionResult;
31707       return change(previous);
31708     }
31709     function _overwrite(args, t2) {
31710       var previous = _stack[_index].graph;
31711       var actionResult = _act(args, t2);
31712       if (_index > 0) {
31713         _index--;
31714         _stack.pop();
31715       }
31716       _stack = _stack.slice(0, _index + 1);
31717       _stack.push(actionResult);
31718       _index++;
31719       return change(previous);
31720     }
31721     function change(previous) {
31722       var difference2 = coreDifference(previous, history.graph());
31723       if (!_pausedGraph) {
31724         dispatch14.call("change", this, difference2);
31725       }
31726       return difference2;
31727     }
31728     function getKey(n3) {
31729       return "iD_" + window.location.origin + "_" + n3;
31730     }
31731     var history = {
31732       graph: function() {
31733         return _stack[_index].graph;
31734       },
31735       tree: function() {
31736         return _tree;
31737       },
31738       base: function() {
31739         return _stack[0].graph;
31740       },
31741       merge: function(entities) {
31742         var stack = _stack.map(function(state) {
31743           return state.graph;
31744         });
31745         _stack[0].graph.rebase(entities, stack, false);
31746         _tree.rebase(entities, false);
31747         dispatch14.call("merge", this, entities);
31748       },
31749       perform: function() {
31750         select_default2(document).interrupt("history.perform");
31751         var transitionable = false;
31752         var action0 = arguments[0];
31753         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
31754           transitionable = !!action0.transitionable;
31755         }
31756         if (transitionable) {
31757           var origArguments = arguments;
31758           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
31759             return function(t2) {
31760               if (t2 < 1) _overwrite([action0], t2);
31761             };
31762           }).on("start", function() {
31763             _perform([action0], 0);
31764           }).on("end interrupt", function() {
31765             _overwrite(origArguments, 1);
31766           });
31767         } else {
31768           return _perform(arguments);
31769         }
31770       },
31771       replace: function() {
31772         select_default2(document).interrupt("history.perform");
31773         return _replace(arguments, 1);
31774       },
31775       // Same as calling pop and then perform
31776       overwrite: function() {
31777         select_default2(document).interrupt("history.perform");
31778         return _overwrite(arguments, 1);
31779       },
31780       pop: function(n3) {
31781         select_default2(document).interrupt("history.perform");
31782         var previous = _stack[_index].graph;
31783         if (isNaN(+n3) || +n3 < 0) {
31784           n3 = 1;
31785         }
31786         while (n3-- > 0 && _index > 0) {
31787           _index--;
31788           _stack.pop();
31789         }
31790         return change(previous);
31791       },
31792       // Back to the previous annotated state or _index = 0.
31793       undo: function() {
31794         select_default2(document).interrupt("history.perform");
31795         var previousStack = _stack[_index];
31796         var previous = previousStack.graph;
31797         while (_index > 0) {
31798           _index--;
31799           if (_stack[_index].annotation) break;
31800         }
31801         dispatch14.call("undone", this, _stack[_index], previousStack);
31802         return change(previous);
31803       },
31804       // Forward to the next annotated state.
31805       redo: function() {
31806         select_default2(document).interrupt("history.perform");
31807         var previousStack = _stack[_index];
31808         var previous = previousStack.graph;
31809         var tryIndex = _index;
31810         while (tryIndex < _stack.length - 1) {
31811           tryIndex++;
31812           if (_stack[tryIndex].annotation) {
31813             _index = tryIndex;
31814             dispatch14.call("redone", this, _stack[_index], previousStack);
31815             break;
31816           }
31817         }
31818         return change(previous);
31819       },
31820       pauseChangeDispatch: function() {
31821         if (!_pausedGraph) {
31822           _pausedGraph = _stack[_index].graph;
31823         }
31824       },
31825       resumeChangeDispatch: function() {
31826         if (_pausedGraph) {
31827           var previous = _pausedGraph;
31828           _pausedGraph = null;
31829           return change(previous);
31830         }
31831       },
31832       undoAnnotation: function() {
31833         var i3 = _index;
31834         while (i3 >= 0) {
31835           if (_stack[i3].annotation) return _stack[i3].annotation;
31836           i3--;
31837         }
31838       },
31839       redoAnnotation: function() {
31840         var i3 = _index + 1;
31841         while (i3 <= _stack.length - 1) {
31842           if (_stack[i3].annotation) return _stack[i3].annotation;
31843           i3++;
31844         }
31845       },
31846       // Returns the entities from the active graph with bounding boxes
31847       // overlapping the given `extent`.
31848       intersects: function(extent) {
31849         return _tree.intersects(extent, _stack[_index].graph);
31850       },
31851       difference: function() {
31852         var base = _stack[0].graph;
31853         var head = _stack[_index].graph;
31854         return coreDifference(base, head);
31855       },
31856       changes: function(action) {
31857         var base = _stack[0].graph;
31858         var head = _stack[_index].graph;
31859         if (action) {
31860           head = action(head);
31861         }
31862         var difference2 = coreDifference(base, head);
31863         return {
31864           modified: difference2.modified(),
31865           created: difference2.created(),
31866           deleted: difference2.deleted()
31867         };
31868       },
31869       hasChanges: function() {
31870         return this.difference().length() > 0;
31871       },
31872       imageryUsed: function(sources) {
31873         if (sources) {
31874           _imageryUsed = sources;
31875           return history;
31876         } else {
31877           var s2 = /* @__PURE__ */ new Set();
31878           _stack.slice(1, _index + 1).forEach(function(state) {
31879             state.imageryUsed.forEach(function(source) {
31880               if (source !== "Custom") {
31881                 s2.add(source);
31882               }
31883             });
31884           });
31885           return Array.from(s2);
31886         }
31887       },
31888       photoOverlaysUsed: function(sources) {
31889         if (sources) {
31890           _photoOverlaysUsed = sources;
31891           return history;
31892         } else {
31893           var s2 = /* @__PURE__ */ new Set();
31894           _stack.slice(1, _index + 1).forEach(function(state) {
31895             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
31896               state.photoOverlaysUsed.forEach(function(photoOverlay) {
31897                 s2.add(photoOverlay);
31898               });
31899             }
31900           });
31901           return Array.from(s2);
31902         }
31903       },
31904       // save the current history state
31905       checkpoint: function(key) {
31906         _checkpoints[key] = {
31907           stack: _stack,
31908           index: _index
31909         };
31910         return history;
31911       },
31912       // restore history state to a given checkpoint or reset completely
31913       reset: function(key) {
31914         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
31915           _stack = _checkpoints[key].stack;
31916           _index = _checkpoints[key].index;
31917         } else {
31918           _stack = [{ graph: coreGraph() }];
31919           _index = 0;
31920           _tree = coreTree(_stack[0].graph);
31921           _checkpoints = {};
31922         }
31923         dispatch14.call("reset");
31924         dispatch14.call("change");
31925         return history;
31926       },
31927       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
31928       //
31929       // To use it:
31930       //  1. Start the walkthrough.
31931       //  2. Get to a "free editing" tutorial step
31932       //  3. Make your edits to the walkthrough map
31933       //  4. In your browser dev console run:
31934       //        `id.history().toIntroGraph()`
31935       //  5. This outputs stringified JSON to the browser console
31936       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
31937       toIntroGraph: function() {
31938         var nextID = { n: 0, r: 0, w: 0 };
31939         var permIDs = {};
31940         var graph = this.graph();
31941         var baseEntities = {};
31942         Object.values(graph.base().entities).forEach(function(entity) {
31943           var copy2 = copyIntroEntity(entity);
31944           baseEntities[copy2.id] = copy2;
31945         });
31946         Object.keys(graph.entities).forEach(function(id2) {
31947           var entity = graph.entities[id2];
31948           if (entity) {
31949             var copy2 = copyIntroEntity(entity);
31950             baseEntities[copy2.id] = copy2;
31951           } else {
31952             delete baseEntities[id2];
31953           }
31954         });
31955         Object.values(baseEntities).forEach(function(entity) {
31956           if (Array.isArray(entity.nodes)) {
31957             entity.nodes = entity.nodes.map(function(node) {
31958               return permIDs[node] || node;
31959             });
31960           }
31961           if (Array.isArray(entity.members)) {
31962             entity.members = entity.members.map(function(member) {
31963               member.id = permIDs[member.id] || member.id;
31964               return member;
31965             });
31966           }
31967         });
31968         return JSON.stringify({ dataIntroGraph: baseEntities });
31969         function copyIntroEntity(source) {
31970           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
31971           if (copy2.tags && !Object.keys(copy2.tags)) {
31972             delete copy2.tags;
31973           }
31974           if (Array.isArray(copy2.loc)) {
31975             copy2.loc[0] = +copy2.loc[0].toFixed(6);
31976             copy2.loc[1] = +copy2.loc[1].toFixed(6);
31977           }
31978           var match = source.id.match(/([nrw])-\d*/);
31979           if (match !== null) {
31980             var nrw = match[1];
31981             var permID;
31982             do {
31983               permID = nrw + ++nextID[nrw];
31984             } while (baseEntities.hasOwnProperty(permID));
31985             copy2.id = permIDs[source.id] = permID;
31986           }
31987           return copy2;
31988         }
31989       },
31990       toJSON: function() {
31991         if (!this.hasChanges()) return;
31992         var allEntities = {};
31993         var baseEntities = {};
31994         var base = _stack[0];
31995         var s2 = _stack.map(function(i3) {
31996           var modified = [];
31997           var deleted = [];
31998           Object.keys(i3.graph.entities).forEach(function(id2) {
31999             var entity = i3.graph.entities[id2];
32000             if (entity) {
32001               var key = osmEntity.key(entity);
32002               allEntities[key] = entity;
32003               modified.push(key);
32004             } else {
32005               deleted.push(id2);
32006             }
32007             if (id2 in base.graph.entities) {
32008               baseEntities[id2] = base.graph.entities[id2];
32009             }
32010             if (entity && entity.nodes) {
32011               entity.nodes.forEach(function(nodeID) {
32012                 if (nodeID in base.graph.entities) {
32013                   baseEntities[nodeID] = base.graph.entities[nodeID];
32014                 }
32015               });
32016             }
32017             var baseParents = base.graph._parentWays[id2];
32018             if (baseParents) {
32019               baseParents.forEach(function(parentID) {
32020                 if (parentID in base.graph.entities) {
32021                   baseEntities[parentID] = base.graph.entities[parentID];
32022                 }
32023               });
32024             }
32025           });
32026           var x2 = {};
32027           if (modified.length) x2.modified = modified;
32028           if (deleted.length) x2.deleted = deleted;
32029           if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
32030           if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
32031           if (i3.annotation) x2.annotation = i3.annotation;
32032           if (i3.transform) x2.transform = i3.transform;
32033           if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
32034           return x2;
32035         });
32036         return JSON.stringify({
32037           version: 3,
32038           entities: Object.values(allEntities),
32039           baseEntities: Object.values(baseEntities),
32040           stack: s2,
32041           nextIDs: osmEntity.id.next,
32042           index: _index,
32043           // note the time the changes were saved
32044           timestamp: (/* @__PURE__ */ new Date()).getTime()
32045         });
32046       },
32047       fromJSON: function(json, loadChildNodes) {
32048         var h3 = JSON.parse(json);
32049         var loadComplete = true;
32050         osmEntity.id.next = h3.nextIDs;
32051         _index = h3.index;
32052         if (h3.version === 2 || h3.version === 3) {
32053           var allEntities = {};
32054           h3.entities.forEach(function(entity) {
32055             allEntities[osmEntity.key(entity)] = osmEntity(entity);
32056           });
32057           if (h3.version === 3) {
32058             var baseEntities = h3.baseEntities.map(function(d2) {
32059               return osmEntity(d2);
32060             });
32061             var stack = _stack.map(function(state) {
32062               return state.graph;
32063             });
32064             _stack[0].graph.rebase(baseEntities, stack, true);
32065             _tree.rebase(baseEntities, true);
32066             if (loadChildNodes) {
32067               var osm = context.connection();
32068               var baseWays = baseEntities.filter(function(e3) {
32069                 return e3.type === "way";
32070               });
32071               var nodeIDs = baseWays.reduce(function(acc, way) {
32072                 return utilArrayUnion(acc, way.nodes);
32073               }, []);
32074               var missing = nodeIDs.filter(function(n3) {
32075                 return !_stack[0].graph.hasEntity(n3);
32076               });
32077               if (missing.length && osm) {
32078                 loadComplete = false;
32079                 context.map().redrawEnable(false);
32080                 var loading = uiLoading(context).blocking(true);
32081                 context.container().call(loading);
32082                 var childNodesLoaded = function(err, result) {
32083                   if (!err) {
32084                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
32085                     var visibles = visibleGroups.true || [];
32086                     var invisibles = visibleGroups.false || [];
32087                     if (visibles.length) {
32088                       var visibleIDs = visibles.map(function(entity) {
32089                         return entity.id;
32090                       });
32091                       var stack2 = _stack.map(function(state) {
32092                         return state.graph;
32093                       });
32094                       missing = utilArrayDifference(missing, visibleIDs);
32095                       _stack[0].graph.rebase(visibles, stack2, true);
32096                       _tree.rebase(visibles, true);
32097                     }
32098                     invisibles.forEach(function(entity) {
32099                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
32100                     });
32101                   }
32102                   if (err || !missing.length) {
32103                     loading.close();
32104                     context.map().redrawEnable(true);
32105                     dispatch14.call("change");
32106                     dispatch14.call("restore", this);
32107                   }
32108                 };
32109                 osm.loadMultiple(missing, childNodesLoaded);
32110               }
32111             }
32112           }
32113           _stack = h3.stack.map(function(d2) {
32114             var entities = {}, entity;
32115             if (d2.modified) {
32116               d2.modified.forEach(function(key) {
32117                 entity = allEntities[key];
32118                 entities[entity.id] = entity;
32119               });
32120             }
32121             if (d2.deleted) {
32122               d2.deleted.forEach(function(id2) {
32123                 entities[id2] = void 0;
32124               });
32125             }
32126             return {
32127               graph: coreGraph(_stack[0].graph).load(entities),
32128               annotation: d2.annotation,
32129               imageryUsed: d2.imageryUsed,
32130               photoOverlaysUsed: d2.photoOverlaysUsed,
32131               transform: d2.transform,
32132               selectedIDs: d2.selectedIDs
32133             };
32134           });
32135         } else {
32136           _stack = h3.stack.map(function(d2) {
32137             var entities = {};
32138             for (var i3 in d2.entities) {
32139               var entity = d2.entities[i3];
32140               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
32141             }
32142             d2.graph = coreGraph(_stack[0].graph).load(entities);
32143             return d2;
32144           });
32145         }
32146         var transform2 = _stack[_index].transform;
32147         if (transform2) {
32148           context.map().transformEase(transform2, 0);
32149         }
32150         if (loadComplete) {
32151           dispatch14.call("change");
32152           dispatch14.call("restore", this);
32153         }
32154         return history;
32155       },
32156       lock: function() {
32157         return lock.lock();
32158       },
32159       unlock: function() {
32160         lock.unlock();
32161       },
32162       save: function() {
32163         if (lock.locked() && // don't overwrite existing, unresolved changes
32164         !_hasUnresolvedRestorableChanges) {
32165           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
32166           if (!success) dispatch14.call("storage_error");
32167         }
32168         return history;
32169       },
32170       // delete the history version saved in localStorage
32171       clearSaved: function() {
32172         context.debouncedSave.cancel();
32173         if (lock.locked()) {
32174           _hasUnresolvedRestorableChanges = false;
32175           corePreferences(getKey("saved_history"), null);
32176           corePreferences("comment", null);
32177           corePreferences("hashtags", null);
32178           corePreferences("source", null);
32179         }
32180         return history;
32181       },
32182       savedHistoryJSON: function() {
32183         return corePreferences(getKey("saved_history"));
32184       },
32185       hasRestorableChanges: function() {
32186         return _hasUnresolvedRestorableChanges;
32187       },
32188       // load history from a version stored in localStorage
32189       restore: function() {
32190         if (lock.locked()) {
32191           _hasUnresolvedRestorableChanges = false;
32192           var json = this.savedHistoryJSON();
32193           if (json) history.fromJSON(json, true);
32194         }
32195       },
32196       _getKey: getKey
32197     };
32198     history.reset();
32199     return utilRebind(history, dispatch14, "on");
32200   }
32201   var init_history = __esm({
32202     "modules/core/history.js"() {
32203       "use strict";
32204       init_src4();
32205       init_src10();
32206       init_src5();
32207       init_preferences();
32208       init_difference();
32209       init_graph();
32210       init_tree();
32211       init_entity();
32212       init_loading();
32213       init_util();
32214     }
32215   });
32216
32217   // modules/util/utilDisplayLabel.js
32218   var utilDisplayLabel_exports = {};
32219   __export(utilDisplayLabel_exports, {
32220     utilDisplayLabel: () => utilDisplayLabel
32221   });
32222   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
32223     var result;
32224     var displayName = utilDisplayName(entity);
32225     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
32226     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
32227     if (verbose) {
32228       result = [presetName, displayName].filter(Boolean).join(" ");
32229     } else {
32230       result = displayName || presetName;
32231     }
32232     return result || utilDisplayType(entity.id);
32233   }
32234   var init_utilDisplayLabel = __esm({
32235     "modules/util/utilDisplayLabel.js"() {
32236       "use strict";
32237       init_presets();
32238       init_util2();
32239     }
32240   });
32241
32242   // modules/core/validation/models.js
32243   var models_exports = {};
32244   __export(models_exports, {
32245     validationIssue: () => validationIssue,
32246     validationIssueFix: () => validationIssueFix
32247   });
32248   function validationIssue(attrs) {
32249     this.type = attrs.type;
32250     this.subtype = attrs.subtype;
32251     this.severity = attrs.severity;
32252     this.message = attrs.message;
32253     this.reference = attrs.reference;
32254     this.entityIds = attrs.entityIds;
32255     this.loc = attrs.loc;
32256     this.data = attrs.data;
32257     this.dynamicFixes = attrs.dynamicFixes;
32258     this.hash = attrs.hash;
32259     this.id = generateID.apply(this);
32260     this.key = generateKey.apply(this);
32261     this.autoFix = null;
32262     function generateID() {
32263       var parts = [this.type];
32264       if (this.hash) {
32265         parts.push(this.hash);
32266       }
32267       if (this.subtype) {
32268         parts.push(this.subtype);
32269       }
32270       if (this.entityIds) {
32271         var entityKeys = this.entityIds.slice().sort();
32272         parts.push.apply(parts, entityKeys);
32273       }
32274       return parts.join(":");
32275     }
32276     function generateKey() {
32277       return this.id + ":" + Date.now().toString();
32278     }
32279     this.extent = function(resolver) {
32280       if (this.loc) {
32281         return geoExtent(this.loc);
32282       }
32283       if (this.entityIds && this.entityIds.length) {
32284         return this.entityIds.reduce(function(extent, entityId) {
32285           return extent.extend(resolver.entity(entityId).extent(resolver));
32286         }, geoExtent());
32287       }
32288       return null;
32289     };
32290     this.fixes = function(context) {
32291       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
32292       var issue = this;
32293       if (issue.severity === "warning") {
32294         fixes.push(new validationIssueFix({
32295           title: _t.append("issues.fix.ignore_issue.title"),
32296           icon: "iD-icon-close",
32297           onClick: function() {
32298             context.validator().ignoreIssue(this.issue.id);
32299           }
32300         }));
32301       }
32302       fixes.forEach(function(fix) {
32303         fix.id = fix.title.stringId;
32304         fix.issue = issue;
32305         if (fix.autoArgs) {
32306           issue.autoFix = fix;
32307         }
32308       });
32309       return fixes;
32310     };
32311   }
32312   function validationIssueFix(attrs) {
32313     this.title = attrs.title;
32314     this.onClick = attrs.onClick;
32315     this.disabledReason = attrs.disabledReason;
32316     this.icon = attrs.icon;
32317     this.entityIds = attrs.entityIds || [];
32318     this.autoArgs = attrs.autoArgs;
32319     this.issue = null;
32320   }
32321   var init_models = __esm({
32322     "modules/core/validation/models.js"() {
32323       "use strict";
32324       init_geo2();
32325       init_localizer();
32326     }
32327   });
32328
32329   // modules/core/validation/index.js
32330   var validation_exports = {};
32331   __export(validation_exports, {
32332     validationIssue: () => validationIssue,
32333     validationIssueFix: () => validationIssueFix
32334   });
32335   var init_validation = __esm({
32336     "modules/core/validation/index.js"() {
32337       "use strict";
32338       init_models();
32339     }
32340   });
32341
32342   // modules/services/keepRight.js
32343   var keepRight_exports = {};
32344   __export(keepRight_exports, {
32345     default: () => keepRight_default
32346   });
32347   function abortRequest(controller) {
32348     if (controller) {
32349       controller.abort();
32350     }
32351   }
32352   function abortUnwantedRequests(cache, tiles) {
32353     Object.keys(cache.inflightTile).forEach((k3) => {
32354       const wanted = tiles.find((tile) => k3 === tile.id);
32355       if (!wanted) {
32356         abortRequest(cache.inflightTile[k3]);
32357         delete cache.inflightTile[k3];
32358       }
32359     });
32360   }
32361   function encodeIssueRtree(d2) {
32362     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
32363   }
32364   function updateRtree(item, replace) {
32365     _cache.rtree.remove(item, (a4, b3) => a4.data.id === b3.data.id);
32366     if (replace) {
32367       _cache.rtree.insert(item);
32368     }
32369   }
32370   function tokenReplacements(d2) {
32371     if (!(d2 instanceof QAItem)) return;
32372     const replacements = {};
32373     const issueTemplate = _krData.errorTypes[d2.whichType];
32374     if (!issueTemplate) {
32375       console.log("No Template: ", d2.whichType);
32376       console.log("  ", d2.description);
32377       return;
32378     }
32379     if (!issueTemplate.regex) return;
32380     const errorRegex = new RegExp(issueTemplate.regex, "i");
32381     const errorMatch = errorRegex.exec(d2.description);
32382     if (!errorMatch) {
32383       console.log("Unmatched: ", d2.whichType);
32384       console.log("  ", d2.description);
32385       console.log("  ", errorRegex);
32386       return;
32387     }
32388     for (let i3 = 1; i3 < errorMatch.length; i3++) {
32389       let capture = errorMatch[i3];
32390       let idType;
32391       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
32392       if (idType && capture) {
32393         capture = parseError(capture, idType);
32394       } else {
32395         const compare2 = capture.toLowerCase();
32396         if (_krData.localizeStrings[compare2]) {
32397           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
32398         } else {
32399           capture = unescape_default(capture);
32400         }
32401       }
32402       replacements["var" + i3] = capture;
32403     }
32404     return replacements;
32405   }
32406   function parseError(capture, idType) {
32407     const compare2 = capture.toLowerCase();
32408     if (_krData.localizeStrings[compare2]) {
32409       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
32410     }
32411     switch (idType) {
32412       // link a string like "this node"
32413       case "this":
32414         capture = linkErrorObject(capture);
32415         break;
32416       case "url":
32417         capture = linkURL(capture);
32418         break;
32419       // link an entity ID
32420       case "n":
32421       case "w":
32422       case "r":
32423         capture = linkEntity(idType + capture);
32424         break;
32425       // some errors have more complex ID lists/variance
32426       case "20":
32427         capture = parse20(capture);
32428         break;
32429       case "211":
32430         capture = parse211(capture);
32431         break;
32432       case "231":
32433         capture = parse231(capture);
32434         break;
32435       case "294":
32436         capture = parse294(capture);
32437         break;
32438       case "370":
32439         capture = parse370(capture);
32440         break;
32441     }
32442     return capture;
32443     function linkErrorObject(d2) {
32444       return { html: `<a class="error_object_link">${d2}</a>` };
32445     }
32446     function linkEntity(d2) {
32447       return { html: `<a class="error_entity_link">${d2}</a>` };
32448     }
32449     function linkURL(d2) {
32450       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
32451     }
32452     function parse211(capture2) {
32453       let newList = [];
32454       const items = capture2.split(", ");
32455       items.forEach((item) => {
32456         let id2 = linkEntity("n" + item.slice(1));
32457         newList.push(id2);
32458       });
32459       return newList.join(", ");
32460     }
32461     function parse231(capture2) {
32462       let newList = [];
32463       const items = capture2.split("),");
32464       items.forEach((item) => {
32465         const match = item.match(/\#(\d+)\((.+)\)?/);
32466         if (match !== null && match.length > 2) {
32467           newList.push(
32468             linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
32469           );
32470         }
32471       });
32472       return newList.join(", ");
32473     }
32474     function parse294(capture2) {
32475       let newList = [];
32476       const items = capture2.split(",");
32477       items.forEach((item) => {
32478         item = item.split(" ");
32479         const role = `"${item[0]}"`;
32480         const idType2 = item[1].slice(0, 1);
32481         let id2 = item[2].slice(1);
32482         id2 = linkEntity(idType2 + id2);
32483         newList.push(`${role} ${item[1]} ${id2}`);
32484       });
32485       return newList.join(", ");
32486     }
32487     function parse370(capture2) {
32488       if (!capture2) return "";
32489       const match = capture2.match(/\(including the name (\'.+\')\)/);
32490       if (match && match.length) {
32491         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
32492       }
32493       return "";
32494     }
32495     function parse20(capture2) {
32496       let newList = [];
32497       const items = capture2.split(",");
32498       items.forEach((item) => {
32499         const id2 = linkEntity("n" + item.slice(1));
32500         newList.push(id2);
32501       });
32502       return newList.join(", ");
32503     }
32504   }
32505   var tiler, dispatch2, _tileZoom, _krUrlRoot, _krData, _cache, _krRuleset, keepRight_default;
32506   var init_keepRight = __esm({
32507     "modules/services/keepRight.js"() {
32508       "use strict";
32509       init_rbush();
32510       init_src4();
32511       init_src18();
32512       init_lodash();
32513       init_file_fetcher();
32514       init_geo2();
32515       init_osm();
32516       init_localizer();
32517       init_util();
32518       tiler = utilTiler();
32519       dispatch2 = dispatch_default("loaded");
32520       _tileZoom = 14;
32521       _krUrlRoot = "https://www.keepright.at";
32522       _krData = { errorTypes: {}, localizeStrings: {} };
32523       _krRuleset = [
32524         // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
32525         30,
32526         40,
32527         50,
32528         60,
32529         70,
32530         90,
32531         100,
32532         110,
32533         120,
32534         130,
32535         150,
32536         160,
32537         170,
32538         180,
32539         190,
32540         191,
32541         192,
32542         193,
32543         194,
32544         195,
32545         196,
32546         197,
32547         198,
32548         200,
32549         201,
32550         202,
32551         203,
32552         204,
32553         205,
32554         206,
32555         207,
32556         208,
32557         210,
32558         220,
32559         230,
32560         231,
32561         232,
32562         270,
32563         280,
32564         281,
32565         282,
32566         283,
32567         284,
32568         285,
32569         290,
32570         291,
32571         292,
32572         293,
32573         294,
32574         295,
32575         296,
32576         297,
32577         298,
32578         300,
32579         310,
32580         311,
32581         312,
32582         313,
32583         320,
32584         350,
32585         360,
32586         370,
32587         380,
32588         390,
32589         400,
32590         401,
32591         402,
32592         410,
32593         411,
32594         412,
32595         413
32596       ];
32597       keepRight_default = {
32598         title: "keepRight",
32599         init() {
32600           _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
32601           if (!_cache) {
32602             this.reset();
32603           }
32604           this.event = utilRebind(this, dispatch2, "on");
32605         },
32606         reset() {
32607           if (_cache) {
32608             Object.values(_cache.inflightTile).forEach(abortRequest);
32609           }
32610           _cache = {
32611             data: {},
32612             loadedTile: {},
32613             inflightTile: {},
32614             inflightPost: {},
32615             closed: {},
32616             rtree: new RBush()
32617           };
32618         },
32619         // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
32620         loadIssues(projection2) {
32621           const options = {
32622             format: "geojson",
32623             ch: _krRuleset
32624           };
32625           const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
32626           abortUnwantedRequests(_cache, tiles);
32627           tiles.forEach((tile) => {
32628             if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
32629             const [left, top, right, bottom] = tile.extent.rectangle();
32630             const params = Object.assign({}, options, { left, bottom, right, top });
32631             const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
32632             const controller = new AbortController();
32633             _cache.inflightTile[tile.id] = controller;
32634             json_default(url, { signal: controller.signal }).then((data) => {
32635               delete _cache.inflightTile[tile.id];
32636               _cache.loadedTile[tile.id] = true;
32637               if (!data || !data.features || !data.features.length) {
32638                 throw new Error("No Data");
32639               }
32640               data.features.forEach((feature3) => {
32641                 const {
32642                   properties: {
32643                     error_type: itemType,
32644                     error_id: id2,
32645                     comment = null,
32646                     object_id: objectId,
32647                     object_type: objectType,
32648                     schema,
32649                     title
32650                   }
32651                 } = feature3;
32652                 let {
32653                   geometry: { coordinates: loc },
32654                   properties: { description = "" }
32655                 } = feature3;
32656                 const issueTemplate = _krData.errorTypes[itemType];
32657                 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
32658                 const whichType = issueTemplate ? itemType : parentIssueType;
32659                 const whichTemplate = _krData.errorTypes[whichType];
32660                 switch (whichType) {
32661                   case "170":
32662                     description = `This feature has a FIXME tag: ${description}`;
32663                     break;
32664                   case "292":
32665                   case "293":
32666                     description = description.replace("A turn-", "This turn-");
32667                     break;
32668                   case "294":
32669                   case "295":
32670                   case "296":
32671                   case "297":
32672                   case "298":
32673                     description = `This turn-restriction~${description}`;
32674                     break;
32675                   case "300":
32676                     description = "This highway is missing a maxspeed tag";
32677                     break;
32678                   case "411":
32679                   case "412":
32680                   case "413":
32681                     description = `This feature~${description}`;
32682                     break;
32683                 }
32684                 let coincident = false;
32685                 do {
32686                   let delta = coincident ? [1e-5, 0] : [0, 1e-5];
32687                   loc = geoVecAdd(loc, delta);
32688                   let bbox2 = geoExtent(loc).bbox();
32689                   coincident = _cache.rtree.search(bbox2).length;
32690                 } while (coincident);
32691                 let d2 = new QAItem(loc, this, itemType, id2, {
32692                   comment,
32693                   description,
32694                   whichType,
32695                   parentIssueType,
32696                   severity: whichTemplate.severity || "error",
32697                   objectId,
32698                   objectType,
32699                   schema,
32700                   title
32701                 });
32702                 d2.replacements = tokenReplacements(d2);
32703                 _cache.data[id2] = d2;
32704                 _cache.rtree.insert(encodeIssueRtree(d2));
32705               });
32706               dispatch2.call("loaded");
32707             }).catch(() => {
32708               delete _cache.inflightTile[tile.id];
32709               _cache.loadedTile[tile.id] = true;
32710             });
32711           });
32712         },
32713         postUpdate(d2, callback) {
32714           if (_cache.inflightPost[d2.id]) {
32715             return callback({ message: "Error update already inflight", status: -2 }, d2);
32716           }
32717           const params = { schema: d2.schema, id: d2.id };
32718           if (d2.newStatus) {
32719             params.st = d2.newStatus;
32720           }
32721           if (d2.newComment !== void 0) {
32722             params.co = d2.newComment;
32723           }
32724           const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
32725           const controller = new AbortController();
32726           _cache.inflightPost[d2.id] = controller;
32727           json_default(url, { signal: controller.signal }).finally(() => {
32728             delete _cache.inflightPost[d2.id];
32729             if (d2.newStatus === "ignore") {
32730               this.removeItem(d2);
32731             } else if (d2.newStatus === "ignore_t") {
32732               this.removeItem(d2);
32733               _cache.closed[`${d2.schema}:${d2.id}`] = true;
32734             } else {
32735               d2 = this.replaceItem(d2.update({
32736                 comment: d2.newComment,
32737                 newComment: void 0,
32738                 newState: void 0
32739               }));
32740             }
32741             if (callback) callback(null, d2);
32742           });
32743         },
32744         // Get all cached QAItems covering the viewport
32745         getItems(projection2) {
32746           const viewport = projection2.clipExtent();
32747           const min3 = [viewport[0][0], viewport[1][1]];
32748           const max3 = [viewport[1][0], viewport[0][1]];
32749           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
32750           return _cache.rtree.search(bbox2).map((d2) => d2.data);
32751         },
32752         // Get a QAItem from cache
32753         // NOTE: Don't change method name until UI v3 is merged
32754         getError(id2) {
32755           return _cache.data[id2];
32756         },
32757         // Replace a single QAItem in the cache
32758         replaceItem(item) {
32759           if (!(item instanceof QAItem) || !item.id) return;
32760           _cache.data[item.id] = item;
32761           updateRtree(encodeIssueRtree(item), true);
32762           return item;
32763         },
32764         // Remove a single QAItem from the cache
32765         removeItem(item) {
32766           if (!(item instanceof QAItem) || !item.id) return;
32767           delete _cache.data[item.id];
32768           updateRtree(encodeIssueRtree(item), false);
32769         },
32770         issueURL(item) {
32771           return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
32772         },
32773         // Get an array of issues closed during this session.
32774         // Used to populate `closed:keepright` changeset tag
32775         getClosedIDs() {
32776           return Object.keys(_cache.closed).sort();
32777         }
32778       };
32779     }
32780   });
32781
32782   // node_modules/marked/lib/marked.esm.js
32783   function M() {
32784     return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
32785   }
32786   function H(a4) {
32787     w = a4;
32788   }
32789   function h(a4, e3 = "") {
32790     let t2 = typeof a4 == "string" ? a4 : a4.source, n3 = { replace: (s2, i3) => {
32791       let r2 = typeof i3 == "string" ? i3 : i3.source;
32792       return r2 = r2.replace(m.caret, "$1"), t2 = t2.replace(s2, r2), n3;
32793     }, getRegex: () => new RegExp(t2, e3) };
32794     return n3;
32795   }
32796   function R(a4, e3) {
32797     if (e3) {
32798       if (m.escapeTest.test(a4)) return a4.replace(m.escapeReplace, ge);
32799     } else if (m.escapeTestNoEncode.test(a4)) return a4.replace(m.escapeReplaceNoEncode, ge);
32800     return a4;
32801   }
32802   function J(a4) {
32803     try {
32804       a4 = encodeURI(a4).replace(m.percentDecode, "%");
32805     } catch {
32806       return null;
32807     }
32808     return a4;
32809   }
32810   function V(a4, e3) {
32811     var _a4;
32812     let t2 = a4.replace(m.findPipe, (i3, r2, o2) => {
32813       let l2 = false, c2 = r2;
32814       for (; --c2 >= 0 && o2[c2] === "\\"; ) l2 = !l2;
32815       return l2 ? "|" : " |";
32816     }), n3 = t2.split(m.splitPipe), s2 = 0;
32817     if (n3[0].trim() || n3.shift(), n3.length > 0 && !((_a4 = n3.at(-1)) == null ? void 0 : _a4.trim()) && n3.pop(), e3) if (n3.length > e3) n3.splice(e3);
32818     else for (; n3.length < e3; ) n3.push("");
32819     for (; s2 < n3.length; s2++) n3[s2] = n3[s2].trim().replace(m.slashPipe, "|");
32820     return n3;
32821   }
32822   function A(a4, e3, t2) {
32823     let n3 = a4.length;
32824     if (n3 === 0) return "";
32825     let s2 = 0;
32826     for (; s2 < n3; ) {
32827       let i3 = a4.charAt(n3 - s2 - 1);
32828       if (i3 === e3 && !t2) s2++;
32829       else if (i3 !== e3 && t2) s2++;
32830       else break;
32831     }
32832     return a4.slice(0, n3 - s2);
32833   }
32834   function fe(a4, e3) {
32835     if (a4.indexOf(e3[1]) === -1) return -1;
32836     let t2 = 0;
32837     for (let n3 = 0; n3 < a4.length; n3++) if (a4[n3] === "\\") n3++;
32838     else if (a4[n3] === e3[0]) t2++;
32839     else if (a4[n3] === e3[1] && (t2--, t2 < 0)) return n3;
32840     return t2 > 0 ? -2 : -1;
32841   }
32842   function de(a4, e3, t2, n3, s2) {
32843     let i3 = e3.href, r2 = e3.title || null, o2 = a4[1].replace(s2.other.outputLinkReplace, "$1");
32844     n3.state.inLink = true;
32845     let l2 = { type: a4[0].charAt(0) === "!" ? "image" : "link", raw: t2, href: i3, title: r2, text: o2, tokens: n3.inlineTokens(o2) };
32846     return n3.state.inLink = false, l2;
32847   }
32848   function Je(a4, e3, t2) {
32849     let n3 = a4.match(t2.other.indentCodeCompensation);
32850     if (n3 === null) return e3;
32851     let s2 = n3[1];
32852     return e3.split(`
32853 `).map((i3) => {
32854       let r2 = i3.match(t2.other.beginningSpace);
32855       if (r2 === null) return i3;
32856       let [o2] = r2;
32857       return o2.length >= s2.length ? i3.slice(s2.length) : i3;
32858     }).join(`
32859 `);
32860   }
32861   function k(a4, e3) {
32862     return z.parse(a4, e3);
32863   }
32864   var w, C, m, xe, be, Te, I, we, j, re2, ie, ye, F, Re, Q, Se, $e, v, U, _e, oe, Le, K, se, ze, Me, Pe, Ae, le, Ee, D, X, ae, Ce, ce, Ie, Oe, Be, pe, qe, ve, ue, De, Ze, Ge, He, Ne, je, Fe, q, Qe, he, ke, Ue, W, Ke, N, Xe, O, P, We, ge, S, b, $, _, T, _a2, L, B, z, Dt, Zt, Gt, Ht, Nt, Ft, Qt;
32865   var init_marked_esm = __esm({
32866     "node_modules/marked/lib/marked.esm.js"() {
32867       w = M();
32868       C = { exec: () => null };
32869       m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (a4) => new RegExp(`^( {0,3}${a4})((?:[  ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[   ][^\\n]*)?(?:\\n|$))`), hrRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}#`), htmlBeginRegex: (a4) => new RegExp(`^ {0,${Math.min(3, a4 - 1)}}<(?:[a-z].*>|!--)`, "i") };
32870       xe = /^(?:[ \t]*(?:\n|$))+/;
32871       be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
32872       Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
32873       I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
32874       we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
32875       j = /(?:[*+-]|\d{1,9}[.)])/;
32876       re2 = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
32877       ie = h(re2).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
32878       ye = h(re2).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
32879       F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
32880       Re = /^[^\n]+/;
32881       Q = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
32882       Se = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
32883       $e = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
32884       v = "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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
32885       U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
32886       _e = h("^ {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|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
32887       oe = h(F).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").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", v).getRegex();
32888       Le = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex();
32889       K = { blockquote: Le, code: be, def: Se, fences: Te, heading: we, hr: I, html: _e, lheading: ie, list: $e, newline: xe, paragraph: oe, table: C, text: Re };
32890       se = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}       )[^\\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", v).getRegex();
32891       ze = { ...K, lheading: ye, table: se, paragraph: h(F).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).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", v).getRegex() };
32892       Me = { ...K, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: C, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", I).replace("heading", ` *#{1,6} *[^
32893 ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
32894       Pe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
32895       Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
32896       le = /^( {2,}|\\)\n(?!\s*$)/;
32897       Ee = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
32898       D = /[\p{P}\p{S}]/u;
32899       X = /[\s\p{P}\p{S}]/u;
32900       ae = /[^\s\p{P}\p{S}]/u;
32901       Ce = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex();
32902       ce = /(?!~)[\p{P}\p{S}]/u;
32903       Ie = /(?!~)[\s\p{P}\p{S}]/u;
32904       Oe = /(?:[^\s\p{P}\p{S}]|~)/u;
32905       Be = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
32906       pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
32907       qe = h(pe, "u").replace(/punct/g, D).getRegex();
32908       ve = h(pe, "u").replace(/punct/g, ce).getRegex();
32909       ue = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
32910       De = h(ue, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex();
32911       Ze = h(ue, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ie).replace(/punct/g, ce).getRegex();
32912       Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, X).replace(/punct/g, D).getRegex();
32913       He = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex();
32914       Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex();
32915       je = h(U).replace("(?:-->|$)", "-->").getRegex();
32916       Fe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
32917       q = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
32918       Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
32919       he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex();
32920       ke = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex();
32921       Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
32922       W = { _backpedal: C, anyPunctuation: He, autolink: Ne, blockSkip: Be, br: le, code: Ae, del: C, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ge, escape: Pe, link: Qe, nolink: ke, punctuation: Ce, reflink: he, reflinkSearch: Ue, tag: Fe, text: Ee, url: C };
32923       Ke = { ...W, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
32924       N = { ...W, emStrongRDelimAst: Ze, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ };
32925       Xe = { ...N, br: h(le).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
32926       O = { normal: K, gfm: ze, pedantic: Me };
32927       P = { normal: W, gfm: N, breaks: Xe, pedantic: Ke };
32928       We = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
32929       ge = (a4) => We[a4];
32930       S = class {
32931         constructor(e3) {
32932           __publicField(this, "options");
32933           __publicField(this, "rules");
32934           __publicField(this, "lexer");
32935           this.options = e3 || w;
32936         }
32937         space(e3) {
32938           let t2 = this.rules.block.newline.exec(e3);
32939           if (t2 && t2[0].length > 0) return { type: "space", raw: t2[0] };
32940         }
32941         code(e3) {
32942           let t2 = this.rules.block.code.exec(e3);
32943           if (t2) {
32944             let n3 = t2[0].replace(this.rules.other.codeRemoveIndent, "");
32945             return { type: "code", raw: t2[0], codeBlockStyle: "indented", text: this.options.pedantic ? n3 : A(n3, `
32946 `) };
32947           }
32948         }
32949         fences(e3) {
32950           let t2 = this.rules.block.fences.exec(e3);
32951           if (t2) {
32952             let n3 = t2[0], s2 = Je(n3, t2[3] || "", this.rules);
32953             return { type: "code", raw: n3, lang: t2[2] ? t2[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t2[2], text: s2 };
32954           }
32955         }
32956         heading(e3) {
32957           let t2 = this.rules.block.heading.exec(e3);
32958           if (t2) {
32959             let n3 = t2[2].trim();
32960             if (this.rules.other.endingHash.test(n3)) {
32961               let s2 = A(n3, "#");
32962               (this.options.pedantic || !s2 || this.rules.other.endingSpaceChar.test(s2)) && (n3 = s2.trim());
32963             }
32964             return { type: "heading", raw: t2[0], depth: t2[1].length, text: n3, tokens: this.lexer.inline(n3) };
32965           }
32966         }
32967         hr(e3) {
32968           let t2 = this.rules.block.hr.exec(e3);
32969           if (t2) return { type: "hr", raw: A(t2[0], `
32970 `) };
32971         }
32972         blockquote(e3) {
32973           let t2 = this.rules.block.blockquote.exec(e3);
32974           if (t2) {
32975             let n3 = A(t2[0], `
32976 `).split(`
32977 `), s2 = "", i3 = "", r2 = [];
32978             for (; n3.length > 0; ) {
32979               let o2 = false, l2 = [], c2;
32980               for (c2 = 0; c2 < n3.length; c2++) if (this.rules.other.blockquoteStart.test(n3[c2])) l2.push(n3[c2]), o2 = true;
32981               else if (!o2) l2.push(n3[c2]);
32982               else break;
32983               n3 = n3.slice(c2);
32984               let p2 = l2.join(`
32985 `), u2 = p2.replace(this.rules.other.blockquoteSetextReplace, `
32986     $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
32987               s2 = s2 ? `${s2}
32988 ${p2}` : p2, i3 = i3 ? `${i3}
32989 ${u2}` : u2;
32990               let d2 = this.lexer.state.top;
32991               if (this.lexer.state.top = true, this.lexer.blockTokens(u2, r2, true), this.lexer.state.top = d2, n3.length === 0) break;
32992               let g3 = r2.at(-1);
32993               if ((g3 == null ? void 0 : g3.type) === "code") break;
32994               if ((g3 == null ? void 0 : g3.type) === "blockquote") {
32995                 let x2 = g3, f2 = x2.raw + `
32996 ` + n3.join(`
32997 `), y2 = this.blockquote(f2);
32998                 r2[r2.length - 1] = y2, s2 = s2.substring(0, s2.length - x2.raw.length) + y2.raw, i3 = i3.substring(0, i3.length - x2.text.length) + y2.text;
32999                 break;
33000               } else if ((g3 == null ? void 0 : g3.type) === "list") {
33001                 let x2 = g3, f2 = x2.raw + `
33002 ` + n3.join(`
33003 `), y2 = this.list(f2);
33004                 r2[r2.length - 1] = y2, s2 = s2.substring(0, s2.length - g3.raw.length) + y2.raw, i3 = i3.substring(0, i3.length - x2.raw.length) + y2.raw, n3 = f2.substring(r2.at(-1).raw.length).split(`
33005 `);
33006                 continue;
33007               }
33008             }
33009             return { type: "blockquote", raw: s2, tokens: r2, text: i3 };
33010           }
33011         }
33012         list(e3) {
33013           let t2 = this.rules.block.list.exec(e3);
33014           if (t2) {
33015             let n3 = t2[1].trim(), s2 = n3.length > 1, i3 = { type: "list", raw: "", ordered: s2, start: s2 ? +n3.slice(0, -1) : "", loose: false, items: [] };
33016             n3 = s2 ? `\\d{1,9}\\${n3.slice(-1)}` : `\\${n3}`, this.options.pedantic && (n3 = s2 ? n3 : "[*+-]");
33017             let r2 = this.rules.other.listItemRegex(n3), o2 = false;
33018             for (; e3; ) {
33019               let c2 = false, p2 = "", u2 = "";
33020               if (!(t2 = r2.exec(e3)) || this.rules.block.hr.test(e3)) break;
33021               p2 = t2[0], e3 = e3.substring(p2.length);
33022               let d2 = t2[2].split(`
33023 `, 1)[0].replace(this.rules.other.listReplaceTabs, (Z3) => " ".repeat(3 * Z3.length)), g3 = e3.split(`
33024 `, 1)[0], x2 = !d2.trim(), f2 = 0;
33025               if (this.options.pedantic ? (f2 = 2, u2 = d2.trimStart()) : x2 ? f2 = t2[1].length + 1 : (f2 = t2[2].search(this.rules.other.nonSpaceChar), f2 = f2 > 4 ? 1 : f2, u2 = d2.slice(f2), f2 += t2[1].length), x2 && this.rules.other.blankLine.test(g3) && (p2 += g3 + `
33026 `, e3 = e3.substring(g3.length + 1), c2 = true), !c2) {
33027                 let Z3 = this.rules.other.nextBulletRegex(f2), ee2 = this.rules.other.hrRegex(f2), te2 = this.rules.other.fencesBeginRegex(f2), ne2 = this.rules.other.headingBeginRegex(f2), me2 = this.rules.other.htmlBeginRegex(f2);
33028                 for (; e3; ) {
33029                   let G2 = e3.split(`
33030 `, 1)[0], E2;
33031                   if (g3 = G2, this.options.pedantic ? (g3 = g3.replace(this.rules.other.listReplaceNesting, "  "), E2 = g3) : E2 = g3.replace(this.rules.other.tabCharGlobal, "    "), te2.test(g3) || ne2.test(g3) || me2.test(g3) || Z3.test(g3) || ee2.test(g3)) break;
33032                   if (E2.search(this.rules.other.nonSpaceChar) >= f2 || !g3.trim()) u2 += `
33033 ` + E2.slice(f2);
33034                   else {
33035                     if (x2 || d2.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || te2.test(d2) || ne2.test(d2) || ee2.test(d2)) break;
33036                     u2 += `
33037 ` + g3;
33038                   }
33039                   !x2 && !g3.trim() && (x2 = true), p2 += G2 + `
33040 `, e3 = e3.substring(G2.length + 1), d2 = E2.slice(f2);
33041                 }
33042               }
33043               i3.loose || (o2 ? i3.loose = true : this.rules.other.doubleBlankLine.test(p2) && (o2 = true));
33044               let y2 = null, Y4;
33045               this.options.gfm && (y2 = this.rules.other.listIsTask.exec(u2), y2 && (Y4 = y2[0] !== "[ ] ", u2 = u2.replace(this.rules.other.listReplaceTask, ""))), i3.items.push({ type: "list_item", raw: p2, task: !!y2, checked: Y4, loose: false, text: u2, tokens: [] }), i3.raw += p2;
33046             }
33047             let l2 = i3.items.at(-1);
33048             if (l2) l2.raw = l2.raw.trimEnd(), l2.text = l2.text.trimEnd();
33049             else return;
33050             i3.raw = i3.raw.trimEnd();
33051             for (let c2 = 0; c2 < i3.items.length; c2++) if (this.lexer.state.top = false, i3.items[c2].tokens = this.lexer.blockTokens(i3.items[c2].text, []), !i3.loose) {
33052               let p2 = i3.items[c2].tokens.filter((d2) => d2.type === "space"), u2 = p2.length > 0 && p2.some((d2) => this.rules.other.anyLine.test(d2.raw));
33053               i3.loose = u2;
33054             }
33055             if (i3.loose) for (let c2 = 0; c2 < i3.items.length; c2++) i3.items[c2].loose = true;
33056             return i3;
33057           }
33058         }
33059         html(e3) {
33060           let t2 = this.rules.block.html.exec(e3);
33061           if (t2) return { type: "html", block: true, raw: t2[0], pre: t2[1] === "pre" || t2[1] === "script" || t2[1] === "style", text: t2[0] };
33062         }
33063         def(e3) {
33064           let t2 = this.rules.block.def.exec(e3);
33065           if (t2) {
33066             let n3 = t2[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s2 = t2[2] ? t2[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i3 = t2[3] ? t2[3].substring(1, t2[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t2[3];
33067             return { type: "def", tag: n3, raw: t2[0], href: s2, title: i3 };
33068           }
33069         }
33070         table(e3) {
33071           var _a4;
33072           let t2 = this.rules.block.table.exec(e3);
33073           if (!t2 || !this.rules.other.tableDelimiter.test(t2[2])) return;
33074           let n3 = V(t2[1]), s2 = t2[2].replace(this.rules.other.tableAlignChars, "").split("|"), i3 = ((_a4 = t2[3]) == null ? void 0 : _a4.trim()) ? t2[3].replace(this.rules.other.tableRowBlankLine, "").split(`
33075 `) : [], r2 = { type: "table", raw: t2[0], header: [], align: [], rows: [] };
33076           if (n3.length === s2.length) {
33077             for (let o2 of s2) this.rules.other.tableAlignRight.test(o2) ? r2.align.push("right") : this.rules.other.tableAlignCenter.test(o2) ? r2.align.push("center") : this.rules.other.tableAlignLeft.test(o2) ? r2.align.push("left") : r2.align.push(null);
33078             for (let o2 = 0; o2 < n3.length; o2++) r2.header.push({ text: n3[o2], tokens: this.lexer.inline(n3[o2]), header: true, align: r2.align[o2] });
33079             for (let o2 of i3) r2.rows.push(V(o2, r2.header.length).map((l2, c2) => ({ text: l2, tokens: this.lexer.inline(l2), header: false, align: r2.align[c2] })));
33080             return r2;
33081           }
33082         }
33083         lheading(e3) {
33084           let t2 = this.rules.block.lheading.exec(e3);
33085           if (t2) return { type: "heading", raw: t2[0], depth: t2[2].charAt(0) === "=" ? 1 : 2, text: t2[1], tokens: this.lexer.inline(t2[1]) };
33086         }
33087         paragraph(e3) {
33088           let t2 = this.rules.block.paragraph.exec(e3);
33089           if (t2) {
33090             let n3 = t2[1].charAt(t2[1].length - 1) === `
33091 ` ? t2[1].slice(0, -1) : t2[1];
33092             return { type: "paragraph", raw: t2[0], text: n3, tokens: this.lexer.inline(n3) };
33093           }
33094         }
33095         text(e3) {
33096           let t2 = this.rules.block.text.exec(e3);
33097           if (t2) return { type: "text", raw: t2[0], text: t2[0], tokens: this.lexer.inline(t2[0]) };
33098         }
33099         escape(e3) {
33100           let t2 = this.rules.inline.escape.exec(e3);
33101           if (t2) return { type: "escape", raw: t2[0], text: t2[1] };
33102         }
33103         tag(e3) {
33104           let t2 = this.rules.inline.tag.exec(e3);
33105           if (t2) return !this.lexer.state.inLink && this.rules.other.startATag.test(t2[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t2[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t2[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t2[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t2[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t2[0] };
33106         }
33107         link(e3) {
33108           let t2 = this.rules.inline.link.exec(e3);
33109           if (t2) {
33110             let n3 = t2[2].trim();
33111             if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n3)) {
33112               if (!this.rules.other.endAngleBracket.test(n3)) return;
33113               let r2 = A(n3.slice(0, -1), "\\");
33114               if ((n3.length - r2.length) % 2 === 0) return;
33115             } else {
33116               let r2 = fe(t2[2], "()");
33117               if (r2 === -2) return;
33118               if (r2 > -1) {
33119                 let l2 = (t2[0].indexOf("!") === 0 ? 5 : 4) + t2[1].length + r2;
33120                 t2[2] = t2[2].substring(0, r2), t2[0] = t2[0].substring(0, l2).trim(), t2[3] = "";
33121               }
33122             }
33123             let s2 = t2[2], i3 = "";
33124             if (this.options.pedantic) {
33125               let r2 = this.rules.other.pedanticHrefTitle.exec(s2);
33126               r2 && (s2 = r2[1], i3 = r2[3]);
33127             } else i3 = t2[3] ? t2[3].slice(1, -1) : "";
33128             return s2 = s2.trim(), this.rules.other.startAngleBracket.test(s2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n3) ? s2 = s2.slice(1) : s2 = s2.slice(1, -1)), de(t2, { href: s2 && s2.replace(this.rules.inline.anyPunctuation, "$1"), title: i3 && i3.replace(this.rules.inline.anyPunctuation, "$1") }, t2[0], this.lexer, this.rules);
33129           }
33130         }
33131         reflink(e3, t2) {
33132           let n3;
33133           if ((n3 = this.rules.inline.reflink.exec(e3)) || (n3 = this.rules.inline.nolink.exec(e3))) {
33134             let s2 = (n3[2] || n3[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i3 = t2[s2.toLowerCase()];
33135             if (!i3) {
33136               let r2 = n3[0].charAt(0);
33137               return { type: "text", raw: r2, text: r2 };
33138             }
33139             return de(n3, i3, n3[0], this.lexer, this.rules);
33140           }
33141         }
33142         emStrong(e3, t2, n3 = "") {
33143           let s2 = this.rules.inline.emStrongLDelim.exec(e3);
33144           if (!s2 || s2[3] && n3.match(this.rules.other.unicodeAlphaNumeric)) return;
33145           if (!(s2[1] || s2[2] || "") || !n3 || this.rules.inline.punctuation.exec(n3)) {
33146             let r2 = [...s2[0]].length - 1, o2, l2, c2 = r2, p2 = 0, u2 = s2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
33147             for (u2.lastIndex = 0, t2 = t2.slice(-1 * e3.length + r2); (s2 = u2.exec(t2)) != null; ) {
33148               if (o2 = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o2) continue;
33149               if (l2 = [...o2].length, s2[3] || s2[4]) {
33150                 c2 += l2;
33151                 continue;
33152               } else if ((s2[5] || s2[6]) && r2 % 3 && !((r2 + l2) % 3)) {
33153                 p2 += l2;
33154                 continue;
33155               }
33156               if (c2 -= l2, c2 > 0) continue;
33157               l2 = Math.min(l2, l2 + c2 + p2);
33158               let d2 = [...s2[0]][0].length, g3 = e3.slice(0, r2 + s2.index + d2 + l2);
33159               if (Math.min(r2, l2) % 2) {
33160                 let f2 = g3.slice(1, -1);
33161                 return { type: "em", raw: g3, text: f2, tokens: this.lexer.inlineTokens(f2) };
33162               }
33163               let x2 = g3.slice(2, -2);
33164               return { type: "strong", raw: g3, text: x2, tokens: this.lexer.inlineTokens(x2) };
33165             }
33166           }
33167         }
33168         codespan(e3) {
33169           let t2 = this.rules.inline.code.exec(e3);
33170           if (t2) {
33171             let n3 = t2[2].replace(this.rules.other.newLineCharGlobal, " "), s2 = this.rules.other.nonSpaceChar.test(n3), i3 = this.rules.other.startingSpaceChar.test(n3) && this.rules.other.endingSpaceChar.test(n3);
33172             return s2 && i3 && (n3 = n3.substring(1, n3.length - 1)), { type: "codespan", raw: t2[0], text: n3 };
33173           }
33174         }
33175         br(e3) {
33176           let t2 = this.rules.inline.br.exec(e3);
33177           if (t2) return { type: "br", raw: t2[0] };
33178         }
33179         del(e3) {
33180           let t2 = this.rules.inline.del.exec(e3);
33181           if (t2) return { type: "del", raw: t2[0], text: t2[2], tokens: this.lexer.inlineTokens(t2[2]) };
33182         }
33183         autolink(e3) {
33184           let t2 = this.rules.inline.autolink.exec(e3);
33185           if (t2) {
33186             let n3, s2;
33187             return t2[2] === "@" ? (n3 = t2[1], s2 = "mailto:" + n3) : (n3 = t2[1], s2 = n3), { type: "link", raw: t2[0], text: n3, href: s2, tokens: [{ type: "text", raw: n3, text: n3 }] };
33188           }
33189         }
33190         url(e3) {
33191           var _a4, _b2;
33192           let t2;
33193           if (t2 = this.rules.inline.url.exec(e3)) {
33194             let n3, s2;
33195             if (t2[2] === "@") n3 = t2[0], s2 = "mailto:" + n3;
33196             else {
33197               let i3;
33198               do
33199                 i3 = t2[0], t2[0] = (_b2 = (_a4 = this.rules.inline._backpedal.exec(t2[0])) == null ? void 0 : _a4[0]) != null ? _b2 : "";
33200               while (i3 !== t2[0]);
33201               n3 = t2[0], t2[1] === "www." ? s2 = "http://" + t2[0] : s2 = t2[0];
33202             }
33203             return { type: "link", raw: t2[0], text: n3, href: s2, tokens: [{ type: "text", raw: n3, text: n3 }] };
33204           }
33205         }
33206         inlineText(e3) {
33207           let t2 = this.rules.inline.text.exec(e3);
33208           if (t2) {
33209             let n3 = this.lexer.state.inRawBlock;
33210             return { type: "text", raw: t2[0], text: t2[0], escaped: n3 };
33211           }
33212         }
33213       };
33214       b = class a {
33215         constructor(e3) {
33216           __publicField(this, "tokens");
33217           __publicField(this, "options");
33218           __publicField(this, "state");
33219           __publicField(this, "tokenizer");
33220           __publicField(this, "inlineQueue");
33221           this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e3 || w, this.options.tokenizer = this.options.tokenizer || new S(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
33222           let t2 = { other: m, block: O.normal, inline: P.normal };
33223           this.options.pedantic ? (t2.block = O.pedantic, t2.inline = P.pedantic) : this.options.gfm && (t2.block = O.gfm, this.options.breaks ? t2.inline = P.breaks : t2.inline = P.gfm), this.tokenizer.rules = t2;
33224         }
33225         static get rules() {
33226           return { block: O, inline: P };
33227         }
33228         static lex(e3, t2) {
33229           return new a(t2).lex(e3);
33230         }
33231         static lexInline(e3, t2) {
33232           return new a(t2).inlineTokens(e3);
33233         }
33234         lex(e3) {
33235           e3 = e3.replace(m.carriageReturn, `
33236 `), this.blockTokens(e3, this.tokens);
33237           for (let t2 = 0; t2 < this.inlineQueue.length; t2++) {
33238             let n3 = this.inlineQueue[t2];
33239             this.inlineTokens(n3.src, n3.tokens);
33240           }
33241           return this.inlineQueue = [], this.tokens;
33242         }
33243         blockTokens(e3, t2 = [], n3 = false) {
33244           var _a4, _b2, _c;
33245           for (this.options.pedantic && (e3 = e3.replace(m.tabCharGlobal, "    ").replace(m.spaceLine, "")); e3; ) {
33246             let s2;
33247             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.block) == null ? void 0 : _b2.some((r2) => (s2 = r2.call({ lexer: this }, e3, t2)) ? (e3 = e3.substring(s2.raw.length), t2.push(s2), true) : false)) continue;
33248             if (s2 = this.tokenizer.space(e3)) {
33249               e3 = e3.substring(s2.raw.length);
33250               let r2 = t2.at(-1);
33251               s2.raw.length === 1 && r2 !== void 0 ? r2.raw += `
33252 ` : t2.push(s2);
33253               continue;
33254             }
33255             if (s2 = this.tokenizer.code(e3)) {
33256               e3 = e3.substring(s2.raw.length);
33257               let r2 = t2.at(-1);
33258               (r2 == null ? void 0 : r2.type) === "paragraph" || (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33259 ` + s2.raw, r2.text += `
33260 ` + s2.text, this.inlineQueue.at(-1).src = r2.text) : t2.push(s2);
33261               continue;
33262             }
33263             if (s2 = this.tokenizer.fences(e3)) {
33264               e3 = e3.substring(s2.raw.length), t2.push(s2);
33265               continue;
33266             }
33267             if (s2 = this.tokenizer.heading(e3)) {
33268               e3 = e3.substring(s2.raw.length), t2.push(s2);
33269               continue;
33270             }
33271             if (s2 = this.tokenizer.hr(e3)) {
33272               e3 = e3.substring(s2.raw.length), t2.push(s2);
33273               continue;
33274             }
33275             if (s2 = this.tokenizer.blockquote(e3)) {
33276               e3 = e3.substring(s2.raw.length), t2.push(s2);
33277               continue;
33278             }
33279             if (s2 = this.tokenizer.list(e3)) {
33280               e3 = e3.substring(s2.raw.length), t2.push(s2);
33281               continue;
33282             }
33283             if (s2 = this.tokenizer.html(e3)) {
33284               e3 = e3.substring(s2.raw.length), t2.push(s2);
33285               continue;
33286             }
33287             if (s2 = this.tokenizer.def(e3)) {
33288               e3 = e3.substring(s2.raw.length);
33289               let r2 = t2.at(-1);
33290               (r2 == null ? void 0 : r2.type) === "paragraph" || (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33291 ` + s2.raw, r2.text += `
33292 ` + s2.raw, this.inlineQueue.at(-1).src = r2.text) : this.tokens.links[s2.tag] || (this.tokens.links[s2.tag] = { href: s2.href, title: s2.title });
33293               continue;
33294             }
33295             if (s2 = this.tokenizer.table(e3)) {
33296               e3 = e3.substring(s2.raw.length), t2.push(s2);
33297               continue;
33298             }
33299             if (s2 = this.tokenizer.lheading(e3)) {
33300               e3 = e3.substring(s2.raw.length), t2.push(s2);
33301               continue;
33302             }
33303             let i3 = e3;
33304             if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
33305               let r2 = 1 / 0, o2 = e3.slice(1), l2;
33306               this.options.extensions.startBlock.forEach((c2) => {
33307                 l2 = c2.call({ lexer: this }, o2), typeof l2 == "number" && l2 >= 0 && (r2 = Math.min(r2, l2));
33308               }), r2 < 1 / 0 && r2 >= 0 && (i3 = e3.substring(0, r2 + 1));
33309             }
33310             if (this.state.top && (s2 = this.tokenizer.paragraph(i3))) {
33311               let r2 = t2.at(-1);
33312               n3 && (r2 == null ? void 0 : r2.type) === "paragraph" ? (r2.raw += `
33313 ` + s2.raw, r2.text += `
33314 ` + s2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r2.text) : t2.push(s2), n3 = i3.length !== e3.length, e3 = e3.substring(s2.raw.length);
33315               continue;
33316             }
33317             if (s2 = this.tokenizer.text(e3)) {
33318               e3 = e3.substring(s2.raw.length);
33319               let r2 = t2.at(-1);
33320               (r2 == null ? void 0 : r2.type) === "text" ? (r2.raw += `
33321 ` + s2.raw, r2.text += `
33322 ` + s2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r2.text) : t2.push(s2);
33323               continue;
33324             }
33325             if (e3) {
33326               let r2 = "Infinite loop on byte: " + e3.charCodeAt(0);
33327               if (this.options.silent) {
33328                 console.error(r2);
33329                 break;
33330               } else throw new Error(r2);
33331             }
33332           }
33333           return this.state.top = true, t2;
33334         }
33335         inline(e3, t2 = []) {
33336           return this.inlineQueue.push({ src: e3, tokens: t2 }), t2;
33337         }
33338         inlineTokens(e3, t2 = []) {
33339           var _a4, _b2, _c;
33340           let n3 = e3, s2 = null;
33341           if (this.tokens.links) {
33342             let o2 = Object.keys(this.tokens.links);
33343             if (o2.length > 0) for (; (s2 = this.tokenizer.rules.inline.reflinkSearch.exec(n3)) != null; ) o2.includes(s2[0].slice(s2[0].lastIndexOf("[") + 1, -1)) && (n3 = n3.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n3.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
33344           }
33345           for (; (s2 = this.tokenizer.rules.inline.anyPunctuation.exec(n3)) != null; ) n3 = n3.slice(0, s2.index) + "++" + n3.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
33346           for (; (s2 = this.tokenizer.rules.inline.blockSkip.exec(n3)) != null; ) n3 = n3.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n3.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
33347           let i3 = false, r2 = "";
33348           for (; e3; ) {
33349             i3 || (r2 = ""), i3 = false;
33350             let o2;
33351             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.inline) == null ? void 0 : _b2.some((c2) => (o2 = c2.call({ lexer: this }, e3, t2)) ? (e3 = e3.substring(o2.raw.length), t2.push(o2), true) : false)) continue;
33352             if (o2 = this.tokenizer.escape(e3)) {
33353               e3 = e3.substring(o2.raw.length), t2.push(o2);
33354               continue;
33355             }
33356             if (o2 = this.tokenizer.tag(e3)) {
33357               e3 = e3.substring(o2.raw.length), t2.push(o2);
33358               continue;
33359             }
33360             if (o2 = this.tokenizer.link(e3)) {
33361               e3 = e3.substring(o2.raw.length), t2.push(o2);
33362               continue;
33363             }
33364             if (o2 = this.tokenizer.reflink(e3, this.tokens.links)) {
33365               e3 = e3.substring(o2.raw.length);
33366               let c2 = t2.at(-1);
33367               o2.type === "text" && (c2 == null ? void 0 : c2.type) === "text" ? (c2.raw += o2.raw, c2.text += o2.text) : t2.push(o2);
33368               continue;
33369             }
33370             if (o2 = this.tokenizer.emStrong(e3, n3, r2)) {
33371               e3 = e3.substring(o2.raw.length), t2.push(o2);
33372               continue;
33373             }
33374             if (o2 = this.tokenizer.codespan(e3)) {
33375               e3 = e3.substring(o2.raw.length), t2.push(o2);
33376               continue;
33377             }
33378             if (o2 = this.tokenizer.br(e3)) {
33379               e3 = e3.substring(o2.raw.length), t2.push(o2);
33380               continue;
33381             }
33382             if (o2 = this.tokenizer.del(e3)) {
33383               e3 = e3.substring(o2.raw.length), t2.push(o2);
33384               continue;
33385             }
33386             if (o2 = this.tokenizer.autolink(e3)) {
33387               e3 = e3.substring(o2.raw.length), t2.push(o2);
33388               continue;
33389             }
33390             if (!this.state.inLink && (o2 = this.tokenizer.url(e3))) {
33391               e3 = e3.substring(o2.raw.length), t2.push(o2);
33392               continue;
33393             }
33394             let l2 = e3;
33395             if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) {
33396               let c2 = 1 / 0, p2 = e3.slice(1), u2;
33397               this.options.extensions.startInline.forEach((d2) => {
33398                 u2 = d2.call({ lexer: this }, p2), typeof u2 == "number" && u2 >= 0 && (c2 = Math.min(c2, u2));
33399               }), c2 < 1 / 0 && c2 >= 0 && (l2 = e3.substring(0, c2 + 1));
33400             }
33401             if (o2 = this.tokenizer.inlineText(l2)) {
33402               e3 = e3.substring(o2.raw.length), o2.raw.slice(-1) !== "_" && (r2 = o2.raw.slice(-1)), i3 = true;
33403               let c2 = t2.at(-1);
33404               (c2 == null ? void 0 : c2.type) === "text" ? (c2.raw += o2.raw, c2.text += o2.text) : t2.push(o2);
33405               continue;
33406             }
33407             if (e3) {
33408               let c2 = "Infinite loop on byte: " + e3.charCodeAt(0);
33409               if (this.options.silent) {
33410                 console.error(c2);
33411                 break;
33412               } else throw new Error(c2);
33413             }
33414           }
33415           return t2;
33416         }
33417       };
33418       $ = class {
33419         constructor(e3) {
33420           __publicField(this, "options");
33421           __publicField(this, "parser");
33422           this.options = e3 || w;
33423         }
33424         space(e3) {
33425           return "";
33426         }
33427         code({ text: e3, lang: t2, escaped: n3 }) {
33428           var _a4;
33429           let s2 = (_a4 = (t2 || "").match(m.notSpaceStart)) == null ? void 0 : _a4[0], i3 = e3.replace(m.endingNewline, "") + `
33430 `;
33431           return s2 ? '<pre><code class="language-' + R(s2) + '">' + (n3 ? i3 : R(i3, true)) + `</code></pre>
33432 ` : "<pre><code>" + (n3 ? i3 : R(i3, true)) + `</code></pre>
33433 `;
33434         }
33435         blockquote({ tokens: e3 }) {
33436           return `<blockquote>
33437 ${this.parser.parse(e3)}</blockquote>
33438 `;
33439         }
33440         html({ text: e3 }) {
33441           return e3;
33442         }
33443         heading({ tokens: e3, depth: t2 }) {
33444           return `<h${t2}>${this.parser.parseInline(e3)}</h${t2}>
33445 `;
33446         }
33447         hr(e3) {
33448           return `<hr>
33449 `;
33450         }
33451         list(e3) {
33452           let t2 = e3.ordered, n3 = e3.start, s2 = "";
33453           for (let o2 = 0; o2 < e3.items.length; o2++) {
33454             let l2 = e3.items[o2];
33455             s2 += this.listitem(l2);
33456           }
33457           let i3 = t2 ? "ol" : "ul", r2 = t2 && n3 !== 1 ? ' start="' + n3 + '"' : "";
33458           return "<" + i3 + r2 + `>
33459 ` + s2 + "</" + i3 + `>
33460 `;
33461         }
33462         listitem(e3) {
33463           var _a4;
33464           let t2 = "";
33465           if (e3.task) {
33466             let n3 = this.checkbox({ checked: !!e3.checked });
33467             e3.loose ? ((_a4 = e3.tokens[0]) == null ? void 0 : _a4.type) === "paragraph" ? (e3.tokens[0].text = n3 + " " + e3.tokens[0].text, e3.tokens[0].tokens && e3.tokens[0].tokens.length > 0 && e3.tokens[0].tokens[0].type === "text" && (e3.tokens[0].tokens[0].text = n3 + " " + R(e3.tokens[0].tokens[0].text), e3.tokens[0].tokens[0].escaped = true)) : e3.tokens.unshift({ type: "text", raw: n3 + " ", text: n3 + " ", escaped: true }) : t2 += n3 + " ";
33468           }
33469           return t2 += this.parser.parse(e3.tokens, !!e3.loose), `<li>${t2}</li>
33470 `;
33471         }
33472         checkbox({ checked: e3 }) {
33473           return "<input " + (e3 ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
33474         }
33475         paragraph({ tokens: e3 }) {
33476           return `<p>${this.parser.parseInline(e3)}</p>
33477 `;
33478         }
33479         table(e3) {
33480           let t2 = "", n3 = "";
33481           for (let i3 = 0; i3 < e3.header.length; i3++) n3 += this.tablecell(e3.header[i3]);
33482           t2 += this.tablerow({ text: n3 });
33483           let s2 = "";
33484           for (let i3 = 0; i3 < e3.rows.length; i3++) {
33485             let r2 = e3.rows[i3];
33486             n3 = "";
33487             for (let o2 = 0; o2 < r2.length; o2++) n3 += this.tablecell(r2[o2]);
33488             s2 += this.tablerow({ text: n3 });
33489           }
33490           return s2 && (s2 = `<tbody>${s2}</tbody>`), `<table>
33491 <thead>
33492 ` + t2 + `</thead>
33493 ` + s2 + `</table>
33494 `;
33495         }
33496         tablerow({ text: e3 }) {
33497           return `<tr>
33498 ${e3}</tr>
33499 `;
33500         }
33501         tablecell(e3) {
33502           let t2 = this.parser.parseInline(e3.tokens), n3 = e3.header ? "th" : "td";
33503           return (e3.align ? `<${n3} align="${e3.align}">` : `<${n3}>`) + t2 + `</${n3}>
33504 `;
33505         }
33506         strong({ tokens: e3 }) {
33507           return `<strong>${this.parser.parseInline(e3)}</strong>`;
33508         }
33509         em({ tokens: e3 }) {
33510           return `<em>${this.parser.parseInline(e3)}</em>`;
33511         }
33512         codespan({ text: e3 }) {
33513           return `<code>${R(e3, true)}</code>`;
33514         }
33515         br(e3) {
33516           return "<br>";
33517         }
33518         del({ tokens: e3 }) {
33519           return `<del>${this.parser.parseInline(e3)}</del>`;
33520         }
33521         link({ href: e3, title: t2, tokens: n3 }) {
33522           let s2 = this.parser.parseInline(n3), i3 = J(e3);
33523           if (i3 === null) return s2;
33524           e3 = i3;
33525           let r2 = '<a href="' + e3 + '"';
33526           return t2 && (r2 += ' title="' + R(t2) + '"'), r2 += ">" + s2 + "</a>", r2;
33527         }
33528         image({ href: e3, title: t2, text: n3, tokens: s2 }) {
33529           s2 && (n3 = this.parser.parseInline(s2, this.parser.textRenderer));
33530           let i3 = J(e3);
33531           if (i3 === null) return R(n3);
33532           e3 = i3;
33533           let r2 = `<img src="${e3}" alt="${n3}"`;
33534           return t2 && (r2 += ` title="${R(t2)}"`), r2 += ">", r2;
33535         }
33536         text(e3) {
33537           return "tokens" in e3 && e3.tokens ? this.parser.parseInline(e3.tokens) : "escaped" in e3 && e3.escaped ? e3.text : R(e3.text);
33538         }
33539       };
33540       _ = class {
33541         strong({ text: e3 }) {
33542           return e3;
33543         }
33544         em({ text: e3 }) {
33545           return e3;
33546         }
33547         codespan({ text: e3 }) {
33548           return e3;
33549         }
33550         del({ text: e3 }) {
33551           return e3;
33552         }
33553         html({ text: e3 }) {
33554           return e3;
33555         }
33556         text({ text: e3 }) {
33557           return e3;
33558         }
33559         link({ text: e3 }) {
33560           return "" + e3;
33561         }
33562         image({ text: e3 }) {
33563           return "" + e3;
33564         }
33565         br() {
33566           return "";
33567         }
33568       };
33569       T = class a2 {
33570         constructor(e3) {
33571           __publicField(this, "options");
33572           __publicField(this, "renderer");
33573           __publicField(this, "textRenderer");
33574           this.options = e3 || w, this.options.renderer = this.options.renderer || new $(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new _();
33575         }
33576         static parse(e3, t2) {
33577           return new a2(t2).parse(e3);
33578         }
33579         static parseInline(e3, t2) {
33580           return new a2(t2).parseInline(e3);
33581         }
33582         parse(e3, t2 = true) {
33583           var _a4, _b2;
33584           let n3 = "";
33585           for (let s2 = 0; s2 < e3.length; s2++) {
33586             let i3 = e3[s2];
33587             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.renderers) == null ? void 0 : _b2[i3.type]) {
33588               let o2 = i3, l2 = this.options.extensions.renderers[o2.type].call({ parser: this }, o2);
33589               if (l2 !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o2.type)) {
33590                 n3 += l2 || "";
33591                 continue;
33592               }
33593             }
33594             let r2 = i3;
33595             switch (r2.type) {
33596               case "space": {
33597                 n3 += this.renderer.space(r2);
33598                 continue;
33599               }
33600               case "hr": {
33601                 n3 += this.renderer.hr(r2);
33602                 continue;
33603               }
33604               case "heading": {
33605                 n3 += this.renderer.heading(r2);
33606                 continue;
33607               }
33608               case "code": {
33609                 n3 += this.renderer.code(r2);
33610                 continue;
33611               }
33612               case "table": {
33613                 n3 += this.renderer.table(r2);
33614                 continue;
33615               }
33616               case "blockquote": {
33617                 n3 += this.renderer.blockquote(r2);
33618                 continue;
33619               }
33620               case "list": {
33621                 n3 += this.renderer.list(r2);
33622                 continue;
33623               }
33624               case "html": {
33625                 n3 += this.renderer.html(r2);
33626                 continue;
33627               }
33628               case "paragraph": {
33629                 n3 += this.renderer.paragraph(r2);
33630                 continue;
33631               }
33632               case "text": {
33633                 let o2 = r2, l2 = this.renderer.text(o2);
33634                 for (; s2 + 1 < e3.length && e3[s2 + 1].type === "text"; ) o2 = e3[++s2], l2 += `
33635 ` + this.renderer.text(o2);
33636                 t2 ? n3 += this.renderer.paragraph({ type: "paragraph", raw: l2, text: l2, tokens: [{ type: "text", raw: l2, text: l2, escaped: true }] }) : n3 += l2;
33637                 continue;
33638               }
33639               default: {
33640                 let o2 = 'Token with "' + r2.type + '" type was not found.';
33641                 if (this.options.silent) return console.error(o2), "";
33642                 throw new Error(o2);
33643               }
33644             }
33645           }
33646           return n3;
33647         }
33648         parseInline(e3, t2 = this.renderer) {
33649           var _a4, _b2;
33650           let n3 = "";
33651           for (let s2 = 0; s2 < e3.length; s2++) {
33652             let i3 = e3[s2];
33653             if ((_b2 = (_a4 = this.options.extensions) == null ? void 0 : _a4.renderers) == null ? void 0 : _b2[i3.type]) {
33654               let o2 = this.options.extensions.renderers[i3.type].call({ parser: this }, i3);
33655               if (o2 !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i3.type)) {
33656                 n3 += o2 || "";
33657                 continue;
33658               }
33659             }
33660             let r2 = i3;
33661             switch (r2.type) {
33662               case "escape": {
33663                 n3 += t2.text(r2);
33664                 break;
33665               }
33666               case "html": {
33667                 n3 += t2.html(r2);
33668                 break;
33669               }
33670               case "link": {
33671                 n3 += t2.link(r2);
33672                 break;
33673               }
33674               case "image": {
33675                 n3 += t2.image(r2);
33676                 break;
33677               }
33678               case "strong": {
33679                 n3 += t2.strong(r2);
33680                 break;
33681               }
33682               case "em": {
33683                 n3 += t2.em(r2);
33684                 break;
33685               }
33686               case "codespan": {
33687                 n3 += t2.codespan(r2);
33688                 break;
33689               }
33690               case "br": {
33691                 n3 += t2.br(r2);
33692                 break;
33693               }
33694               case "del": {
33695                 n3 += t2.del(r2);
33696                 break;
33697               }
33698               case "text": {
33699                 n3 += t2.text(r2);
33700                 break;
33701               }
33702               default: {
33703                 let o2 = 'Token with "' + r2.type + '" type was not found.';
33704                 if (this.options.silent) return console.error(o2), "";
33705                 throw new Error(o2);
33706               }
33707             }
33708           }
33709           return n3;
33710         }
33711       };
33712       L = (_a2 = class {
33713         constructor(e3) {
33714           __publicField(this, "options");
33715           __publicField(this, "block");
33716           this.options = e3 || w;
33717         }
33718         preprocess(e3) {
33719           return e3;
33720         }
33721         postprocess(e3) {
33722           return e3;
33723         }
33724         processAllTokens(e3) {
33725           return e3;
33726         }
33727         provideLexer() {
33728           return this.block ? b.lex : b.lexInline;
33729         }
33730         provideParser() {
33731           return this.block ? T.parse : T.parseInline;
33732         }
33733       }, __publicField(_a2, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a2);
33734       B = class {
33735         constructor(...e3) {
33736           __publicField(this, "defaults", M());
33737           __publicField(this, "options", this.setOptions);
33738           __publicField(this, "parse", this.parseMarkdown(true));
33739           __publicField(this, "parseInline", this.parseMarkdown(false));
33740           __publicField(this, "Parser", T);
33741           __publicField(this, "Renderer", $);
33742           __publicField(this, "TextRenderer", _);
33743           __publicField(this, "Lexer", b);
33744           __publicField(this, "Tokenizer", S);
33745           __publicField(this, "Hooks", L);
33746           this.use(...e3);
33747         }
33748         walkTokens(e3, t2) {
33749           var _a4, _b2;
33750           let n3 = [];
33751           for (let s2 of e3) switch (n3 = n3.concat(t2.call(this, s2)), s2.type) {
33752             case "table": {
33753               let i3 = s2;
33754               for (let r2 of i3.header) n3 = n3.concat(this.walkTokens(r2.tokens, t2));
33755               for (let r2 of i3.rows) for (let o2 of r2) n3 = n3.concat(this.walkTokens(o2.tokens, t2));
33756               break;
33757             }
33758             case "list": {
33759               let i3 = s2;
33760               n3 = n3.concat(this.walkTokens(i3.items, t2));
33761               break;
33762             }
33763             default: {
33764               let i3 = s2;
33765               ((_b2 = (_a4 = this.defaults.extensions) == null ? void 0 : _a4.childTokens) == null ? void 0 : _b2[i3.type]) ? this.defaults.extensions.childTokens[i3.type].forEach((r2) => {
33766                 let o2 = i3[r2].flat(1 / 0);
33767                 n3 = n3.concat(this.walkTokens(o2, t2));
33768               }) : i3.tokens && (n3 = n3.concat(this.walkTokens(i3.tokens, t2)));
33769             }
33770           }
33771           return n3;
33772         }
33773         use(...e3) {
33774           let t2 = this.defaults.extensions || { renderers: {}, childTokens: {} };
33775           return e3.forEach((n3) => {
33776             let s2 = { ...n3 };
33777             if (s2.async = this.defaults.async || s2.async || false, n3.extensions && (n3.extensions.forEach((i3) => {
33778               if (!i3.name) throw new Error("extension name required");
33779               if ("renderer" in i3) {
33780                 let r2 = t2.renderers[i3.name];
33781                 r2 ? t2.renderers[i3.name] = function(...o2) {
33782                   let l2 = i3.renderer.apply(this, o2);
33783                   return l2 === false && (l2 = r2.apply(this, o2)), l2;
33784                 } : t2.renderers[i3.name] = i3.renderer;
33785               }
33786               if ("tokenizer" in i3) {
33787                 if (!i3.level || i3.level !== "block" && i3.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
33788                 let r2 = t2[i3.level];
33789                 r2 ? r2.unshift(i3.tokenizer) : t2[i3.level] = [i3.tokenizer], i3.start && (i3.level === "block" ? t2.startBlock ? t2.startBlock.push(i3.start) : t2.startBlock = [i3.start] : i3.level === "inline" && (t2.startInline ? t2.startInline.push(i3.start) : t2.startInline = [i3.start]));
33790               }
33791               "childTokens" in i3 && i3.childTokens && (t2.childTokens[i3.name] = i3.childTokens);
33792             }), s2.extensions = t2), n3.renderer) {
33793               let i3 = this.defaults.renderer || new $(this.defaults);
33794               for (let r2 in n3.renderer) {
33795                 if (!(r2 in i3)) throw new Error(`renderer '${r2}' does not exist`);
33796                 if (["options", "parser"].includes(r2)) continue;
33797                 let o2 = r2, l2 = n3.renderer[o2], c2 = i3[o2];
33798                 i3[o2] = (...p2) => {
33799                   let u2 = l2.apply(i3, p2);
33800                   return u2 === false && (u2 = c2.apply(i3, p2)), u2 || "";
33801                 };
33802               }
33803               s2.renderer = i3;
33804             }
33805             if (n3.tokenizer) {
33806               let i3 = this.defaults.tokenizer || new S(this.defaults);
33807               for (let r2 in n3.tokenizer) {
33808                 if (!(r2 in i3)) throw new Error(`tokenizer '${r2}' does not exist`);
33809                 if (["options", "rules", "lexer"].includes(r2)) continue;
33810                 let o2 = r2, l2 = n3.tokenizer[o2], c2 = i3[o2];
33811                 i3[o2] = (...p2) => {
33812                   let u2 = l2.apply(i3, p2);
33813                   return u2 === false && (u2 = c2.apply(i3, p2)), u2;
33814                 };
33815               }
33816               s2.tokenizer = i3;
33817             }
33818             if (n3.hooks) {
33819               let i3 = this.defaults.hooks || new L();
33820               for (let r2 in n3.hooks) {
33821                 if (!(r2 in i3)) throw new Error(`hook '${r2}' does not exist`);
33822                 if (["options", "block"].includes(r2)) continue;
33823                 let o2 = r2, l2 = n3.hooks[o2], c2 = i3[o2];
33824                 L.passThroughHooks.has(r2) ? i3[o2] = (p2) => {
33825                   if (this.defaults.async) return Promise.resolve(l2.call(i3, p2)).then((d2) => c2.call(i3, d2));
33826                   let u2 = l2.call(i3, p2);
33827                   return c2.call(i3, u2);
33828                 } : i3[o2] = (...p2) => {
33829                   let u2 = l2.apply(i3, p2);
33830                   return u2 === false && (u2 = c2.apply(i3, p2)), u2;
33831                 };
33832               }
33833               s2.hooks = i3;
33834             }
33835             if (n3.walkTokens) {
33836               let i3 = this.defaults.walkTokens, r2 = n3.walkTokens;
33837               s2.walkTokens = function(o2) {
33838                 let l2 = [];
33839                 return l2.push(r2.call(this, o2)), i3 && (l2 = l2.concat(i3.call(this, o2))), l2;
33840               };
33841             }
33842             this.defaults = { ...this.defaults, ...s2 };
33843           }), this;
33844         }
33845         setOptions(e3) {
33846           return this.defaults = { ...this.defaults, ...e3 }, this;
33847         }
33848         lexer(e3, t2) {
33849           return b.lex(e3, t2 != null ? t2 : this.defaults);
33850         }
33851         parser(e3, t2) {
33852           return T.parse(e3, t2 != null ? t2 : this.defaults);
33853         }
33854         parseMarkdown(e3) {
33855           return (n3, s2) => {
33856             let i3 = { ...s2 }, r2 = { ...this.defaults, ...i3 }, o2 = this.onError(!!r2.silent, !!r2.async);
33857             if (this.defaults.async === true && i3.async === false) return o2(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
33858             if (typeof n3 > "u" || n3 === null) return o2(new Error("marked(): input parameter is undefined or null"));
33859             if (typeof n3 != "string") return o2(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n3) + ", string expected"));
33860             r2.hooks && (r2.hooks.options = r2, r2.hooks.block = e3);
33861             let l2 = r2.hooks ? r2.hooks.provideLexer() : e3 ? b.lex : b.lexInline, c2 = r2.hooks ? r2.hooks.provideParser() : e3 ? T.parse : T.parseInline;
33862             if (r2.async) return Promise.resolve(r2.hooks ? r2.hooks.preprocess(n3) : n3).then((p2) => l2(p2, r2)).then((p2) => r2.hooks ? r2.hooks.processAllTokens(p2) : p2).then((p2) => r2.walkTokens ? Promise.all(this.walkTokens(p2, r2.walkTokens)).then(() => p2) : p2).then((p2) => c2(p2, r2)).then((p2) => r2.hooks ? r2.hooks.postprocess(p2) : p2).catch(o2);
33863             try {
33864               r2.hooks && (n3 = r2.hooks.preprocess(n3));
33865               let p2 = l2(n3, r2);
33866               r2.hooks && (p2 = r2.hooks.processAllTokens(p2)), r2.walkTokens && this.walkTokens(p2, r2.walkTokens);
33867               let u2 = c2(p2, r2);
33868               return r2.hooks && (u2 = r2.hooks.postprocess(u2)), u2;
33869             } catch (p2) {
33870               return o2(p2);
33871             }
33872           };
33873         }
33874         onError(e3, t2) {
33875           return (n3) => {
33876             if (n3.message += `
33877 Please report this to https://github.com/markedjs/marked.`, e3) {
33878               let s2 = "<p>An error occurred:</p><pre>" + R(n3.message + "", true) + "</pre>";
33879               return t2 ? Promise.resolve(s2) : s2;
33880             }
33881             if (t2) return Promise.reject(n3);
33882             throw n3;
33883           };
33884         }
33885       };
33886       z = new B();
33887       k.options = k.setOptions = function(a4) {
33888         return z.setOptions(a4), k.defaults = z.defaults, H(k.defaults), k;
33889       };
33890       k.getDefaults = M;
33891       k.defaults = w;
33892       k.use = function(...a4) {
33893         return z.use(...a4), k.defaults = z.defaults, H(k.defaults), k;
33894       };
33895       k.walkTokens = function(a4, e3) {
33896         return z.walkTokens(a4, e3);
33897       };
33898       k.parseInline = z.parseInline;
33899       k.Parser = T;
33900       k.parser = T.parse;
33901       k.Renderer = $;
33902       k.TextRenderer = _;
33903       k.Lexer = b;
33904       k.lexer = b.lex;
33905       k.Tokenizer = S;
33906       k.Hooks = L;
33907       k.parse = k;
33908       Dt = k.options;
33909       Zt = k.setOptions;
33910       Gt = k.use;
33911       Ht = k.walkTokens;
33912       Nt = k.parseInline;
33913       Ft = T.parse;
33914       Qt = b.lex;
33915     }
33916   });
33917
33918   // modules/services/osmose.js
33919   var osmose_exports = {};
33920   __export(osmose_exports, {
33921     default: () => osmose_default
33922   });
33923   function abortRequest2(controller) {
33924     if (controller) {
33925       controller.abort();
33926     }
33927   }
33928   function abortUnwantedRequests2(cache, tiles) {
33929     Object.keys(cache.inflightTile).forEach((k3) => {
33930       let wanted = tiles.find((tile) => k3 === tile.id);
33931       if (!wanted) {
33932         abortRequest2(cache.inflightTile[k3]);
33933         delete cache.inflightTile[k3];
33934       }
33935     });
33936   }
33937   function encodeIssueRtree2(d2) {
33938     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
33939   }
33940   function updateRtree2(item, replace) {
33941     _cache2.rtree.remove(item, (a4, b3) => a4.data.id === b3.data.id);
33942     if (replace) {
33943       _cache2.rtree.insert(item);
33944     }
33945   }
33946   function preventCoincident(loc) {
33947     let coincident = false;
33948     do {
33949       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
33950       loc = geoVecAdd(loc, delta);
33951       let bbox2 = geoExtent(loc).bbox();
33952       coincident = _cache2.rtree.search(bbox2).length;
33953     } while (coincident);
33954     return loc;
33955   }
33956   var tiler2, dispatch3, _tileZoom2, _osmoseUrlRoot, _osmoseData, _cache2, osmose_default;
33957   var init_osmose = __esm({
33958     "modules/services/osmose.js"() {
33959       "use strict";
33960       init_rbush();
33961       init_src4();
33962       init_src18();
33963       init_marked_esm();
33964       init_file_fetcher();
33965       init_localizer();
33966       init_geo2();
33967       init_osm();
33968       init_util();
33969       tiler2 = utilTiler();
33970       dispatch3 = dispatch_default("loaded");
33971       _tileZoom2 = 14;
33972       _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
33973       _osmoseData = { icons: {}, items: [] };
33974       osmose_default = {
33975         title: "osmose",
33976         init() {
33977           _mainFileFetcher.get("qa_data").then((d2) => {
33978             _osmoseData = d2.osmose;
33979             _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
33980           });
33981           if (!_cache2) {
33982             this.reset();
33983           }
33984           this.event = utilRebind(this, dispatch3, "on");
33985         },
33986         reset() {
33987           let _strings = {};
33988           let _colors = {};
33989           if (_cache2) {
33990             Object.values(_cache2.inflightTile).forEach(abortRequest2);
33991             _strings = _cache2.strings;
33992             _colors = _cache2.colors;
33993           }
33994           _cache2 = {
33995             data: {},
33996             loadedTile: {},
33997             inflightTile: {},
33998             inflightPost: {},
33999             closed: {},
34000             rtree: new RBush(),
34001             strings: _strings,
34002             colors: _colors
34003           };
34004         },
34005         loadIssues(projection2) {
34006           let params = {
34007             // Tiles return a maximum # of issues
34008             // So we want to filter our request for only types iD supports
34009             item: _osmoseData.items
34010           };
34011           let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
34012           abortUnwantedRequests2(_cache2, tiles);
34013           tiles.forEach((tile) => {
34014             if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
34015             let [x2, y2, z3] = tile.xyz;
34016             let url = `${_osmoseUrlRoot}/issues/${z3}/${x2}/${y2}.geojson?` + utilQsString(params);
34017             let controller = new AbortController();
34018             _cache2.inflightTile[tile.id] = controller;
34019             json_default(url, { signal: controller.signal }).then((data) => {
34020               delete _cache2.inflightTile[tile.id];
34021               _cache2.loadedTile[tile.id] = true;
34022               if (data.features) {
34023                 data.features.forEach((issue) => {
34024                   const { item, class: cl, uuid: id2 } = issue.properties;
34025                   const itemType = `${item}-${cl}`;
34026                   if (itemType in _osmoseData.icons) {
34027                     let loc = issue.geometry.coordinates;
34028                     loc = preventCoincident(loc);
34029                     let d2 = new QAItem(loc, this, itemType, id2, { item });
34030                     if (item === 8300 || item === 8360) {
34031                       d2.elems = [];
34032                     }
34033                     _cache2.data[d2.id] = d2;
34034                     _cache2.rtree.insert(encodeIssueRtree2(d2));
34035                   }
34036                 });
34037               }
34038               dispatch3.call("loaded");
34039             }).catch(() => {
34040               delete _cache2.inflightTile[tile.id];
34041               _cache2.loadedTile[tile.id] = true;
34042             });
34043           });
34044         },
34045         loadIssueDetail(issue) {
34046           if (issue.elems !== void 0) {
34047             return Promise.resolve(issue);
34048           }
34049           const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
34050           const cacheDetails = (data) => {
34051             issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
34052             issue.detail = data.subtitle ? k(data.subtitle.auto) : "";
34053             this.replaceItem(issue);
34054           };
34055           return json_default(url).then(cacheDetails).then(() => issue);
34056         },
34057         loadStrings(locale3 = _mainLocalizer.localeCode()) {
34058           const items = Object.keys(_osmoseData.icons);
34059           if (locale3 in _cache2.strings && Object.keys(_cache2.strings[locale3]).length === items.length) {
34060             return Promise.resolve(_cache2.strings[locale3]);
34061           }
34062           if (!(locale3 in _cache2.strings)) {
34063             _cache2.strings[locale3] = {};
34064           }
34065           const allRequests = items.map((itemType) => {
34066             if (itemType in _cache2.strings[locale3]) return null;
34067             const cacheData = (data) => {
34068               const [cat = { items: [] }] = data.categories;
34069               const [item2 = { class: [] }] = cat.items;
34070               const [cl2 = null] = item2.class;
34071               if (!cl2) {
34072                 console.log(`Osmose strings request (${itemType}) had unexpected data`);
34073                 return;
34074               }
34075               const { item: itemInt, color: color2 } = item2;
34076               if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
34077                 _cache2.colors[itemInt] = color2;
34078               }
34079               const { title, detail, fix, trap } = cl2;
34080               let issueStrings = {};
34081               if (title) issueStrings.title = title.auto;
34082               if (detail) issueStrings.detail = k(detail.auto);
34083               if (trap) issueStrings.trap = k(trap.auto);
34084               if (fix) issueStrings.fix = k(fix.auto);
34085               _cache2.strings[locale3][itemType] = issueStrings;
34086             };
34087             const [item, cl] = itemType.split("-");
34088             const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale3}`;
34089             return json_default(url).then(cacheData);
34090           }).filter(Boolean);
34091           return Promise.all(allRequests).then(() => _cache2.strings[locale3]);
34092         },
34093         getStrings(itemType, locale3 = _mainLocalizer.localeCode()) {
34094           return locale3 in _cache2.strings ? _cache2.strings[locale3][itemType] : {};
34095         },
34096         getColor(itemType) {
34097           return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
34098         },
34099         postUpdate(issue, callback) {
34100           if (_cache2.inflightPost[issue.id]) {
34101             return callback({ message: "Issue update already inflight", status: -2 }, issue);
34102           }
34103           const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
34104           const controller = new AbortController();
34105           const after = () => {
34106             delete _cache2.inflightPost[issue.id];
34107             this.removeItem(issue);
34108             if (issue.newStatus === "done") {
34109               if (!(issue.item in _cache2.closed)) {
34110                 _cache2.closed[issue.item] = 0;
34111               }
34112               _cache2.closed[issue.item] += 1;
34113             }
34114             if (callback) callback(null, issue);
34115           };
34116           _cache2.inflightPost[issue.id] = controller;
34117           fetch(url, { signal: controller.signal }).then(after).catch((err) => {
34118             delete _cache2.inflightPost[issue.id];
34119             if (callback) callback(err.message);
34120           });
34121         },
34122         // Get all cached QAItems covering the viewport
34123         getItems(projection2) {
34124           const viewport = projection2.clipExtent();
34125           const min3 = [viewport[0][0], viewport[1][1]];
34126           const max3 = [viewport[1][0], viewport[0][1]];
34127           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
34128           return _cache2.rtree.search(bbox2).map((d2) => d2.data);
34129         },
34130         // Get a QAItem from cache
34131         // NOTE: Don't change method name until UI v3 is merged
34132         getError(id2) {
34133           return _cache2.data[id2];
34134         },
34135         // get the name of the icon to display for this item
34136         getIcon(itemType) {
34137           return _osmoseData.icons[itemType];
34138         },
34139         // Replace a single QAItem in the cache
34140         replaceItem(item) {
34141           if (!(item instanceof QAItem) || !item.id) return;
34142           _cache2.data[item.id] = item;
34143           updateRtree2(encodeIssueRtree2(item), true);
34144           return item;
34145         },
34146         // Remove a single QAItem from the cache
34147         removeItem(item) {
34148           if (!(item instanceof QAItem) || !item.id) return;
34149           delete _cache2.data[item.id];
34150           updateRtree2(encodeIssueRtree2(item), false);
34151         },
34152         // Used to populate `closed:osmose:*` changeset tags
34153         getClosedCounts() {
34154           return _cache2.closed;
34155         },
34156         itemURL(item) {
34157           return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
34158         }
34159       };
34160     }
34161   });
34162
34163   // node_modules/pbf/index.js
34164   function readVarintRemainder(l2, s2, p2) {
34165     const buf = p2.buf;
34166     let h3, b3;
34167     b3 = buf[p2.pos++];
34168     h3 = (b3 & 112) >> 4;
34169     if (b3 < 128) return toNum(l2, h3, s2);
34170     b3 = buf[p2.pos++];
34171     h3 |= (b3 & 127) << 3;
34172     if (b3 < 128) return toNum(l2, h3, s2);
34173     b3 = buf[p2.pos++];
34174     h3 |= (b3 & 127) << 10;
34175     if (b3 < 128) return toNum(l2, h3, s2);
34176     b3 = buf[p2.pos++];
34177     h3 |= (b3 & 127) << 17;
34178     if (b3 < 128) return toNum(l2, h3, s2);
34179     b3 = buf[p2.pos++];
34180     h3 |= (b3 & 127) << 24;
34181     if (b3 < 128) return toNum(l2, h3, s2);
34182     b3 = buf[p2.pos++];
34183     h3 |= (b3 & 1) << 31;
34184     if (b3 < 128) return toNum(l2, h3, s2);
34185     throw new Error("Expected varint not more than 10 bytes");
34186   }
34187   function toNum(low, high, isSigned) {
34188     return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
34189   }
34190   function writeBigVarint(val, pbf) {
34191     let low, high;
34192     if (val >= 0) {
34193       low = val % 4294967296 | 0;
34194       high = val / 4294967296 | 0;
34195     } else {
34196       low = ~(-val % 4294967296);
34197       high = ~(-val / 4294967296);
34198       if (low ^ 4294967295) {
34199         low = low + 1 | 0;
34200       } else {
34201         low = 0;
34202         high = high + 1 | 0;
34203       }
34204     }
34205     if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
34206       throw new Error("Given varint doesn't fit into 10 bytes");
34207     }
34208     pbf.realloc(10);
34209     writeBigVarintLow(low, high, pbf);
34210     writeBigVarintHigh(high, pbf);
34211   }
34212   function writeBigVarintLow(low, high, pbf) {
34213     pbf.buf[pbf.pos++] = low & 127 | 128;
34214     low >>>= 7;
34215     pbf.buf[pbf.pos++] = low & 127 | 128;
34216     low >>>= 7;
34217     pbf.buf[pbf.pos++] = low & 127 | 128;
34218     low >>>= 7;
34219     pbf.buf[pbf.pos++] = low & 127 | 128;
34220     low >>>= 7;
34221     pbf.buf[pbf.pos] = low & 127;
34222   }
34223   function writeBigVarintHigh(high, pbf) {
34224     const lsb = (high & 7) << 4;
34225     pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
34226     if (!high) return;
34227     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34228     if (!high) return;
34229     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34230     if (!high) return;
34231     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34232     if (!high) return;
34233     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
34234     if (!high) return;
34235     pbf.buf[pbf.pos++] = high & 127;
34236   }
34237   function makeRoomForExtraLength(startPos, len, pbf) {
34238     const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
34239     pbf.realloc(extraLen);
34240     for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
34241   }
34242   function writePackedVarint(arr, pbf) {
34243     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
34244   }
34245   function writePackedSVarint(arr, pbf) {
34246     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
34247   }
34248   function writePackedFloat(arr, pbf) {
34249     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
34250   }
34251   function writePackedDouble(arr, pbf) {
34252     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
34253   }
34254   function writePackedBoolean(arr, pbf) {
34255     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
34256   }
34257   function writePackedFixed32(arr, pbf) {
34258     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
34259   }
34260   function writePackedSFixed32(arr, pbf) {
34261     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
34262   }
34263   function writePackedFixed64(arr, pbf) {
34264     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
34265   }
34266   function writePackedSFixed64(arr, pbf) {
34267     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
34268   }
34269   function readUtf8(buf, pos, end) {
34270     let str = "";
34271     let i3 = pos;
34272     while (i3 < end) {
34273       const b0 = buf[i3];
34274       let c2 = null;
34275       let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
34276       if (i3 + bytesPerSequence > end) break;
34277       let b1, b22, b3;
34278       if (bytesPerSequence === 1) {
34279         if (b0 < 128) {
34280           c2 = b0;
34281         }
34282       } else if (bytesPerSequence === 2) {
34283         b1 = buf[i3 + 1];
34284         if ((b1 & 192) === 128) {
34285           c2 = (b0 & 31) << 6 | b1 & 63;
34286           if (c2 <= 127) {
34287             c2 = null;
34288           }
34289         }
34290       } else if (bytesPerSequence === 3) {
34291         b1 = buf[i3 + 1];
34292         b22 = buf[i3 + 2];
34293         if ((b1 & 192) === 128 && (b22 & 192) === 128) {
34294           c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b22 & 63;
34295           if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
34296             c2 = null;
34297           }
34298         }
34299       } else if (bytesPerSequence === 4) {
34300         b1 = buf[i3 + 1];
34301         b22 = buf[i3 + 2];
34302         b3 = buf[i3 + 3];
34303         if ((b1 & 192) === 128 && (b22 & 192) === 128 && (b3 & 192) === 128) {
34304           c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b22 & 63) << 6 | b3 & 63;
34305           if (c2 <= 65535 || c2 >= 1114112) {
34306             c2 = null;
34307           }
34308         }
34309       }
34310       if (c2 === null) {
34311         c2 = 65533;
34312         bytesPerSequence = 1;
34313       } else if (c2 > 65535) {
34314         c2 -= 65536;
34315         str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
34316         c2 = 56320 | c2 & 1023;
34317       }
34318       str += String.fromCharCode(c2);
34319       i3 += bytesPerSequence;
34320     }
34321     return str;
34322   }
34323   function writeUtf8(buf, str, pos) {
34324     for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
34325       c2 = str.charCodeAt(i3);
34326       if (c2 > 55295 && c2 < 57344) {
34327         if (lead) {
34328           if (c2 < 56320) {
34329             buf[pos++] = 239;
34330             buf[pos++] = 191;
34331             buf[pos++] = 189;
34332             lead = c2;
34333             continue;
34334           } else {
34335             c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
34336             lead = null;
34337           }
34338         } else {
34339           if (c2 > 56319 || i3 + 1 === str.length) {
34340             buf[pos++] = 239;
34341             buf[pos++] = 191;
34342             buf[pos++] = 189;
34343           } else {
34344             lead = c2;
34345           }
34346           continue;
34347         }
34348       } else if (lead) {
34349         buf[pos++] = 239;
34350         buf[pos++] = 191;
34351         buf[pos++] = 189;
34352         lead = null;
34353       }
34354       if (c2 < 128) {
34355         buf[pos++] = c2;
34356       } else {
34357         if (c2 < 2048) {
34358           buf[pos++] = c2 >> 6 | 192;
34359         } else {
34360           if (c2 < 65536) {
34361             buf[pos++] = c2 >> 12 | 224;
34362           } else {
34363             buf[pos++] = c2 >> 18 | 240;
34364             buf[pos++] = c2 >> 12 & 63 | 128;
34365           }
34366           buf[pos++] = c2 >> 6 & 63 | 128;
34367         }
34368         buf[pos++] = c2 & 63 | 128;
34369       }
34370     }
34371     return pos;
34372   }
34373   var SHIFT_LEFT_32, SHIFT_RIGHT_32, TEXT_DECODER_MIN_LENGTH, utf8TextDecoder, PBF_VARINT, PBF_FIXED64, PBF_BYTES, PBF_FIXED32, Pbf;
34374   var init_pbf = __esm({
34375     "node_modules/pbf/index.js"() {
34376       SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
34377       SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
34378       TEXT_DECODER_MIN_LENGTH = 12;
34379       utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
34380       PBF_VARINT = 0;
34381       PBF_FIXED64 = 1;
34382       PBF_BYTES = 2;
34383       PBF_FIXED32 = 5;
34384       Pbf = class {
34385         /**
34386          * @param {Uint8Array | ArrayBuffer} [buf]
34387          */
34388         constructor(buf = new Uint8Array(16)) {
34389           this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
34390           this.dataView = new DataView(this.buf.buffer);
34391           this.pos = 0;
34392           this.type = 0;
34393           this.length = this.buf.length;
34394         }
34395         // === READING =================================================================
34396         /**
34397          * @template T
34398          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
34399          * @param {T} result
34400          * @param {number} [end]
34401          */
34402         readFields(readField, result, end = this.length) {
34403           while (this.pos < end) {
34404             const val = this.readVarint(), tag = val >> 3, startPos = this.pos;
34405             this.type = val & 7;
34406             readField(tag, result, this);
34407             if (this.pos === startPos) this.skip(val);
34408           }
34409           return result;
34410         }
34411         /**
34412          * @template T
34413          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
34414          * @param {T} result
34415          */
34416         readMessage(readField, result) {
34417           return this.readFields(readField, result, this.readVarint() + this.pos);
34418         }
34419         readFixed32() {
34420           const val = this.dataView.getUint32(this.pos, true);
34421           this.pos += 4;
34422           return val;
34423         }
34424         readSFixed32() {
34425           const val = this.dataView.getInt32(this.pos, true);
34426           this.pos += 4;
34427           return val;
34428         }
34429         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
34430         readFixed64() {
34431           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
34432           this.pos += 8;
34433           return val;
34434         }
34435         readSFixed64() {
34436           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
34437           this.pos += 8;
34438           return val;
34439         }
34440         readFloat() {
34441           const val = this.dataView.getFloat32(this.pos, true);
34442           this.pos += 4;
34443           return val;
34444         }
34445         readDouble() {
34446           const val = this.dataView.getFloat64(this.pos, true);
34447           this.pos += 8;
34448           return val;
34449         }
34450         /**
34451          * @param {boolean} [isSigned]
34452          */
34453         readVarint(isSigned) {
34454           const buf = this.buf;
34455           let val, b3;
34456           b3 = buf[this.pos++];
34457           val = b3 & 127;
34458           if (b3 < 128) return val;
34459           b3 = buf[this.pos++];
34460           val |= (b3 & 127) << 7;
34461           if (b3 < 128) return val;
34462           b3 = buf[this.pos++];
34463           val |= (b3 & 127) << 14;
34464           if (b3 < 128) return val;
34465           b3 = buf[this.pos++];
34466           val |= (b3 & 127) << 21;
34467           if (b3 < 128) return val;
34468           b3 = buf[this.pos];
34469           val |= (b3 & 15) << 28;
34470           return readVarintRemainder(val, isSigned, this);
34471         }
34472         readVarint64() {
34473           return this.readVarint(true);
34474         }
34475         readSVarint() {
34476           const num = this.readVarint();
34477           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
34478         }
34479         readBoolean() {
34480           return Boolean(this.readVarint());
34481         }
34482         readString() {
34483           const end = this.readVarint() + this.pos;
34484           const pos = this.pos;
34485           this.pos = end;
34486           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
34487             return utf8TextDecoder.decode(this.buf.subarray(pos, end));
34488           }
34489           return readUtf8(this.buf, pos, end);
34490         }
34491         readBytes() {
34492           const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
34493           this.pos = end;
34494           return buffer;
34495         }
34496         // verbose for performance reasons; doesn't affect gzipped size
34497         /**
34498          * @param {number[]} [arr]
34499          * @param {boolean} [isSigned]
34500          */
34501         readPackedVarint(arr = [], isSigned) {
34502           const end = this.readPackedEnd();
34503           while (this.pos < end) arr.push(this.readVarint(isSigned));
34504           return arr;
34505         }
34506         /** @param {number[]} [arr] */
34507         readPackedSVarint(arr = []) {
34508           const end = this.readPackedEnd();
34509           while (this.pos < end) arr.push(this.readSVarint());
34510           return arr;
34511         }
34512         /** @param {boolean[]} [arr] */
34513         readPackedBoolean(arr = []) {
34514           const end = this.readPackedEnd();
34515           while (this.pos < end) arr.push(this.readBoolean());
34516           return arr;
34517         }
34518         /** @param {number[]} [arr] */
34519         readPackedFloat(arr = []) {
34520           const end = this.readPackedEnd();
34521           while (this.pos < end) arr.push(this.readFloat());
34522           return arr;
34523         }
34524         /** @param {number[]} [arr] */
34525         readPackedDouble(arr = []) {
34526           const end = this.readPackedEnd();
34527           while (this.pos < end) arr.push(this.readDouble());
34528           return arr;
34529         }
34530         /** @param {number[]} [arr] */
34531         readPackedFixed32(arr = []) {
34532           const end = this.readPackedEnd();
34533           while (this.pos < end) arr.push(this.readFixed32());
34534           return arr;
34535         }
34536         /** @param {number[]} [arr] */
34537         readPackedSFixed32(arr = []) {
34538           const end = this.readPackedEnd();
34539           while (this.pos < end) arr.push(this.readSFixed32());
34540           return arr;
34541         }
34542         /** @param {number[]} [arr] */
34543         readPackedFixed64(arr = []) {
34544           const end = this.readPackedEnd();
34545           while (this.pos < end) arr.push(this.readFixed64());
34546           return arr;
34547         }
34548         /** @param {number[]} [arr] */
34549         readPackedSFixed64(arr = []) {
34550           const end = this.readPackedEnd();
34551           while (this.pos < end) arr.push(this.readSFixed64());
34552           return arr;
34553         }
34554         readPackedEnd() {
34555           return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
34556         }
34557         /** @param {number} val */
34558         skip(val) {
34559           const type2 = val & 7;
34560           if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
34561           }
34562           else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
34563           else if (type2 === PBF_FIXED32) this.pos += 4;
34564           else if (type2 === PBF_FIXED64) this.pos += 8;
34565           else throw new Error(`Unimplemented type: ${type2}`);
34566         }
34567         // === WRITING =================================================================
34568         /**
34569          * @param {number} tag
34570          * @param {number} type
34571          */
34572         writeTag(tag, type2) {
34573           this.writeVarint(tag << 3 | type2);
34574         }
34575         /** @param {number} min */
34576         realloc(min3) {
34577           let length2 = this.length || 16;
34578           while (length2 < this.pos + min3) length2 *= 2;
34579           if (length2 !== this.length) {
34580             const buf = new Uint8Array(length2);
34581             buf.set(this.buf);
34582             this.buf = buf;
34583             this.dataView = new DataView(buf.buffer);
34584             this.length = length2;
34585           }
34586         }
34587         finish() {
34588           this.length = this.pos;
34589           this.pos = 0;
34590           return this.buf.subarray(0, this.length);
34591         }
34592         /** @param {number} val */
34593         writeFixed32(val) {
34594           this.realloc(4);
34595           this.dataView.setInt32(this.pos, val, true);
34596           this.pos += 4;
34597         }
34598         /** @param {number} val */
34599         writeSFixed32(val) {
34600           this.realloc(4);
34601           this.dataView.setInt32(this.pos, val, true);
34602           this.pos += 4;
34603         }
34604         /** @param {number} val */
34605         writeFixed64(val) {
34606           this.realloc(8);
34607           this.dataView.setInt32(this.pos, val & -1, true);
34608           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
34609           this.pos += 8;
34610         }
34611         /** @param {number} val */
34612         writeSFixed64(val) {
34613           this.realloc(8);
34614           this.dataView.setInt32(this.pos, val & -1, true);
34615           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
34616           this.pos += 8;
34617         }
34618         /** @param {number} val */
34619         writeVarint(val) {
34620           val = +val || 0;
34621           if (val > 268435455 || val < 0) {
34622             writeBigVarint(val, this);
34623             return;
34624           }
34625           this.realloc(4);
34626           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
34627           if (val <= 127) return;
34628           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
34629           if (val <= 127) return;
34630           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
34631           if (val <= 127) return;
34632           this.buf[this.pos++] = val >>> 7 & 127;
34633         }
34634         /** @param {number} val */
34635         writeSVarint(val) {
34636           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
34637         }
34638         /** @param {boolean} val */
34639         writeBoolean(val) {
34640           this.writeVarint(+val);
34641         }
34642         /** @param {string} str */
34643         writeString(str) {
34644           str = String(str);
34645           this.realloc(str.length * 4);
34646           this.pos++;
34647           const startPos = this.pos;
34648           this.pos = writeUtf8(this.buf, str, this.pos);
34649           const len = this.pos - startPos;
34650           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
34651           this.pos = startPos - 1;
34652           this.writeVarint(len);
34653           this.pos += len;
34654         }
34655         /** @param {number} val */
34656         writeFloat(val) {
34657           this.realloc(4);
34658           this.dataView.setFloat32(this.pos, val, true);
34659           this.pos += 4;
34660         }
34661         /** @param {number} val */
34662         writeDouble(val) {
34663           this.realloc(8);
34664           this.dataView.setFloat64(this.pos, val, true);
34665           this.pos += 8;
34666         }
34667         /** @param {Uint8Array} buffer */
34668         writeBytes(buffer) {
34669           const len = buffer.length;
34670           this.writeVarint(len);
34671           this.realloc(len);
34672           for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
34673         }
34674         /**
34675          * @template T
34676          * @param {(obj: T, pbf: Pbf) => void} fn
34677          * @param {T} obj
34678          */
34679         writeRawMessage(fn, obj) {
34680           this.pos++;
34681           const startPos = this.pos;
34682           fn(obj, this);
34683           const len = this.pos - startPos;
34684           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
34685           this.pos = startPos - 1;
34686           this.writeVarint(len);
34687           this.pos += len;
34688         }
34689         /**
34690          * @template T
34691          * @param {number} tag
34692          * @param {(obj: T, pbf: Pbf) => void} fn
34693          * @param {T} obj
34694          */
34695         writeMessage(tag, fn, obj) {
34696           this.writeTag(tag, PBF_BYTES);
34697           this.writeRawMessage(fn, obj);
34698         }
34699         /**
34700          * @param {number} tag
34701          * @param {number[]} arr
34702          */
34703         writePackedVarint(tag, arr) {
34704           if (arr.length) this.writeMessage(tag, writePackedVarint, arr);
34705         }
34706         /**
34707          * @param {number} tag
34708          * @param {number[]} arr
34709          */
34710         writePackedSVarint(tag, arr) {
34711           if (arr.length) this.writeMessage(tag, writePackedSVarint, arr);
34712         }
34713         /**
34714          * @param {number} tag
34715          * @param {boolean[]} arr
34716          */
34717         writePackedBoolean(tag, arr) {
34718           if (arr.length) this.writeMessage(tag, writePackedBoolean, arr);
34719         }
34720         /**
34721          * @param {number} tag
34722          * @param {number[]} arr
34723          */
34724         writePackedFloat(tag, arr) {
34725           if (arr.length) this.writeMessage(tag, writePackedFloat, arr);
34726         }
34727         /**
34728          * @param {number} tag
34729          * @param {number[]} arr
34730          */
34731         writePackedDouble(tag, arr) {
34732           if (arr.length) this.writeMessage(tag, writePackedDouble, arr);
34733         }
34734         /**
34735          * @param {number} tag
34736          * @param {number[]} arr
34737          */
34738         writePackedFixed32(tag, arr) {
34739           if (arr.length) this.writeMessage(tag, writePackedFixed32, arr);
34740         }
34741         /**
34742          * @param {number} tag
34743          * @param {number[]} arr
34744          */
34745         writePackedSFixed32(tag, arr) {
34746           if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr);
34747         }
34748         /**
34749          * @param {number} tag
34750          * @param {number[]} arr
34751          */
34752         writePackedFixed64(tag, arr) {
34753           if (arr.length) this.writeMessage(tag, writePackedFixed64, arr);
34754         }
34755         /**
34756          * @param {number} tag
34757          * @param {number[]} arr
34758          */
34759         writePackedSFixed64(tag, arr) {
34760           if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr);
34761         }
34762         /**
34763          * @param {number} tag
34764          * @param {Uint8Array} buffer
34765          */
34766         writeBytesField(tag, buffer) {
34767           this.writeTag(tag, PBF_BYTES);
34768           this.writeBytes(buffer);
34769         }
34770         /**
34771          * @param {number} tag
34772          * @param {number} val
34773          */
34774         writeFixed32Field(tag, val) {
34775           this.writeTag(tag, PBF_FIXED32);
34776           this.writeFixed32(val);
34777         }
34778         /**
34779          * @param {number} tag
34780          * @param {number} val
34781          */
34782         writeSFixed32Field(tag, val) {
34783           this.writeTag(tag, PBF_FIXED32);
34784           this.writeSFixed32(val);
34785         }
34786         /**
34787          * @param {number} tag
34788          * @param {number} val
34789          */
34790         writeFixed64Field(tag, val) {
34791           this.writeTag(tag, PBF_FIXED64);
34792           this.writeFixed64(val);
34793         }
34794         /**
34795          * @param {number} tag
34796          * @param {number} val
34797          */
34798         writeSFixed64Field(tag, val) {
34799           this.writeTag(tag, PBF_FIXED64);
34800           this.writeSFixed64(val);
34801         }
34802         /**
34803          * @param {number} tag
34804          * @param {number} val
34805          */
34806         writeVarintField(tag, val) {
34807           this.writeTag(tag, PBF_VARINT);
34808           this.writeVarint(val);
34809         }
34810         /**
34811          * @param {number} tag
34812          * @param {number} val
34813          */
34814         writeSVarintField(tag, val) {
34815           this.writeTag(tag, PBF_VARINT);
34816           this.writeSVarint(val);
34817         }
34818         /**
34819          * @param {number} tag
34820          * @param {string} str
34821          */
34822         writeStringField(tag, str) {
34823           this.writeTag(tag, PBF_BYTES);
34824           this.writeString(str);
34825         }
34826         /**
34827          * @param {number} tag
34828          * @param {number} val
34829          */
34830         writeFloatField(tag, val) {
34831           this.writeTag(tag, PBF_FIXED32);
34832           this.writeFloat(val);
34833         }
34834         /**
34835          * @param {number} tag
34836          * @param {number} val
34837          */
34838         writeDoubleField(tag, val) {
34839           this.writeTag(tag, PBF_FIXED64);
34840           this.writeDouble(val);
34841         }
34842         /**
34843          * @param {number} tag
34844          * @param {boolean} val
34845          */
34846         writeBooleanField(tag, val) {
34847           this.writeVarintField(tag, +val);
34848         }
34849       };
34850     }
34851   });
34852
34853   // node_modules/@mapbox/point-geometry/index.js
34854   function Point(x2, y2) {
34855     this.x = x2;
34856     this.y = y2;
34857   }
34858   var init_point_geometry = __esm({
34859     "node_modules/@mapbox/point-geometry/index.js"() {
34860       Point.prototype = {
34861         /**
34862          * Clone this point, returning a new point that can be modified
34863          * without affecting the old one.
34864          * @return {Point} the clone
34865          */
34866         clone() {
34867           return new Point(this.x, this.y);
34868         },
34869         /**
34870          * Add this point's x & y coordinates to another point,
34871          * yielding a new point.
34872          * @param {Point} p the other point
34873          * @return {Point} output point
34874          */
34875         add(p2) {
34876           return this.clone()._add(p2);
34877         },
34878         /**
34879          * Subtract this point's x & y coordinates to from point,
34880          * yielding a new point.
34881          * @param {Point} p the other point
34882          * @return {Point} output point
34883          */
34884         sub(p2) {
34885           return this.clone()._sub(p2);
34886         },
34887         /**
34888          * Multiply this point's x & y coordinates by point,
34889          * yielding a new point.
34890          * @param {Point} p the other point
34891          * @return {Point} output point
34892          */
34893         multByPoint(p2) {
34894           return this.clone()._multByPoint(p2);
34895         },
34896         /**
34897          * Divide this point's x & y coordinates by point,
34898          * yielding a new point.
34899          * @param {Point} p the other point
34900          * @return {Point} output point
34901          */
34902         divByPoint(p2) {
34903           return this.clone()._divByPoint(p2);
34904         },
34905         /**
34906          * Multiply this point's x & y coordinates by a factor,
34907          * yielding a new point.
34908          * @param {number} k factor
34909          * @return {Point} output point
34910          */
34911         mult(k3) {
34912           return this.clone()._mult(k3);
34913         },
34914         /**
34915          * Divide this point's x & y coordinates by a factor,
34916          * yielding a new point.
34917          * @param {number} k factor
34918          * @return {Point} output point
34919          */
34920         div(k3) {
34921           return this.clone()._div(k3);
34922         },
34923         /**
34924          * Rotate this point around the 0, 0 origin by an angle a,
34925          * given in radians
34926          * @param {number} a angle to rotate around, in radians
34927          * @return {Point} output point
34928          */
34929         rotate(a4) {
34930           return this.clone()._rotate(a4);
34931         },
34932         /**
34933          * Rotate this point around p point by an angle a,
34934          * given in radians
34935          * @param {number} a angle to rotate around, in radians
34936          * @param {Point} p Point to rotate around
34937          * @return {Point} output point
34938          */
34939         rotateAround(a4, p2) {
34940           return this.clone()._rotateAround(a4, p2);
34941         },
34942         /**
34943          * Multiply this point by a 4x1 transformation matrix
34944          * @param {[number, number, number, number]} m transformation matrix
34945          * @return {Point} output point
34946          */
34947         matMult(m3) {
34948           return this.clone()._matMult(m3);
34949         },
34950         /**
34951          * Calculate this point but as a unit vector from 0, 0, meaning
34952          * that the distance from the resulting point to the 0, 0
34953          * coordinate will be equal to 1 and the angle from the resulting
34954          * point to the 0, 0 coordinate will be the same as before.
34955          * @return {Point} unit vector point
34956          */
34957         unit() {
34958           return this.clone()._unit();
34959         },
34960         /**
34961          * Compute a perpendicular point, where the new y coordinate
34962          * is the old x coordinate and the new x coordinate is the old y
34963          * coordinate multiplied by -1
34964          * @return {Point} perpendicular point
34965          */
34966         perp() {
34967           return this.clone()._perp();
34968         },
34969         /**
34970          * Return a version of this point with the x & y coordinates
34971          * rounded to integers.
34972          * @return {Point} rounded point
34973          */
34974         round() {
34975           return this.clone()._round();
34976         },
34977         /**
34978          * Return the magnitude of this point: this is the Euclidean
34979          * distance from the 0, 0 coordinate to this point's x and y
34980          * coordinates.
34981          * @return {number} magnitude
34982          */
34983         mag() {
34984           return Math.sqrt(this.x * this.x + this.y * this.y);
34985         },
34986         /**
34987          * Judge whether this point is equal to another point, returning
34988          * true or false.
34989          * @param {Point} other the other point
34990          * @return {boolean} whether the points are equal
34991          */
34992         equals(other) {
34993           return this.x === other.x && this.y === other.y;
34994         },
34995         /**
34996          * Calculate the distance from this point to another point
34997          * @param {Point} p the other point
34998          * @return {number} distance
34999          */
35000         dist(p2) {
35001           return Math.sqrt(this.distSqr(p2));
35002         },
35003         /**
35004          * Calculate the distance from this point to another point,
35005          * without the square root step. Useful if you're comparing
35006          * relative distances.
35007          * @param {Point} p the other point
35008          * @return {number} distance
35009          */
35010         distSqr(p2) {
35011           const dx = p2.x - this.x, dy = p2.y - this.y;
35012           return dx * dx + dy * dy;
35013         },
35014         /**
35015          * Get the angle from the 0, 0 coordinate to this point, in radians
35016          * coordinates.
35017          * @return {number} angle
35018          */
35019         angle() {
35020           return Math.atan2(this.y, this.x);
35021         },
35022         /**
35023          * Get the angle from this point to another point, in radians
35024          * @param {Point} b the other point
35025          * @return {number} angle
35026          */
35027         angleTo(b3) {
35028           return Math.atan2(this.y - b3.y, this.x - b3.x);
35029         },
35030         /**
35031          * Get the angle between this point and another point, in radians
35032          * @param {Point} b the other point
35033          * @return {number} angle
35034          */
35035         angleWith(b3) {
35036           return this.angleWithSep(b3.x, b3.y);
35037         },
35038         /**
35039          * Find the angle of the two vectors, solving the formula for
35040          * the cross product a x b = |a||b|sin(θ) for θ.
35041          * @param {number} x the x-coordinate
35042          * @param {number} y the y-coordinate
35043          * @return {number} the angle in radians
35044          */
35045         angleWithSep(x2, y2) {
35046           return Math.atan2(
35047             this.x * y2 - this.y * x2,
35048             this.x * x2 + this.y * y2
35049           );
35050         },
35051         /** @param {[number, number, number, number]} m */
35052         _matMult(m3) {
35053           const x2 = m3[0] * this.x + m3[1] * this.y, y2 = m3[2] * this.x + m3[3] * this.y;
35054           this.x = x2;
35055           this.y = y2;
35056           return this;
35057         },
35058         /** @param {Point} p */
35059         _add(p2) {
35060           this.x += p2.x;
35061           this.y += p2.y;
35062           return this;
35063         },
35064         /** @param {Point} p */
35065         _sub(p2) {
35066           this.x -= p2.x;
35067           this.y -= p2.y;
35068           return this;
35069         },
35070         /** @param {number} k */
35071         _mult(k3) {
35072           this.x *= k3;
35073           this.y *= k3;
35074           return this;
35075         },
35076         /** @param {number} k */
35077         _div(k3) {
35078           this.x /= k3;
35079           this.y /= k3;
35080           return this;
35081         },
35082         /** @param {Point} p */
35083         _multByPoint(p2) {
35084           this.x *= p2.x;
35085           this.y *= p2.y;
35086           return this;
35087         },
35088         /** @param {Point} p */
35089         _divByPoint(p2) {
35090           this.x /= p2.x;
35091           this.y /= p2.y;
35092           return this;
35093         },
35094         _unit() {
35095           this._div(this.mag());
35096           return this;
35097         },
35098         _perp() {
35099           const y2 = this.y;
35100           this.y = this.x;
35101           this.x = -y2;
35102           return this;
35103         },
35104         /** @param {number} angle */
35105         _rotate(angle2) {
35106           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
35107           this.x = x2;
35108           this.y = y2;
35109           return this;
35110         },
35111         /**
35112          * @param {number} angle
35113          * @param {Point} p
35114          */
35115         _rotateAround(angle2, p2) {
35116           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
35117           this.x = x2;
35118           this.y = y2;
35119           return this;
35120         },
35121         _round() {
35122           this.x = Math.round(this.x);
35123           this.y = Math.round(this.y);
35124           return this;
35125         },
35126         constructor: Point
35127       };
35128       Point.convert = function(p2) {
35129         if (p2 instanceof Point) {
35130           return (
35131             /** @type {Point} */
35132             p2
35133           );
35134         }
35135         if (Array.isArray(p2)) {
35136           return new Point(+p2[0], +p2[1]);
35137         }
35138         if (p2.x !== void 0 && p2.y !== void 0) {
35139           return new Point(+p2.x, +p2.y);
35140         }
35141         throw new Error("Expected [x, y] or {x, y} point format");
35142       };
35143     }
35144   });
35145
35146   // node_modules/@mapbox/vector-tile/index.js
35147   function readFeature(tag, feature3, pbf) {
35148     if (tag === 1) feature3.id = pbf.readVarint();
35149     else if (tag === 2) readTag(pbf, feature3);
35150     else if (tag === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
35151     pbf.readVarint();
35152     else if (tag === 4) feature3._geometry = pbf.pos;
35153   }
35154   function readTag(pbf, feature3) {
35155     const end = pbf.readVarint() + pbf.pos;
35156     while (pbf.pos < end) {
35157       const key = feature3._keys[pbf.readVarint()];
35158       const value = feature3._values[pbf.readVarint()];
35159       feature3.properties[key] = value;
35160     }
35161   }
35162   function classifyRings(rings) {
35163     const len = rings.length;
35164     if (len <= 1) return [rings];
35165     const polygons = [];
35166     let polygon2, ccw;
35167     for (let i3 = 0; i3 < len; i3++) {
35168       const area = signedArea(rings[i3]);
35169       if (area === 0) continue;
35170       if (ccw === void 0) ccw = area < 0;
35171       if (ccw === area < 0) {
35172         if (polygon2) polygons.push(polygon2);
35173         polygon2 = [rings[i3]];
35174       } else if (polygon2) {
35175         polygon2.push(rings[i3]);
35176       }
35177     }
35178     if (polygon2) polygons.push(polygon2);
35179     return polygons;
35180   }
35181   function signedArea(ring) {
35182     let sum = 0;
35183     for (let i3 = 0, len = ring.length, j3 = len - 1, p1, p2; i3 < len; j3 = i3++) {
35184       p1 = ring[i3];
35185       p2 = ring[j3];
35186       sum += (p2.x - p1.x) * (p1.y + p2.y);
35187     }
35188     return sum;
35189   }
35190   function readLayer(tag, layer, pbf) {
35191     if (tag === 15) layer.version = pbf.readVarint();
35192     else if (tag === 1) layer.name = pbf.readString();
35193     else if (tag === 5) layer.extent = pbf.readVarint();
35194     else if (tag === 2) layer._features.push(pbf.pos);
35195     else if (tag === 3) layer._keys.push(pbf.readString());
35196     else if (tag === 4) layer._values.push(readValueMessage(pbf));
35197   }
35198   function readValueMessage(pbf) {
35199     let value = null;
35200     const end = pbf.readVarint() + pbf.pos;
35201     while (pbf.pos < end) {
35202       const tag = pbf.readVarint() >> 3;
35203       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;
35204     }
35205     if (value == null) {
35206       throw new Error("unknown feature value");
35207     }
35208     return value;
35209   }
35210   function readTile(tag, layers, pbf) {
35211     if (tag === 3) {
35212       const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
35213       if (layer.length) layers[layer.name] = layer;
35214     }
35215   }
35216   var VectorTileFeature, VectorTileLayer, VectorTile;
35217   var init_vector_tile = __esm({
35218     "node_modules/@mapbox/vector-tile/index.js"() {
35219       init_point_geometry();
35220       VectorTileFeature = class {
35221         /**
35222          * @param {Pbf} pbf
35223          * @param {number} end
35224          * @param {number} extent
35225          * @param {string[]} keys
35226          * @param {(number | string | boolean)[]} values
35227          */
35228         constructor(pbf, end, extent, keys2, values) {
35229           this.properties = {};
35230           this.extent = extent;
35231           this.type = 0;
35232           this.id = void 0;
35233           this._pbf = pbf;
35234           this._geometry = -1;
35235           this._keys = keys2;
35236           this._values = values;
35237           pbf.readFields(readFeature, this, end);
35238         }
35239         loadGeometry() {
35240           const pbf = this._pbf;
35241           pbf.pos = this._geometry;
35242           const end = pbf.readVarint() + pbf.pos;
35243           const lines = [];
35244           let line;
35245           let cmd = 1;
35246           let length2 = 0;
35247           let x2 = 0;
35248           let y2 = 0;
35249           while (pbf.pos < end) {
35250             if (length2 <= 0) {
35251               const cmdLen = pbf.readVarint();
35252               cmd = cmdLen & 7;
35253               length2 = cmdLen >> 3;
35254             }
35255             length2--;
35256             if (cmd === 1 || cmd === 2) {
35257               x2 += pbf.readSVarint();
35258               y2 += pbf.readSVarint();
35259               if (cmd === 1) {
35260                 if (line) lines.push(line);
35261                 line = [];
35262               }
35263               if (line) line.push(new Point(x2, y2));
35264             } else if (cmd === 7) {
35265               if (line) {
35266                 line.push(line[0].clone());
35267               }
35268             } else {
35269               throw new Error(`unknown command ${cmd}`);
35270             }
35271           }
35272           if (line) lines.push(line);
35273           return lines;
35274         }
35275         bbox() {
35276           const pbf = this._pbf;
35277           pbf.pos = this._geometry;
35278           const end = pbf.readVarint() + pbf.pos;
35279           let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
35280           while (pbf.pos < end) {
35281             if (length2 <= 0) {
35282               const cmdLen = pbf.readVarint();
35283               cmd = cmdLen & 7;
35284               length2 = cmdLen >> 3;
35285             }
35286             length2--;
35287             if (cmd === 1 || cmd === 2) {
35288               x2 += pbf.readSVarint();
35289               y2 += pbf.readSVarint();
35290               if (x2 < x12) x12 = x2;
35291               if (x2 > x22) x22 = x2;
35292               if (y2 < y12) y12 = y2;
35293               if (y2 > y22) y22 = y2;
35294             } else if (cmd !== 7) {
35295               throw new Error(`unknown command ${cmd}`);
35296             }
35297           }
35298           return [x12, y12, x22, y22];
35299         }
35300         /**
35301          * @param {number} x
35302          * @param {number} y
35303          * @param {number} z
35304          * @return {Feature}
35305          */
35306         toGeoJSON(x2, y2, z3) {
35307           const size = this.extent * Math.pow(2, z3), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
35308           function projectPoint(p2) {
35309             return [
35310               (p2.x + x05) * 360 / size - 180,
35311               360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
35312             ];
35313           }
35314           function projectLine(line) {
35315             return line.map(projectPoint);
35316           }
35317           let geometry;
35318           if (this.type === 1) {
35319             const points = [];
35320             for (const line of vtCoords) {
35321               points.push(line[0]);
35322             }
35323             const coordinates = projectLine(points);
35324             geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
35325           } else if (this.type === 2) {
35326             const coordinates = vtCoords.map(projectLine);
35327             geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
35328           } else if (this.type === 3) {
35329             const polygons = classifyRings(vtCoords);
35330             const coordinates = [];
35331             for (const polygon2 of polygons) {
35332               coordinates.push(polygon2.map(projectLine));
35333             }
35334             geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
35335           } else {
35336             throw new Error("unknown feature type");
35337           }
35338           const result = {
35339             type: "Feature",
35340             geometry,
35341             properties: this.properties
35342           };
35343           if (this.id != null) {
35344             result.id = this.id;
35345           }
35346           return result;
35347         }
35348       };
35349       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
35350       VectorTileLayer = class {
35351         /**
35352          * @param {Pbf} pbf
35353          * @param {number} [end]
35354          */
35355         constructor(pbf, end) {
35356           this.version = 1;
35357           this.name = "";
35358           this.extent = 4096;
35359           this.length = 0;
35360           this._pbf = pbf;
35361           this._keys = [];
35362           this._values = [];
35363           this._features = [];
35364           pbf.readFields(readLayer, this, end);
35365           this.length = this._features.length;
35366         }
35367         /** return feature `i` from this layer as a `VectorTileFeature`
35368          * @param {number} i
35369          */
35370         feature(i3) {
35371           if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
35372           this._pbf.pos = this._features[i3];
35373           const end = this._pbf.readVarint() + this._pbf.pos;
35374           return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
35375         }
35376       };
35377       VectorTile = class {
35378         /**
35379          * @param {Pbf} pbf
35380          * @param {number} [end]
35381          */
35382         constructor(pbf, end) {
35383           this.layers = pbf.readFields(readTile, {}, end);
35384         }
35385       };
35386     }
35387   });
35388
35389   // modules/services/mapillary.js
35390   var mapillary_exports = {};
35391   __export(mapillary_exports, {
35392     default: () => mapillary_default
35393   });
35394   function loadTiles(which, url, maxZoom2, projection2) {
35395     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
35396     const tiles = tiler8.getTiles(projection2);
35397     tiles.forEach(function(tile) {
35398       loadTile(which, url, tile);
35399     });
35400   }
35401   function loadTile(which, url, tile) {
35402     const cache = _mlyCache.requests;
35403     const tileId = `${tile.id}-${which}`;
35404     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
35405     const controller = new AbortController();
35406     cache.inflight[tileId] = controller;
35407     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
35408     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
35409       if (!response.ok) {
35410         throw new Error(response.status + " " + response.statusText);
35411       }
35412       cache.loaded[tileId] = true;
35413       delete cache.inflight[tileId];
35414       return response.arrayBuffer();
35415     }).then(function(data) {
35416       if (!data) {
35417         throw new Error("No Data");
35418       }
35419       loadTileDataToCache(data, tile, which);
35420       if (which === "images") {
35421         dispatch4.call("loadedImages");
35422       } else if (which === "signs") {
35423         dispatch4.call("loadedSigns");
35424       } else if (which === "points") {
35425         dispatch4.call("loadedMapFeatures");
35426       }
35427     }).catch(function() {
35428       cache.loaded[tileId] = true;
35429       delete cache.inflight[tileId];
35430     });
35431   }
35432   function loadTileDataToCache(data, tile, which) {
35433     const vectorTile = new VectorTile(new Pbf(data));
35434     let features, cache, layer, i3, feature3, loc, d2;
35435     if (vectorTile.layers.hasOwnProperty("image")) {
35436       features = [];
35437       cache = _mlyCache.images;
35438       layer = vectorTile.layers.image;
35439       for (i3 = 0; i3 < layer.length; i3++) {
35440         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35441         loc = feature3.geometry.coordinates;
35442         d2 = {
35443           service: "photo",
35444           loc,
35445           captured_at: feature3.properties.captured_at,
35446           ca: feature3.properties.compass_angle,
35447           id: feature3.properties.id,
35448           is_pano: feature3.properties.is_pano,
35449           sequence_id: feature3.properties.sequence_id
35450         };
35451         cache.forImageId[d2.id] = d2;
35452         features.push({
35453           minX: loc[0],
35454           minY: loc[1],
35455           maxX: loc[0],
35456           maxY: loc[1],
35457           data: d2
35458         });
35459       }
35460       if (cache.rtree) {
35461         cache.rtree.load(features);
35462       }
35463     }
35464     if (vectorTile.layers.hasOwnProperty("sequence")) {
35465       features = [];
35466       cache = _mlyCache.sequences;
35467       layer = vectorTile.layers.sequence;
35468       for (i3 = 0; i3 < layer.length; i3++) {
35469         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35470         if (cache.lineString[feature3.properties.id]) {
35471           cache.lineString[feature3.properties.id].push(feature3);
35472         } else {
35473           cache.lineString[feature3.properties.id] = [feature3];
35474         }
35475       }
35476     }
35477     if (vectorTile.layers.hasOwnProperty("point")) {
35478       features = [];
35479       cache = _mlyCache[which];
35480       layer = vectorTile.layers.point;
35481       for (i3 = 0; i3 < layer.length; i3++) {
35482         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35483         loc = feature3.geometry.coordinates;
35484         d2 = {
35485           service: "photo",
35486           loc,
35487           id: feature3.properties.id,
35488           first_seen_at: feature3.properties.first_seen_at,
35489           last_seen_at: feature3.properties.last_seen_at,
35490           value: feature3.properties.value
35491         };
35492         features.push({
35493           minX: loc[0],
35494           minY: loc[1],
35495           maxX: loc[0],
35496           maxY: loc[1],
35497           data: d2
35498         });
35499       }
35500       if (cache.rtree) {
35501         cache.rtree.load(features);
35502       }
35503     }
35504     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
35505       features = [];
35506       cache = _mlyCache[which];
35507       layer = vectorTile.layers.traffic_sign;
35508       for (i3 = 0; i3 < layer.length; i3++) {
35509         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
35510         loc = feature3.geometry.coordinates;
35511         d2 = {
35512           service: "photo",
35513           loc,
35514           id: feature3.properties.id,
35515           first_seen_at: feature3.properties.first_seen_at,
35516           last_seen_at: feature3.properties.last_seen_at,
35517           value: feature3.properties.value
35518         };
35519         features.push({
35520           minX: loc[0],
35521           minY: loc[1],
35522           maxX: loc[0],
35523           maxY: loc[1],
35524           data: d2
35525         });
35526       }
35527       if (cache.rtree) {
35528         cache.rtree.load(features);
35529       }
35530     }
35531   }
35532   function loadData(url) {
35533     return fetch(url).then(function(response) {
35534       if (!response.ok) {
35535         throw new Error(response.status + " " + response.statusText);
35536       }
35537       return response.json();
35538     }).then(function(result) {
35539       if (!result) {
35540         return [];
35541       }
35542       return result.data || [];
35543     });
35544   }
35545   function partitionViewport(projection2) {
35546     const z3 = geoScaleToZoom(projection2.scale());
35547     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
35548     const tiler8 = utilTiler().zoomExtent([z22, z22]);
35549     return tiler8.getTiles(projection2).map(function(tile) {
35550       return tile.extent;
35551     });
35552   }
35553   function searchLimited(limit, projection2, rtree) {
35554     limit = limit || 5;
35555     return partitionViewport(projection2).reduce(function(result, extent) {
35556       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
35557         return d2.data;
35558       });
35559       return found.length ? result.concat(found) : result;
35560     }, []);
35561   }
35562   var accessToken, apiUrl, baseTileUrl, mapFeatureTileUrl, tileUrl, trafficSignTileUrl, viewercss, viewerjs, minZoom, dispatch4, _loadViewerPromise, _mlyActiveImage, _mlyCache, _mlyFallback, _mlyHighlightedDetection, _mlyShowFeatureDetections, _mlyShowSignDetections, _mlyViewer, _mlyViewerFilter, _isViewerOpen, mapillary_default;
35563   var init_mapillary = __esm({
35564     "modules/services/mapillary.js"() {
35565       "use strict";
35566       init_src4();
35567       init_src5();
35568       init_pbf();
35569       init_rbush();
35570       init_vector_tile();
35571       init_geo2();
35572       init_util();
35573       init_services();
35574       accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
35575       apiUrl = "https://graph.mapillary.com/";
35576       baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
35577       mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
35578       tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
35579       trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
35580       viewercss = "mapillary-js/mapillary.css";
35581       viewerjs = "mapillary-js/mapillary.js";
35582       minZoom = 14;
35583       dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
35584       _mlyFallback = false;
35585       _mlyShowFeatureDetections = false;
35586       _mlyShowSignDetections = false;
35587       _mlyViewerFilter = ["all"];
35588       _isViewerOpen = false;
35589       mapillary_default = {
35590         // Initialize Mapillary
35591         init: function() {
35592           if (!_mlyCache) {
35593             this.reset();
35594           }
35595           this.event = utilRebind(this, dispatch4, "on");
35596         },
35597         // Reset cache and state
35598         reset: function() {
35599           if (_mlyCache) {
35600             Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
35601               request3.abort();
35602             });
35603           }
35604           _mlyCache = {
35605             images: { rtree: new RBush(), forImageId: {} },
35606             image_detections: { forImageId: {} },
35607             signs: { rtree: new RBush() },
35608             points: { rtree: new RBush() },
35609             sequences: { rtree: new RBush(), lineString: {} },
35610             requests: { loaded: {}, inflight: {} }
35611           };
35612           _mlyActiveImage = null;
35613         },
35614         // Get visible images
35615         images: function(projection2) {
35616           const limit = 5;
35617           return searchLimited(limit, projection2, _mlyCache.images.rtree);
35618         },
35619         // Get visible traffic signs
35620         signs: function(projection2) {
35621           const limit = 5;
35622           return searchLimited(limit, projection2, _mlyCache.signs.rtree);
35623         },
35624         // Get visible map (point) features
35625         mapFeatures: function(projection2) {
35626           const limit = 5;
35627           return searchLimited(limit, projection2, _mlyCache.points.rtree);
35628         },
35629         // Get cached image by id
35630         cachedImage: function(imageId) {
35631           return _mlyCache.images.forImageId[imageId];
35632         },
35633         // Get visible sequences
35634         sequences: function(projection2) {
35635           const viewport = projection2.clipExtent();
35636           const min3 = [viewport[0][0], viewport[1][1]];
35637           const max3 = [viewport[1][0], viewport[0][1]];
35638           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
35639           const sequenceIds = {};
35640           let lineStrings = [];
35641           _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
35642             if (d2.data.sequence_id) {
35643               sequenceIds[d2.data.sequence_id] = true;
35644             }
35645           });
35646           Object.keys(sequenceIds).forEach(function(sequenceId) {
35647             if (_mlyCache.sequences.lineString[sequenceId]) {
35648               lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
35649             }
35650           });
35651           return lineStrings;
35652         },
35653         // Load images in the visible area
35654         loadImages: function(projection2) {
35655           loadTiles("images", tileUrl, 14, projection2);
35656         },
35657         // Load traffic signs in the visible area
35658         loadSigns: function(projection2) {
35659           loadTiles("signs", trafficSignTileUrl, 14, projection2);
35660         },
35661         // Load map (point) features in the visible area
35662         loadMapFeatures: function(projection2) {
35663           loadTiles("points", mapFeatureTileUrl, 14, projection2);
35664         },
35665         // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
35666         ensureViewerLoaded: function(context) {
35667           if (_loadViewerPromise) return _loadViewerPromise;
35668           const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
35669           wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
35670           const that = this;
35671           _loadViewerPromise = new Promise((resolve, reject) => {
35672             let loadedCount = 0;
35673             function loaded() {
35674               loadedCount += 1;
35675               if (loadedCount === 2) resolve();
35676             }
35677             const head = select_default2("head");
35678             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() {
35679               reject();
35680             });
35681             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() {
35682               reject();
35683             });
35684           }).catch(function() {
35685             _loadViewerPromise = null;
35686           }).then(function() {
35687             that.initViewer(context);
35688           });
35689           return _loadViewerPromise;
35690         },
35691         // Load traffic sign image sprites
35692         loadSignResources: function(context) {
35693           context.ui().svgDefs.addSprites(
35694             ["mapillary-sprite"],
35695             false
35696             /* don't override colors */
35697           );
35698           return this;
35699         },
35700         // Load map (point) feature image sprites
35701         loadObjectResources: function(context) {
35702           context.ui().svgDefs.addSprites(
35703             ["mapillary-object-sprite"],
35704             false
35705             /* don't override colors */
35706           );
35707           return this;
35708         },
35709         // Remove previous detections in image viewer
35710         resetTags: function() {
35711           if (_mlyViewer && !_mlyFallback) {
35712             _mlyViewer.getComponent("tag").removeAll();
35713           }
35714         },
35715         // Show map feature detections in image viewer
35716         showFeatureDetections: function(value) {
35717           _mlyShowFeatureDetections = value;
35718           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
35719             this.resetTags();
35720           }
35721         },
35722         // Show traffic sign detections in image viewer
35723         showSignDetections: function(value) {
35724           _mlyShowSignDetections = value;
35725           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
35726             this.resetTags();
35727           }
35728         },
35729         // Apply filter to image viewer
35730         filterViewer: function(context) {
35731           const showsPano = context.photos().showsPanoramic();
35732           const showsFlat = context.photos().showsFlat();
35733           const fromDate = context.photos().fromDate();
35734           const toDate = context.photos().toDate();
35735           const filter2 = ["all"];
35736           if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
35737           if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
35738           if (fromDate) {
35739             filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
35740           }
35741           if (toDate) {
35742             filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
35743           }
35744           if (_mlyViewer) {
35745             _mlyViewer.setFilter(filter2);
35746           }
35747           _mlyViewerFilter = filter2;
35748           return filter2;
35749         },
35750         // Make the image viewer visible
35751         showViewer: function(context) {
35752           const wrap2 = context.container().select(".photoviewer");
35753           const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
35754           if (isHidden && _mlyViewer) {
35755             for (const service of Object.values(services)) {
35756               if (service === this) continue;
35757               if (typeof service.hideViewer === "function") {
35758                 service.hideViewer(context);
35759               }
35760             }
35761             wrap2.classed("hide", false).selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
35762             _mlyViewer.resize();
35763           }
35764           _isViewerOpen = true;
35765           return this;
35766         },
35767         // Hide the image viewer and resets map markers
35768         hideViewer: function(context) {
35769           _mlyActiveImage = null;
35770           if (!_mlyFallback && _mlyViewer) {
35771             _mlyViewer.getComponent("sequence").stop();
35772           }
35773           const viewer = context.container().select(".photoviewer");
35774           if (!viewer.empty()) viewer.datum(null);
35775           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
35776           this.updateUrlImage(null);
35777           dispatch4.call("imageChanged");
35778           dispatch4.call("loadedMapFeatures");
35779           dispatch4.call("loadedSigns");
35780           _isViewerOpen = false;
35781           return this.setStyles(context, null);
35782         },
35783         // Get viewer status
35784         isViewerOpen: function() {
35785           return _isViewerOpen;
35786         },
35787         // Update the URL with current image id
35788         updateUrlImage: function(imageId) {
35789           const hash2 = utilStringQs(window.location.hash);
35790           if (imageId) {
35791             hash2.photo = "mapillary/" + imageId;
35792           } else {
35793             delete hash2.photo;
35794           }
35795           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
35796         },
35797         // Highlight the detection in the viewer that is related to the clicked map feature
35798         highlightDetection: function(detection) {
35799           if (detection) {
35800             _mlyHighlightedDetection = detection.id;
35801           }
35802           return this;
35803         },
35804         // Initialize image viewer (Mapillar JS)
35805         initViewer: function(context) {
35806           if (!window.mapillary) return;
35807           const opts = {
35808             accessToken,
35809             component: {
35810               cover: false,
35811               keyboard: false,
35812               tag: true
35813             },
35814             container: "ideditor-mly"
35815           };
35816           if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
35817             _mlyFallback = true;
35818             opts.component = {
35819               cover: false,
35820               direction: false,
35821               imagePlane: false,
35822               keyboard: false,
35823               mouse: false,
35824               sequence: false,
35825               tag: false,
35826               image: true,
35827               // fallback
35828               navigation: true
35829               // fallback
35830             };
35831           }
35832           _mlyViewer = new mapillary.Viewer(opts);
35833           _mlyViewer.on("image", imageChanged.bind(this));
35834           _mlyViewer.on("bearing", bearingChanged);
35835           if (_mlyViewerFilter) {
35836             _mlyViewer.setFilter(_mlyViewerFilter);
35837           }
35838           context.ui().photoviewer.on("resize.mapillary", function() {
35839             if (_mlyViewer) _mlyViewer.resize();
35840           });
35841           function imageChanged(photo) {
35842             this.resetTags();
35843             const image = photo.image;
35844             this.setActiveImage(image);
35845             this.setStyles(context, null);
35846             const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
35847             context.map().centerEase(loc);
35848             this.updateUrlImage(image.id);
35849             if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
35850               this.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
35851             }
35852             dispatch4.call("imageChanged");
35853           }
35854           function bearingChanged(e3) {
35855             dispatch4.call("bearingChanged", void 0, e3);
35856           }
35857         },
35858         // Move to an image
35859         selectImage: function(context, imageId) {
35860           if (_mlyViewer && imageId) {
35861             _mlyViewer.moveTo(imageId).then((image) => this.setActiveImage(image)).catch(function(e3) {
35862               console.error("mly3", e3);
35863             });
35864           }
35865           return this;
35866         },
35867         // Return the currently displayed image
35868         getActiveImage: function() {
35869           return _mlyActiveImage;
35870         },
35871         // Return a list of detection objects for the given id
35872         getDetections: function(id2) {
35873           return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
35874         },
35875         // Set the currently visible image
35876         setActiveImage: function(image) {
35877           if (image) {
35878             _mlyActiveImage = {
35879               ca: image.originalCompassAngle,
35880               id: image.id,
35881               loc: [image.originalLngLat.lng, image.originalLngLat.lat],
35882               is_pano: image.cameraType === "spherical",
35883               sequence_id: image.sequenceId
35884             };
35885           } else {
35886             _mlyActiveImage = null;
35887           }
35888         },
35889         // Update the currently highlighted sequence and selected bubble.
35890         setStyles: function(context, hovered) {
35891           const hoveredImageId = hovered && hovered.id;
35892           const hoveredSequenceId = hovered && hovered.sequence_id;
35893           const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
35894           context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
35895             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
35896           }).classed("hovered", function(d2) {
35897             return d2.id === hoveredImageId;
35898           });
35899           context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
35900             return d2.properties.id === hoveredSequenceId;
35901           }).classed("currentView", function(d2) {
35902             return d2.properties.id === selectedSequenceId;
35903           });
35904           return this;
35905         },
35906         // Get detections for the current image and shows them in the image viewer
35907         updateDetections: function(imageId, url) {
35908           if (!_mlyViewer || _mlyFallback) return;
35909           if (!imageId) return;
35910           const cache = _mlyCache.image_detections;
35911           if (cache.forImageId[imageId]) {
35912             showDetections(_mlyCache.image_detections.forImageId[imageId]);
35913           } else {
35914             loadData(url).then((detections) => {
35915               detections.forEach(function(detection) {
35916                 if (!cache.forImageId[imageId]) {
35917                   cache.forImageId[imageId] = [];
35918                 }
35919                 cache.forImageId[imageId].push({
35920                   geometry: detection.geometry,
35921                   id: detection.id,
35922                   image_id: imageId,
35923                   value: detection.value
35924                 });
35925               });
35926               showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
35927             });
35928           }
35929           function showDetections(detections) {
35930             const tagComponent = _mlyViewer.getComponent("tag");
35931             detections.forEach(function(data) {
35932               const tag = makeTag(data);
35933               if (tag) {
35934                 tagComponent.add([tag]);
35935               }
35936             });
35937           }
35938           function makeTag(data) {
35939             const valueParts = data.value.split("--");
35940             if (!valueParts.length) return;
35941             let tag;
35942             let text;
35943             let color2 = 16777215;
35944             if (_mlyHighlightedDetection === data.id) {
35945               color2 = 16776960;
35946               text = valueParts[1];
35947               if (text === "flat" || text === "discrete" || text === "sign") {
35948                 text = valueParts[2];
35949               }
35950               text = text.replace(/-/g, " ");
35951               text = text.charAt(0).toUpperCase() + text.slice(1);
35952               _mlyHighlightedDetection = null;
35953             }
35954             var decodedGeometry = window.atob(data.geometry);
35955             var uintArray = new Uint8Array(decodedGeometry.length);
35956             for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
35957               uintArray[i3] = decodedGeometry.charCodeAt(i3);
35958             }
35959             const tile = new VectorTile(new Pbf(uintArray.buffer));
35960             const layer = tile.layers["mpy-or"];
35961             const geometries = layer.feature(0).loadGeometry();
35962             const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
35963             tag = new mapillary.OutlineTag(
35964               data.id,
35965               new mapillary.PolygonGeometry(polygon2[0]),
35966               {
35967                 text,
35968                 textColor: color2,
35969                 lineColor: color2,
35970                 lineWidth: 2,
35971                 fillColor: color2,
35972                 fillOpacity: 0.3
35973               }
35974             );
35975             return tag;
35976           }
35977         },
35978         // Return the current cache
35979         cache: function() {
35980           return _mlyCache;
35981         }
35982       };
35983     }
35984   });
35985
35986   // modules/services/maprules.js
35987   var maprules_exports = {};
35988   __export(maprules_exports, {
35989     default: () => maprules_default
35990   });
35991   var buildRuleChecks, buildLineKeys, maprules_default;
35992   var init_maprules = __esm({
35993     "modules/services/maprules.js"() {
35994       "use strict";
35995       init_tags();
35996       init_util();
35997       init_validation();
35998       buildRuleChecks = function() {
35999         return {
36000           equals: function(equals) {
36001             return function(tags) {
36002               return Object.keys(equals).every(function(k3) {
36003                 return equals[k3] === tags[k3];
36004               });
36005             };
36006           },
36007           notEquals: function(notEquals) {
36008             return function(tags) {
36009               return Object.keys(notEquals).some(function(k3) {
36010                 return notEquals[k3] !== tags[k3];
36011               });
36012             };
36013           },
36014           absence: function(absence) {
36015             return function(tags) {
36016               return Object.keys(tags).indexOf(absence) === -1;
36017             };
36018           },
36019           presence: function(presence) {
36020             return function(tags) {
36021               return Object.keys(tags).indexOf(presence) > -1;
36022             };
36023           },
36024           greaterThan: function(greaterThan) {
36025             var key = Object.keys(greaterThan)[0];
36026             var value = greaterThan[key];
36027             return function(tags) {
36028               return tags[key] > value;
36029             };
36030           },
36031           greaterThanEqual: function(greaterThanEqual) {
36032             var key = Object.keys(greaterThanEqual)[0];
36033             var value = greaterThanEqual[key];
36034             return function(tags) {
36035               return tags[key] >= value;
36036             };
36037           },
36038           lessThan: function(lessThan) {
36039             var key = Object.keys(lessThan)[0];
36040             var value = lessThan[key];
36041             return function(tags) {
36042               return tags[key] < value;
36043             };
36044           },
36045           lessThanEqual: function(lessThanEqual) {
36046             var key = Object.keys(lessThanEqual)[0];
36047             var value = lessThanEqual[key];
36048             return function(tags) {
36049               return tags[key] <= value;
36050             };
36051           },
36052           positiveRegex: function(positiveRegex) {
36053             var tagKey = Object.keys(positiveRegex)[0];
36054             var expression = positiveRegex[tagKey].join("|");
36055             var regex = new RegExp(expression);
36056             return function(tags) {
36057               return regex.test(tags[tagKey]);
36058             };
36059           },
36060           negativeRegex: function(negativeRegex) {
36061             var tagKey = Object.keys(negativeRegex)[0];
36062             var expression = negativeRegex[tagKey].join("|");
36063             var regex = new RegExp(expression);
36064             return function(tags) {
36065               return !regex.test(tags[tagKey]);
36066             };
36067           }
36068         };
36069       };
36070       buildLineKeys = function() {
36071         return {
36072           highway: {
36073             rest_area: true,
36074             services: true
36075           },
36076           railway: {
36077             roundhouse: true,
36078             station: true,
36079             traverser: true,
36080             turntable: true,
36081             wash: true
36082           }
36083         };
36084       };
36085       maprules_default = {
36086         init: function() {
36087           this._ruleChecks = buildRuleChecks();
36088           this._validationRules = [];
36089           this._areaKeys = osmAreaKeys;
36090           this._lineKeys = buildLineKeys();
36091         },
36092         // list of rules only relevant to tag checks...
36093         filterRuleChecks: function(selector) {
36094           var _ruleChecks = this._ruleChecks;
36095           return Object.keys(selector).reduce(function(rules, key) {
36096             if (["geometry", "error", "warning"].indexOf(key) === -1) {
36097               rules.push(_ruleChecks[key](selector[key]));
36098             }
36099             return rules;
36100           }, []);
36101         },
36102         // builds tagMap from mapcss-parse selector object...
36103         buildTagMap: function(selector) {
36104           var getRegexValues = function(regexes) {
36105             return regexes.map(function(regex) {
36106               return regex.replace(/\$|\^/g, "");
36107             });
36108           };
36109           var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
36110             var values;
36111             var isRegex = /regex/gi.test(key);
36112             var isEqual2 = /equals/gi.test(key);
36113             if (isRegex || isEqual2) {
36114               Object.keys(selector[key]).forEach(function(selectorKey) {
36115                 values = isEqual2 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
36116                 if (expectedTags.hasOwnProperty(selectorKey)) {
36117                   values = values.concat(expectedTags[selectorKey]);
36118                 }
36119                 expectedTags[selectorKey] = values;
36120               });
36121             } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
36122               var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
36123               values = [selector[key][tagKey]];
36124               if (expectedTags.hasOwnProperty(tagKey)) {
36125                 values = values.concat(expectedTags[tagKey]);
36126               }
36127               expectedTags[tagKey] = values;
36128             }
36129             return expectedTags;
36130           }, {});
36131           return tagMap;
36132         },
36133         // inspired by osmWay#isArea()
36134         inferGeometry: function(tagMap) {
36135           var _lineKeys = this._lineKeys;
36136           var _areaKeys = this._areaKeys;
36137           var keyValueDoesNotImplyArea = function(key2) {
36138             return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
36139           };
36140           var keyValueImpliesLine = function(key2) {
36141             return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
36142           };
36143           if (tagMap.hasOwnProperty("area")) {
36144             if (tagMap.area.indexOf("yes") > -1) {
36145               return "area";
36146             }
36147             if (tagMap.area.indexOf("no") > -1) {
36148               return "line";
36149             }
36150           }
36151           for (var key in tagMap) {
36152             if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
36153               return "area";
36154             }
36155             if (key in _lineKeys && keyValueImpliesLine(key)) {
36156               return "area";
36157             }
36158           }
36159           return "line";
36160         },
36161         // adds from mapcss-parse selector check...
36162         addRule: function(selector) {
36163           var rule = {
36164             // checks relevant to mapcss-selector
36165             checks: this.filterRuleChecks(selector),
36166             // true if all conditions for a tag error are true..
36167             matches: function(entity) {
36168               return this.checks.every(function(check) {
36169                 return check(entity.tags);
36170               });
36171             },
36172             // borrowed from Way#isArea()
36173             inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
36174             geometryMatches: function(entity, graph) {
36175               if (entity.type === "node" || entity.type === "relation") {
36176                 return selector.geometry === entity.type;
36177               } else if (entity.type === "way") {
36178                 return this.inferredGeometry === entity.geometry(graph);
36179               }
36180             },
36181             // when geometries match and tag matches are present, return a warning...
36182             findIssues: function(entity, graph, issues) {
36183               if (this.geometryMatches(entity, graph) && this.matches(entity)) {
36184                 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
36185                 var message = selector[severity];
36186                 issues.push(new validationIssue({
36187                   type: "maprules",
36188                   severity,
36189                   message: function() {
36190                     return message;
36191                   },
36192                   entityIds: [entity.id]
36193                 }));
36194               }
36195             }
36196           };
36197           this._validationRules.push(rule);
36198         },
36199         clearRules: function() {
36200           this._validationRules = [];
36201         },
36202         // returns validationRules...
36203         validationRules: function() {
36204           return this._validationRules;
36205         },
36206         // returns ruleChecks
36207         ruleChecks: function() {
36208           return this._ruleChecks;
36209         }
36210       };
36211     }
36212   });
36213
36214   // modules/services/nominatim.js
36215   var nominatim_exports = {};
36216   __export(nominatim_exports, {
36217     default: () => nominatim_default
36218   });
36219   var apibase, _inflight, _nominatimCache, nominatim_default;
36220   var init_nominatim = __esm({
36221     "modules/services/nominatim.js"() {
36222       "use strict";
36223       init_src18();
36224       init_rbush();
36225       init_geo2();
36226       init_util();
36227       init_core();
36228       init_id();
36229       apibase = nominatimApiUrl;
36230       _inflight = {};
36231       nominatim_default = {
36232         init: function() {
36233           _inflight = {};
36234           _nominatimCache = new RBush();
36235         },
36236         reset: function() {
36237           Object.values(_inflight).forEach(function(controller) {
36238             controller.abort();
36239           });
36240           _inflight = {};
36241           _nominatimCache = new RBush();
36242         },
36243         countryCode: function(location, callback) {
36244           this.reverse(location, function(err, result) {
36245             if (err) {
36246               return callback(err);
36247             } else if (result.address) {
36248               return callback(null, result.address.country_code);
36249             } else {
36250               return callback("Unable to geocode", null);
36251             }
36252           });
36253         },
36254         reverse: function(loc, callback) {
36255           var cached = _nominatimCache.search(
36256             { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
36257           );
36258           if (cached.length > 0) {
36259             if (callback) callback(null, cached[0].data);
36260             return;
36261           }
36262           var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
36263           var url = apibase + "reverse?" + utilQsString(params);
36264           if (_inflight[url]) return;
36265           var controller = new AbortController();
36266           _inflight[url] = controller;
36267           json_default(url, {
36268             signal: controller.signal,
36269             headers: {
36270               "Accept-Language": _mainLocalizer.localeCodes().join(",")
36271             }
36272           }).then(function(result) {
36273             delete _inflight[url];
36274             if (result && result.error) {
36275               throw new Error(result.error);
36276             }
36277             var extent = geoExtent(loc).padByMeters(200);
36278             _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
36279             if (callback) callback(null, result);
36280           }).catch(function(err) {
36281             delete _inflight[url];
36282             if (err.name === "AbortError") return;
36283             if (callback) callback(err.message);
36284           });
36285         },
36286         search: function(val, callback) {
36287           const params = {
36288             q: val,
36289             limit: 10,
36290             format: "json"
36291           };
36292           var url = apibase + "search?" + utilQsString(params);
36293           if (_inflight[url]) return;
36294           var controller = new AbortController();
36295           _inflight[url] = controller;
36296           json_default(url, {
36297             signal: controller.signal,
36298             headers: {
36299               "Accept-Language": _mainLocalizer.localeCodes().join(",")
36300             }
36301           }).then(function(result) {
36302             delete _inflight[url];
36303             if (result && result.error) {
36304               throw new Error(result.error);
36305             }
36306             if (callback) callback(null, result);
36307           }).catch(function(err) {
36308             delete _inflight[url];
36309             if (err.name === "AbortError") return;
36310             if (callback) callback(err.message);
36311           });
36312         }
36313       };
36314     }
36315   });
36316
36317   // node_modules/name-suggestion-index/lib/simplify.js
36318   function simplify(str) {
36319     if (typeof str !== "string") return "";
36320     return import_diacritics.default.remove(
36321       str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
36322     );
36323   }
36324   var import_diacritics;
36325   var init_simplify = __esm({
36326     "node_modules/name-suggestion-index/lib/simplify.js"() {
36327       import_diacritics = __toESM(require_diacritics(), 1);
36328     }
36329   });
36330
36331   // node_modules/name-suggestion-index/config/matchGroups.json
36332   var matchGroups_default;
36333   var init_matchGroups = __esm({
36334     "node_modules/name-suggestion-index/config/matchGroups.json"() {
36335       matchGroups_default = {
36336         matchGroups: {
36337           adult_gaming_centre: [
36338             "amenity/casino",
36339             "amenity/gambling",
36340             "leisure/adult_gaming_centre"
36341           ],
36342           bar: [
36343             "amenity/bar",
36344             "amenity/pub",
36345             "amenity/restaurant"
36346           ],
36347           beauty: [
36348             "shop/beauty",
36349             "shop/hairdresser_supply"
36350           ],
36351           bed: [
36352             "shop/bed",
36353             "shop/furniture"
36354           ],
36355           beverages: [
36356             "shop/alcohol",
36357             "shop/beer",
36358             "shop/beverages",
36359             "shop/kiosk",
36360             "shop/wine"
36361           ],
36362           camping: [
36363             "tourism/camp_site",
36364             "tourism/caravan_site"
36365           ],
36366           car_parts: [
36367             "shop/car_parts",
36368             "shop/car_repair",
36369             "shop/tires",
36370             "shop/tyres"
36371           ],
36372           clinic: [
36373             "amenity/clinic",
36374             "amenity/doctors",
36375             "healthcare/clinic",
36376             "healthcare/laboratory",
36377             "healthcare/physiotherapist",
36378             "healthcare/sample_collection",
36379             "healthcare/dialysis"
36380           ],
36381           convenience: [
36382             "shop/beauty",
36383             "shop/chemist",
36384             "shop/convenience",
36385             "shop/cosmetics",
36386             "shop/grocery",
36387             "shop/kiosk",
36388             "shop/newsagent",
36389             "shop/perfumery"
36390           ],
36391           coworking: [
36392             "amenity/coworking_space",
36393             "office/coworking",
36394             "office/coworking_space"
36395           ],
36396           dentist: [
36397             "amenity/dentist",
36398             "amenity/doctors",
36399             "healthcare/dentist"
36400           ],
36401           electronics: [
36402             "office/telecommunication",
36403             "shop/appliance",
36404             "shop/computer",
36405             "shop/electronics",
36406             "shop/hifi",
36407             "shop/kiosk",
36408             "shop/mobile",
36409             "shop/mobile_phone",
36410             "shop/telecommunication",
36411             "shop/video_games"
36412           ],
36413           estate_agents: [
36414             "office/estate_agent",
36415             "shop/estate_agent",
36416             "office/mortgage",
36417             "office/financial"
36418           ],
36419           fabric: [
36420             "shop/fabric",
36421             "shop/haberdashery",
36422             "shop/sewing"
36423           ],
36424           fashion: [
36425             "shop/accessories",
36426             "shop/bag",
36427             "shop/boutique",
36428             "shop/clothes",
36429             "shop/department_store",
36430             "shop/fashion",
36431             "shop/fashion_accessories",
36432             "shop/sports",
36433             "shop/shoes"
36434           ],
36435           financial: [
36436             "amenity/bank",
36437             "office/accountant",
36438             "office/financial",
36439             "office/financial_advisor",
36440             "office/tax_advisor",
36441             "shop/tax"
36442           ],
36443           fitness: [
36444             "leisure/fitness_centre",
36445             "leisure/fitness_center",
36446             "leisure/sports_centre",
36447             "leisure/sports_center"
36448           ],
36449           food: [
36450             "amenity/cafe",
36451             "amenity/fast_food",
36452             "amenity/ice_cream",
36453             "amenity/restaurant",
36454             "shop/bakery",
36455             "shop/candy",
36456             "shop/chocolate",
36457             "shop/coffee",
36458             "shop/confectionary",
36459             "shop/confectionery",
36460             "shop/deli",
36461             "shop/food",
36462             "shop/kiosk",
36463             "shop/ice_cream",
36464             "shop/pastry",
36465             "shop/tea"
36466           ],
36467           fuel: [
36468             "amenity/fuel",
36469             "shop/gas",
36470             "shop/convenience;gas",
36471             "shop/gas;convenience"
36472           ],
36473           gift: [
36474             "shop/gift",
36475             "shop/card",
36476             "shop/cards",
36477             "shop/kiosk",
36478             "shop/stationery"
36479           ],
36480           glass: [
36481             "craft/window_construction",
36482             "craft/glaziery",
36483             "shop/car_repair"
36484           ],
36485           hardware: [
36486             "shop/bathroom_furnishing",
36487             "shop/carpet",
36488             "shop/diy",
36489             "shop/doityourself",
36490             "shop/doors",
36491             "shop/electrical",
36492             "shop/flooring",
36493             "shop/hardware",
36494             "shop/hardware_store",
36495             "shop/power_tools",
36496             "shop/tool_hire",
36497             "shop/tools",
36498             "shop/trade"
36499           ],
36500           health_food: [
36501             "shop/health",
36502             "shop/health_food",
36503             "shop/herbalist",
36504             "shop/nutrition_supplements"
36505           ],
36506           hobby: [
36507             "shop/electronics",
36508             "shop/hobby",
36509             "shop/books",
36510             "shop/games",
36511             "shop/collector",
36512             "shop/toys",
36513             "shop/model",
36514             "shop/video_games",
36515             "shop/anime"
36516           ],
36517           hospital: [
36518             "amenity/doctors",
36519             "amenity/hospital",
36520             "healthcare/hospital"
36521           ],
36522           houseware: [
36523             "shop/houseware",
36524             "shop/interior_decoration"
36525           ],
36526           water_rescue: [
36527             "amenity/lifeboat_station",
36528             "emergency/lifeboat_station",
36529             "emergency/marine_rescue",
36530             "emergency/water_rescue"
36531           ],
36532           locksmith: [
36533             "craft/key_cutter",
36534             "craft/locksmith",
36535             "shop/locksmith"
36536           ],
36537           lodging: [
36538             "tourism/guest_house",
36539             "tourism/hotel",
36540             "tourism/motel"
36541           ],
36542           money_transfer: [
36543             "amenity/money_transfer",
36544             "shop/money_transfer"
36545           ],
36546           music: ["shop/music", "shop/musical_instrument"],
36547           office_supplies: [
36548             "shop/office_supplies",
36549             "shop/stationary",
36550             "shop/stationery"
36551           ],
36552           outdoor: [
36553             "shop/clothes",
36554             "shop/outdoor",
36555             "shop/sports"
36556           ],
36557           parcel_locker: [
36558             "amenity/parcel_locker",
36559             "amenity/vending_machine"
36560           ],
36561           pharmacy: [
36562             "amenity/doctors",
36563             "amenity/pharmacy",
36564             "healthcare/pharmacy",
36565             "shop/chemist"
36566           ],
36567           playground: [
36568             "amenity/theme_park",
36569             "leisure/amusement_arcade",
36570             "leisure/playground"
36571           ],
36572           rental: [
36573             "amenity/bicycle_rental",
36574             "amenity/boat_rental",
36575             "amenity/car_rental",
36576             "amenity/truck_rental",
36577             "amenity/vehicle_rental",
36578             "shop/kiosk",
36579             "shop/plant_hire",
36580             "shop/rental",
36581             "shop/tool_hire"
36582           ],
36583           school: [
36584             "amenity/childcare",
36585             "amenity/college",
36586             "amenity/kindergarten",
36587             "amenity/language_school",
36588             "amenity/prep_school",
36589             "amenity/school",
36590             "amenity/university"
36591           ],
36592           storage: [
36593             "shop/storage_units",
36594             "shop/storage_rental"
36595           ],
36596           substation: [
36597             "power/station",
36598             "power/substation",
36599             "power/sub_station"
36600           ],
36601           supermarket: [
36602             "shop/food",
36603             "shop/frozen_food",
36604             "shop/greengrocer",
36605             "shop/grocery",
36606             "shop/supermarket",
36607             "shop/wholesale"
36608           ],
36609           thrift: [
36610             "shop/charity",
36611             "shop/clothes",
36612             "shop/second_hand"
36613           ],
36614           tobacco: [
36615             "shop/e-cigarette",
36616             "shop/tobacco"
36617           ],
36618           variety_store: [
36619             "shop/variety_store",
36620             "shop/discount",
36621             "shop/convenience"
36622           ],
36623           vending: [
36624             "amenity/vending_machine",
36625             "shop/kiosk",
36626             "shop/vending_machine"
36627           ],
36628           weight_loss: [
36629             "amenity/clinic",
36630             "amenity/doctors",
36631             "amenity/weight_clinic",
36632             "healthcare/counselling",
36633             "leisure/fitness_centre",
36634             "office/therapist",
36635             "shop/beauty",
36636             "shop/diet",
36637             "shop/food",
36638             "shop/health_food",
36639             "shop/herbalist",
36640             "shop/nutrition",
36641             "shop/nutrition_supplements",
36642             "shop/weight_loss"
36643           ],
36644           wholesale: [
36645             "shop/wholesale",
36646             "shop/supermarket",
36647             "shop/department_store"
36648           ]
36649         }
36650       };
36651     }
36652   });
36653
36654   // node_modules/name-suggestion-index/config/genericWords.json
36655   var genericWords_default;
36656   var init_genericWords = __esm({
36657     "node_modules/name-suggestion-index/config/genericWords.json"() {
36658       genericWords_default = {
36659         genericWords: [
36660           "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
36661           "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
36662           "^(club|green|out|ware)\\s?house$",
36663           "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
36664           "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
36665           "^(hofladen|librairie|magazine?|maison|toko)$",
36666           "^(mobile home|skate)?\\s?park$",
36667           "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
36668           "^\\?+$",
36669           "^private$",
36670           "^tattoo( studio)?$",
36671           "^windmill$",
36672           "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
36673         ]
36674       };
36675     }
36676   });
36677
36678   // node_modules/name-suggestion-index/config/trees.json
36679   var trees_default;
36680   var init_trees = __esm({
36681     "node_modules/name-suggestion-index/config/trees.json"() {
36682       trees_default = {
36683         trees: {
36684           brands: {
36685             emoji: "\u{1F354}",
36686             mainTag: "brand:wikidata",
36687             sourceTags: ["brand", "name"],
36688             nameTags: {
36689               primary: "^(name|name:\\w+)$",
36690               alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
36691             }
36692           },
36693           flags: {
36694             emoji: "\u{1F6A9}",
36695             mainTag: "flag:wikidata",
36696             nameTags: {
36697               primary: "^(flag:name|flag:name:\\w+)$",
36698               alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
36699             }
36700           },
36701           operators: {
36702             emoji: "\u{1F4BC}",
36703             mainTag: "operator:wikidata",
36704             sourceTags: ["operator"],
36705             nameTags: {
36706               primary: "^(name|name:\\w+|operator|operator:\\w+)$",
36707               alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
36708             }
36709           },
36710           transit: {
36711             emoji: "\u{1F687}",
36712             mainTag: "network:wikidata",
36713             sourceTags: ["network"],
36714             nameTags: {
36715               primary: "^network$",
36716               alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
36717             }
36718           }
36719         }
36720       };
36721     }
36722   });
36723
36724   // node_modules/name-suggestion-index/lib/matcher.js
36725   var import_which_polygon3, matchGroups, trees, Matcher;
36726   var init_matcher2 = __esm({
36727     "node_modules/name-suggestion-index/lib/matcher.js"() {
36728       import_which_polygon3 = __toESM(require_which_polygon(), 1);
36729       init_simplify();
36730       init_matchGroups();
36731       init_genericWords();
36732       init_trees();
36733       matchGroups = matchGroups_default.matchGroups;
36734       trees = trees_default.trees;
36735       Matcher = class {
36736         //
36737         // `constructor`
36738         // initialize the genericWords regexes
36739         constructor() {
36740           this.matchIndex = void 0;
36741           this.genericWords = /* @__PURE__ */ new Map();
36742           (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
36743           this.itemLocation = void 0;
36744           this.locationSets = void 0;
36745           this.locationIndex = void 0;
36746           this.warnings = [];
36747         }
36748         //
36749         // `buildMatchIndex()`
36750         // Call this to prepare the matcher for use
36751         //
36752         // `data` needs to be an Object indexed on a 'tree/key/value' path.
36753         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
36754         // {
36755         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
36756         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
36757         //    …
36758         // }
36759         //
36760         buildMatchIndex(data) {
36761           const that = this;
36762           if (that.matchIndex) return;
36763           that.matchIndex = /* @__PURE__ */ new Map();
36764           const seenTree = /* @__PURE__ */ new Map();
36765           Object.keys(data).forEach((tkv) => {
36766             const category = data[tkv];
36767             const parts = tkv.split("/", 3);
36768             const t2 = parts[0];
36769             const k3 = parts[1];
36770             const v3 = parts[2];
36771             const thiskv = `${k3}/${v3}`;
36772             const tree = trees[t2];
36773             let branch = that.matchIndex.get(thiskv);
36774             if (!branch) {
36775               branch = {
36776                 primary: /* @__PURE__ */ new Map(),
36777                 alternate: /* @__PURE__ */ new Map(),
36778                 excludeGeneric: /* @__PURE__ */ new Map(),
36779                 excludeNamed: /* @__PURE__ */ new Map()
36780               };
36781               that.matchIndex.set(thiskv, branch);
36782             }
36783             const properties = category.properties || {};
36784             const exclude = properties.exclude || {};
36785             (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
36786             (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
36787             const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
36788             let items = category.items;
36789             if (!Array.isArray(items) || !items.length) return;
36790             const primaryName = new RegExp(tree.nameTags.primary, "i");
36791             const alternateName = new RegExp(tree.nameTags.alternate, "i");
36792             const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
36793             const skipGenericKV = skipGenericKVMatches(t2, k3, v3);
36794             const genericKV = /* @__PURE__ */ new Set([`${k3}/yes`, `building/yes`]);
36795             const matchGroupKV = /* @__PURE__ */ new Set();
36796             Object.values(matchGroups).forEach((matchGroup) => {
36797               const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
36798               if (!inGroup) return;
36799               matchGroup.forEach((otherkv) => {
36800                 if (otherkv === thiskv) return;
36801                 matchGroupKV.add(otherkv);
36802                 const otherk = otherkv.split("/", 2)[0];
36803                 genericKV.add(`${otherk}/yes`);
36804               });
36805             });
36806             items.forEach((item) => {
36807               if (!item.id) return;
36808               if (Array.isArray(item.matchTags) && item.matchTags.length) {
36809                 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && matchTag !== thiskv && !genericKV.has(matchTag));
36810                 if (!item.matchTags.length) delete item.matchTags;
36811               }
36812               let kvTags = [`${thiskv}`].concat(item.matchTags || []);
36813               if (!skipGenericKV) {
36814                 kvTags = kvTags.concat(Array.from(genericKV));
36815               }
36816               Object.keys(item.tags).forEach((osmkey) => {
36817                 if (notName.test(osmkey)) return;
36818                 const osmvalue = item.tags[osmkey];
36819                 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
36820                 if (primaryName.test(osmkey)) {
36821                   kvTags.forEach((kv) => insertName("primary", t2, kv, simplify(osmvalue), item.id));
36822                 } else if (alternateName.test(osmkey)) {
36823                   kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify(osmvalue), item.id));
36824                 }
36825               });
36826               let keepMatchNames = /* @__PURE__ */ new Set();
36827               (item.matchNames || []).forEach((matchName) => {
36828                 const nsimple = simplify(matchName);
36829                 kvTags.forEach((kv) => {
36830                   const branch2 = that.matchIndex.get(kv);
36831                   const primaryLeaf = branch2 && branch2.primary.get(nsimple);
36832                   const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
36833                   const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
36834                   const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
36835                   if (!inPrimary && !inAlternate) {
36836                     insertName("alternate", t2, kv, nsimple, item.id);
36837                     keepMatchNames.add(matchName);
36838                   }
36839                 });
36840               });
36841               if (keepMatchNames.size) {
36842                 item.matchNames = Array.from(keepMatchNames);
36843               } else {
36844                 delete item.matchNames;
36845               }
36846             });
36847           });
36848           function insertName(which, t2, kv, nsimple, itemID) {
36849             if (!nsimple) {
36850               that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
36851               return;
36852             }
36853             let branch = that.matchIndex.get(kv);
36854             if (!branch) {
36855               branch = {
36856                 primary: /* @__PURE__ */ new Map(),
36857                 alternate: /* @__PURE__ */ new Map(),
36858                 excludeGeneric: /* @__PURE__ */ new Map(),
36859                 excludeNamed: /* @__PURE__ */ new Map()
36860               };
36861               that.matchIndex.set(kv, branch);
36862             }
36863             let leaf = branch[which].get(nsimple);
36864             if (!leaf) {
36865               leaf = /* @__PURE__ */ new Set();
36866               branch[which].set(nsimple, leaf);
36867             }
36868             leaf.add(itemID);
36869             if (!/yes$/.test(kv)) {
36870               const kvnsimple = `${kv}/${nsimple}`;
36871               const existing = seenTree.get(kvnsimple);
36872               if (existing && existing !== t2) {
36873                 const items = Array.from(leaf);
36874                 that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
36875                 return;
36876               }
36877               seenTree.set(kvnsimple, t2);
36878             }
36879           }
36880           function skipGenericKVMatches(t2, k3, v3) {
36881             return t2 === "flags" || t2 === "transit" || k3 === "landuse" || v3 === "atm" || v3 === "bicycle_parking" || v3 === "car_sharing" || v3 === "caravan_site" || v3 === "charging_station" || v3 === "dog_park" || v3 === "parking" || v3 === "phone" || v3 === "playground" || v3 === "post_box" || v3 === "public_bookcase" || v3 === "recycling" || v3 === "vending_machine";
36882           }
36883         }
36884         //
36885         // `buildLocationIndex()`
36886         // Call this to prepare a which-polygon location index.
36887         // This *resolves* all the locationSets into GeoJSON, which takes some time.
36888         // You can skip this step if you don't care about matching within a location.
36889         //
36890         // `data` needs to be an Object indexed on a 'tree/key/value' path.
36891         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
36892         // {
36893         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
36894         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
36895         //    …
36896         // }
36897         //
36898         buildLocationIndex(data, loco) {
36899           const that = this;
36900           if (that.locationIndex) return;
36901           that.itemLocation = /* @__PURE__ */ new Map();
36902           that.locationSets = /* @__PURE__ */ new Map();
36903           Object.keys(data).forEach((tkv) => {
36904             const items = data[tkv].items;
36905             if (!Array.isArray(items) || !items.length) return;
36906             items.forEach((item) => {
36907               if (that.itemLocation.has(item.id)) return;
36908               let resolved;
36909               try {
36910                 resolved = loco.resolveLocationSet(item.locationSet);
36911               } catch (err) {
36912                 console.warn(`buildLocationIndex: ${err.message}`);
36913               }
36914               if (!resolved || !resolved.id) return;
36915               that.itemLocation.set(item.id, resolved.id);
36916               if (that.locationSets.has(resolved.id)) return;
36917               let feature3 = _cloneDeep2(resolved.feature);
36918               feature3.id = resolved.id;
36919               feature3.properties.id = resolved.id;
36920               if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
36921                 console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
36922                 console.warn(JSON.stringify(feature3));
36923                 return;
36924               }
36925               that.locationSets.set(resolved.id, feature3);
36926             });
36927           });
36928           that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
36929           function _cloneDeep2(obj) {
36930             return JSON.parse(JSON.stringify(obj));
36931           }
36932         }
36933         //
36934         // `match()`
36935         // Pass parts and return an Array of matches.
36936         // `k` - key
36937         // `v` - value
36938         // `n` - namelike
36939         // `loc` - optional - [lon,lat] location to search
36940         //
36941         // 1. If the [k,v,n] tuple matches a canonical item…
36942         // Return an Array of match results.
36943         // Each result will include the area in km² that the item is valid.
36944         //
36945         // Order of results:
36946         // Primary ordering will be on the "match" column:
36947         //   "primary" - where the query matches the `name` tag, followed by
36948         //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
36949         // Secondary ordering will be on the "area" column:
36950         //   "area descending" if no location was provided, (worldwide before local)
36951         //   "area ascending" if location was provided (local before worldwide)
36952         //
36953         // [
36954         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
36955         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
36956         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
36957         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
36958         //   …
36959         // ]
36960         //
36961         // -or-
36962         //
36963         // 2. If the [k,v,n] tuple matches an exclude pattern…
36964         // Return an Array with a single exclude result, either
36965         //
36966         // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
36967         //   or
36968         // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
36969         //
36970         // About results
36971         //   "generic" - a generic word that is probably not really a name.
36972         //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
36973         //   "named" - a real name like "Kebabai" that is just common, but not a brand.
36974         //     For these, iD should just let it be. We don't include these in NSI, but we don't want to nag users about it either.
36975         //
36976         // -or-
36977         //
36978         // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
36979         //
36980         //
36981         match(k3, v3, n3, loc) {
36982           const that = this;
36983           if (!that.matchIndex) {
36984             throw new Error("match:  matchIndex not built.");
36985           }
36986           let matchLocations;
36987           if (Array.isArray(loc) && that.locationIndex) {
36988             matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
36989           }
36990           const nsimple = simplify(n3);
36991           let seen = /* @__PURE__ */ new Set();
36992           let results = [];
36993           gatherResults("primary");
36994           gatherResults("alternate");
36995           if (results.length) return results;
36996           gatherResults("exclude");
36997           return results.length ? results : null;
36998           function gatherResults(which) {
36999             const kv = `${k3}/${v3}`;
37000             let didMatch = tryMatch(which, kv);
37001             if (didMatch) return;
37002             for (let mg in matchGroups) {
37003               const matchGroup = matchGroups[mg];
37004               const inGroup = matchGroup.some((otherkv) => otherkv === kv);
37005               if (!inGroup) continue;
37006               for (let i3 = 0; i3 < matchGroup.length; i3++) {
37007                 const otherkv = matchGroup[i3];
37008                 if (otherkv === kv) continue;
37009                 didMatch = tryMatch(which, otherkv);
37010                 if (didMatch) return;
37011               }
37012             }
37013             if (which === "exclude") {
37014               const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
37015               if (regex) {
37016                 results.push({ match: "excludeGeneric", pattern: String(regex) });
37017                 return;
37018               }
37019             }
37020           }
37021           function tryMatch(which, kv) {
37022             const branch = that.matchIndex.get(kv);
37023             if (!branch) return;
37024             if (which === "exclude") {
37025               let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
37026               if (regex) {
37027                 results.push({ match: "excludeNamed", pattern: String(regex), kv });
37028                 return;
37029               }
37030               regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
37031               if (regex) {
37032                 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
37033                 return;
37034               }
37035               return;
37036             }
37037             const leaf = branch[which].get(nsimple);
37038             if (!leaf || !leaf.size) return;
37039             let hits = Array.from(leaf).map((itemID) => {
37040               let area = Infinity;
37041               if (that.itemLocation && that.locationSets) {
37042                 const location = that.locationSets.get(that.itemLocation.get(itemID));
37043                 area = location && location.properties.area || Infinity;
37044               }
37045               return { match: which, itemID, area, kv, nsimple };
37046             });
37047             let sortFn = byAreaDescending;
37048             if (matchLocations) {
37049               hits = hits.filter(isValidLocation);
37050               sortFn = byAreaAscending;
37051             }
37052             if (!hits.length) return;
37053             hits.sort(sortFn).forEach((hit) => {
37054               if (seen.has(hit.itemID)) return;
37055               seen.add(hit.itemID);
37056               results.push(hit);
37057             });
37058             return true;
37059             function isValidLocation(hit) {
37060               if (!that.itemLocation) return true;
37061               return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
37062             }
37063             function byAreaAscending(hitA, hitB) {
37064               return hitA.area - hitB.area;
37065             }
37066             function byAreaDescending(hitA, hitB) {
37067               return hitB.area - hitA.area;
37068             }
37069           }
37070         }
37071         //
37072         // `getWarnings()`
37073         // Return any warnings discovered when buiding the index.
37074         // (currently this does nothing)
37075         //
37076         getWarnings() {
37077           return this.warnings;
37078         }
37079       };
37080     }
37081   });
37082
37083   // node_modules/name-suggestion-index/lib/stemmer.js
37084   var init_stemmer = __esm({
37085     "node_modules/name-suggestion-index/lib/stemmer.js"() {
37086       init_simplify();
37087     }
37088   });
37089
37090   // node_modules/name-suggestion-index/index.mjs
37091   var init_name_suggestion_index = __esm({
37092     "node_modules/name-suggestion-index/index.mjs"() {
37093       init_matcher2();
37094       init_simplify();
37095       init_stemmer();
37096     }
37097   });
37098
37099   // modules/services/nsi.js
37100   var nsi_exports = {};
37101   __export(nsi_exports, {
37102     default: () => nsi_default
37103   });
37104   function setNsiSources() {
37105     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
37106     const v3 = (0, import_vparse.default)(nsiVersion);
37107     const vMinor = `${v3.major}.${v3.minor}`;
37108     const cdn = nsiCdnUrl.replace("{version}", vMinor);
37109     const sources = {
37110       "nsi_data": cdn + "dist/nsi.min.json",
37111       "nsi_dissolved": cdn + "dist/dissolved.min.json",
37112       "nsi_features": cdn + "dist/featureCollection.min.json",
37113       "nsi_generics": cdn + "dist/genericWords.min.json",
37114       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
37115       "nsi_replacements": cdn + "dist/replacements.min.json",
37116       "nsi_trees": cdn + "dist/trees.min.json"
37117     };
37118     let fileMap = _mainFileFetcher.fileMap();
37119     for (const k3 in sources) {
37120       if (!fileMap[k3]) fileMap[k3] = sources[k3];
37121     }
37122   }
37123   function loadNsiPresets() {
37124     return Promise.all([
37125       _mainFileFetcher.get("nsi_presets"),
37126       _mainFileFetcher.get("nsi_features")
37127     ]).then((vals) => {
37128       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
37129       Object.values(vals[0].presets).forEach((preset) => {
37130         if (preset.tags["brand:wikidata"]) {
37131           preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37132         }
37133         if (preset.tags["operator:wikidata"]) {
37134           preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37135         }
37136         if (preset.tags["network:wikidata"]) {
37137           preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
37138         }
37139       });
37140       _mainPresetIndex.merge({
37141         presets: vals[0].presets,
37142         featureCollection: vals[1]
37143       });
37144     });
37145   }
37146   function loadNsiData() {
37147     return Promise.all([
37148       _mainFileFetcher.get("nsi_data"),
37149       _mainFileFetcher.get("nsi_dissolved"),
37150       _mainFileFetcher.get("nsi_replacements"),
37151       _mainFileFetcher.get("nsi_trees")
37152     ]).then((vals) => {
37153       _nsi = {
37154         data: vals[0].nsi,
37155         // the raw name-suggestion-index data
37156         dissolved: vals[1].dissolved,
37157         // list of dissolved items
37158         replacements: vals[2].replacements,
37159         // trivial old->new qid replacements
37160         trees: vals[3].trees,
37161         // metadata about trees, main tags
37162         kvt: /* @__PURE__ */ new Map(),
37163         // Map (k -> Map (v -> t) )
37164         qids: /* @__PURE__ */ new Map(),
37165         // Map (wd/wp tag values -> qids)
37166         ids: /* @__PURE__ */ new Map()
37167         // Map (id -> NSI item)
37168       };
37169       const matcher = _nsi.matcher = new Matcher();
37170       matcher.buildMatchIndex(_nsi.data);
37171       matcher.itemLocation = /* @__PURE__ */ new Map();
37172       matcher.locationSets = /* @__PURE__ */ new Map();
37173       Object.keys(_nsi.data).forEach((tkv) => {
37174         const items = _nsi.data[tkv].items;
37175         if (!Array.isArray(items) || !items.length) return;
37176         items.forEach((item) => {
37177           if (matcher.itemLocation.has(item.id)) return;
37178           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
37179           matcher.itemLocation.set(item.id, locationSetID);
37180           if (matcher.locationSets.has(locationSetID)) return;
37181           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
37182           matcher.locationSets.set(locationSetID, fakeFeature);
37183         });
37184       });
37185       matcher.locationIndex = (bbox2) => {
37186         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
37187         const results = [];
37188         for (const [locationSetID, area] of Object.entries(validHere)) {
37189           const fakeFeature = matcher.locationSets.get(locationSetID);
37190           if (fakeFeature) {
37191             fakeFeature.properties.area = area;
37192             results.push(fakeFeature);
37193           }
37194         }
37195         return results;
37196       };
37197       Object.keys(_nsi.data).forEach((tkv) => {
37198         const category = _nsi.data[tkv];
37199         const parts = tkv.split("/", 3);
37200         const t2 = parts[0];
37201         const k3 = parts[1];
37202         const v3 = parts[2];
37203         let vmap = _nsi.kvt.get(k3);
37204         if (!vmap) {
37205           vmap = /* @__PURE__ */ new Map();
37206           _nsi.kvt.set(k3, vmap);
37207         }
37208         vmap.set(v3, t2);
37209         const tree = _nsi.trees[t2];
37210         const mainTag = tree.mainTag;
37211         const items = category.items || [];
37212         items.forEach((item) => {
37213           item.tkv = tkv;
37214           item.mainTag = mainTag;
37215           _nsi.ids.set(item.id, item);
37216           const wd = item.tags[mainTag];
37217           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
37218           if (wd) _nsi.qids.set(wd, wd);
37219           if (wp && wd) _nsi.qids.set(wp, wd);
37220         });
37221       });
37222     });
37223   }
37224   function gatherKVs(tags) {
37225     let primary = /* @__PURE__ */ new Set();
37226     let alternate = /* @__PURE__ */ new Set();
37227     Object.keys(tags).forEach((osmkey) => {
37228       const osmvalue = tags[osmkey];
37229       if (!osmvalue) return;
37230       if (osmkey === "route_master") osmkey = "route";
37231       const vmap = _nsi.kvt.get(osmkey);
37232       if (!vmap) return;
37233       if (vmap.get(osmvalue)) {
37234         primary.add(`${osmkey}/${osmvalue}`);
37235       } else if (osmvalue === "yes") {
37236         alternate.add(`${osmkey}/${osmvalue}`);
37237       }
37238     });
37239     const preset = _mainPresetIndex.matchTags(tags, "area");
37240     if (buildingPreset[preset.id]) {
37241       alternate.add("building/yes");
37242     }
37243     return { primary, alternate };
37244   }
37245   function identifyTree(tags) {
37246     let unknown;
37247     let t2;
37248     Object.keys(tags).forEach((osmkey) => {
37249       if (t2) return;
37250       const osmvalue = tags[osmkey];
37251       if (!osmvalue) return;
37252       if (osmkey === "route_master") osmkey = "route";
37253       const vmap = _nsi.kvt.get(osmkey);
37254       if (!vmap) return;
37255       if (osmvalue === "yes") {
37256         unknown = "unknown";
37257       } else {
37258         t2 = vmap.get(osmvalue);
37259       }
37260     });
37261     return t2 || unknown || null;
37262   }
37263   function gatherNames(tags) {
37264     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
37265     let primary = /* @__PURE__ */ new Set();
37266     let alternate = /* @__PURE__ */ new Set();
37267     let foundSemi = false;
37268     let testNameFragments = false;
37269     let patterns2;
37270     let t2 = identifyTree(tags);
37271     if (!t2) return empty2;
37272     if (t2 === "transit") {
37273       patterns2 = {
37274         primary: /^network$/i,
37275         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
37276       };
37277     } else if (t2 === "flags") {
37278       patterns2 = {
37279         primary: /^(flag:name|flag:name:\w+)$/i,
37280         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
37281         // note: no `country`, we special-case it below
37282       };
37283     } else if (t2 === "brands") {
37284       testNameFragments = true;
37285       patterns2 = {
37286         primary: /^(name|name:\w+)$/i,
37287         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
37288       };
37289     } else if (t2 === "operators") {
37290       testNameFragments = true;
37291       patterns2 = {
37292         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
37293         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
37294       };
37295     } else {
37296       testNameFragments = true;
37297       patterns2 = {
37298         primary: /^(name|name:\w+)$/i,
37299         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
37300       };
37301     }
37302     if (tags.name && testNameFragments) {
37303       const nameParts = tags.name.split(/[\s\-\/,.]/);
37304       for (let split = nameParts.length; split > 0; split--) {
37305         const name = nameParts.slice(0, split).join(" ");
37306         primary.add(name);
37307       }
37308     }
37309     Object.keys(tags).forEach((osmkey) => {
37310       const osmvalue = tags[osmkey];
37311       if (!osmvalue) return;
37312       if (isNamelike(osmkey, "primary")) {
37313         if (/;/.test(osmvalue)) {
37314           foundSemi = true;
37315         } else {
37316           primary.add(osmvalue);
37317           alternate.delete(osmvalue);
37318         }
37319       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
37320         if (/;/.test(osmvalue)) {
37321           foundSemi = true;
37322         } else {
37323           alternate.add(osmvalue);
37324         }
37325       }
37326     });
37327     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
37328       const osmvalue = tags.country;
37329       if (/;/.test(osmvalue)) {
37330         foundSemi = true;
37331       } else {
37332         alternate.add(osmvalue);
37333       }
37334     }
37335     if (foundSemi) {
37336       return empty2;
37337     } else {
37338       return { primary, alternate };
37339     }
37340     function isNamelike(osmkey, which) {
37341       if (osmkey === "old_name") return false;
37342       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
37343     }
37344   }
37345   function gatherTuples(tryKVs, tryNames) {
37346     let tuples = [];
37347     ["primary", "alternate"].forEach((whichName) => {
37348       const arr = Array.from(tryNames[whichName]).sort((a4, b3) => b3.length - a4.length);
37349       arr.forEach((n3) => {
37350         ["primary", "alternate"].forEach((whichKV) => {
37351           tryKVs[whichKV].forEach((kv) => {
37352             const parts = kv.split("/", 2);
37353             const k3 = parts[0];
37354             const v3 = parts[1];
37355             tuples.push({ k: k3, v: v3, n: n3 });
37356           });
37357         });
37358       });
37359     });
37360     return tuples;
37361   }
37362   function _upgradeTags(tags, loc) {
37363     let newTags = Object.assign({}, tags);
37364     let changed = false;
37365     Object.keys(newTags).forEach((osmkey) => {
37366       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
37367       if (matchTag) {
37368         const prefix = matchTag[1] || "";
37369         const wd = newTags[osmkey];
37370         const replace = _nsi.replacements[wd];
37371         if (replace && replace.wikidata !== void 0) {
37372           changed = true;
37373           if (replace.wikidata) {
37374             newTags[osmkey] = replace.wikidata;
37375           } else {
37376             delete newTags[osmkey];
37377           }
37378         }
37379         if (replace && replace.wikipedia !== void 0) {
37380           changed = true;
37381           const wpkey = `${prefix}wikipedia`;
37382           if (replace.wikipedia) {
37383             newTags[wpkey] = replace.wikipedia;
37384           } else {
37385             delete newTags[wpkey];
37386           }
37387         }
37388       }
37389     });
37390     const isRouteMaster = tags.type === "route_master";
37391     const tryKVs = gatherKVs(tags);
37392     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
37393       return changed ? { newTags, matched: null } : null;
37394     }
37395     const tryNames = gatherNames(tags);
37396     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
37397     if (foundQID) tryNames.primary.add(foundQID);
37398     if (!tryNames.primary.size && !tryNames.alternate.size) {
37399       return changed ? { newTags, matched: null } : null;
37400     }
37401     const tuples = gatherTuples(tryKVs, tryNames);
37402     for (let i3 = 0; i3 < tuples.length; i3++) {
37403       const tuple = tuples[i3];
37404       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
37405       if (!hits || !hits.length) continue;
37406       if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
37407       let itemID, item;
37408       for (let j3 = 0; j3 < hits.length; j3++) {
37409         const hit = hits[j3];
37410         itemID = hit.itemID;
37411         if (_nsi.dissolved[itemID]) continue;
37412         item = _nsi.ids.get(itemID);
37413         if (!item) continue;
37414         const mainTag = item.mainTag;
37415         const itemQID = item.tags[mainTag];
37416         const notQID = newTags[`not:${mainTag}`];
37417         if (
37418           // Exceptions, skip this hit
37419           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
37420           newTags.office && !item.tags.office
37421         ) {
37422           item = null;
37423           continue;
37424         } else {
37425           break;
37426         }
37427       }
37428       if (!item) continue;
37429       item = JSON.parse(JSON.stringify(item));
37430       const tkv = item.tkv;
37431       const parts = tkv.split("/", 3);
37432       const k3 = parts[1];
37433       const v3 = parts[2];
37434       const category = _nsi.data[tkv];
37435       const properties = category.properties || {};
37436       let preserveTags = item.preserveTags || properties.preserveTags || [];
37437       ["building", "emergency", "internet_access", "opening_hours", "takeaway"].forEach((osmkey) => {
37438         if (k3 !== osmkey) preserveTags.push(`^${osmkey}$`);
37439       });
37440       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
37441       let keepTags = {};
37442       Object.keys(newTags).forEach((osmkey) => {
37443         if (regexes.some((regex) => regex.test(osmkey))) {
37444           keepTags[osmkey] = newTags[osmkey];
37445         }
37446       });
37447       _nsi.kvt.forEach((vmap, k4) => {
37448         if (newTags[k4] === "yes") delete newTags[k4];
37449       });
37450       if (foundQID) {
37451         delete newTags.wikipedia;
37452         delete newTags.wikidata;
37453       }
37454       Object.assign(newTags, item.tags, keepTags);
37455       if (isRouteMaster) {
37456         newTags.route_master = newTags.route;
37457         delete newTags.route;
37458       }
37459       const origName = tags.name;
37460       const newName = newTags.name;
37461       if (newName && origName && newName !== origName && !newTags.branch) {
37462         const newNames = gatherNames(newTags);
37463         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
37464         const isMoved = newSet.has(origName);
37465         if (!isMoved) {
37466           const nameParts = origName.split(/[\s\-\/,.]/);
37467           for (let split = nameParts.length; split > 0; split--) {
37468             const name = nameParts.slice(0, split).join(" ");
37469             const branch = nameParts.slice(split).join(" ");
37470             const nameHits = _nsi.matcher.match(k3, v3, name, loc);
37471             if (!nameHits || !nameHits.length) continue;
37472             if (nameHits.some((hit) => hit.itemID === itemID)) {
37473               if (branch) {
37474                 if (notBranches.test(branch)) {
37475                   newTags.name = origName;
37476                 } else {
37477                   const branchHits = _nsi.matcher.match(k3, v3, branch, loc);
37478                   if (branchHits && branchHits.length) {
37479                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
37480                       return null;
37481                     }
37482                   } else {
37483                     newTags.branch = branch;
37484                   }
37485                 }
37486               }
37487               break;
37488             }
37489           }
37490         }
37491       }
37492       return { newTags, matched: item };
37493     }
37494     return changed ? { newTags, matched: null } : null;
37495   }
37496   function _isGenericName(tags) {
37497     const n3 = tags.name;
37498     if (!n3) return false;
37499     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
37500     const tryKVs = gatherKVs(tags);
37501     if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
37502     const tuples = gatherTuples(tryKVs, tryNames);
37503     for (let i3 = 0; i3 < tuples.length; i3++) {
37504       const tuple = tuples[i3];
37505       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
37506       if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
37507     }
37508     return false;
37509   }
37510   var import_vparse, _nsiStatus, _nsi, buildingPreset, notNames, notBranches, nsi_default;
37511   var init_nsi = __esm({
37512     "modules/services/nsi.js"() {
37513       "use strict";
37514       init_name_suggestion_index();
37515       import_vparse = __toESM(require_vparse());
37516       init_core();
37517       init_presets();
37518       init_id();
37519       init_package();
37520       _nsiStatus = "loading";
37521       _nsi = {};
37522       buildingPreset = {
37523         "building/commercial": true,
37524         "building/government": true,
37525         "building/hotel": true,
37526         "building/retail": true,
37527         "building/office": true,
37528         "building/supermarket": true,
37529         "building/yes": true
37530       };
37531       notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
37532       notBranches = /(coop|express|wireless|factory|outlet)/i;
37533       nsi_default = {
37534         // `init()`
37535         // On init, start preparing the name-suggestion-index
37536         //
37537         init: () => {
37538           setNsiSources();
37539           _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
37540         },
37541         // `reset()`
37542         // Reset is called when user saves data to OSM (does nothing here)
37543         //
37544         reset: () => {
37545         },
37546         // `status()`
37547         // To let other code know how it's going...
37548         //
37549         // Returns
37550         //   `String`: 'loading', 'ok', 'failed'
37551         //
37552         status: () => _nsiStatus,
37553         // `isGenericName()`
37554         // Is the `name` tag generic?
37555         //
37556         // Arguments
37557         //   `tags`: `Object` containing the feature's OSM tags
37558         // Returns
37559         //   `true` if it is generic, `false` if not
37560         //
37561         isGenericName: (tags) => _isGenericName(tags),
37562         // `upgradeTags()`
37563         // Suggest tag upgrades.
37564         // This function will not modify the input tags, it makes a copy.
37565         //
37566         // Arguments
37567         //   `tags`: `Object` containing the feature's OSM tags
37568         //   `loc`: Location where this feature exists, as a [lon, lat]
37569         // Returns
37570         //   `Object` containing the result, or `null` if no changes needed:
37571         //   {
37572         //     'newTags': `Object` - The tags the the feature should have
37573         //     'matched': `Object` - The matched item
37574         //   }
37575         //
37576         upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
37577         // `cache()`
37578         // Direct access to the NSI cache, useful for testing or breaking things
37579         //
37580         // Returns
37581         //   `Object`: the internal NSI cache
37582         //
37583         cache: () => _nsi
37584       };
37585     }
37586   });
37587
37588   // modules/services/kartaview.js
37589   var kartaview_exports = {};
37590   __export(kartaview_exports, {
37591     default: () => kartaview_default
37592   });
37593   function abortRequest3(controller) {
37594     controller.abort();
37595   }
37596   function maxPageAtZoom(z3) {
37597     if (z3 < 15) return 2;
37598     if (z3 === 15) return 5;
37599     if (z3 === 16) return 10;
37600     if (z3 === 17) return 20;
37601     if (z3 === 18) return 40;
37602     if (z3 > 18) return 80;
37603   }
37604   function loadTiles2(which, url, projection2) {
37605     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
37606     var tiles = tiler3.getTiles(projection2);
37607     var cache = _oscCache[which];
37608     Object.keys(cache.inflight).forEach(function(k3) {
37609       var wanted = tiles.find(function(tile) {
37610         return k3.indexOf(tile.id + ",") === 0;
37611       });
37612       if (!wanted) {
37613         abortRequest3(cache.inflight[k3]);
37614         delete cache.inflight[k3];
37615       }
37616     });
37617     tiles.forEach(function(tile) {
37618       loadNextTilePage(which, currZoom, url, tile);
37619     });
37620   }
37621   function loadNextTilePage(which, currZoom, url, tile) {
37622     var cache = _oscCache[which];
37623     var bbox2 = tile.extent.bbox();
37624     var maxPages = maxPageAtZoom(currZoom);
37625     var nextPage = cache.nextPage[tile.id] || 1;
37626     var params = utilQsString({
37627       ipp: maxResults,
37628       page: nextPage,
37629       // client_id: clientId,
37630       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
37631       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
37632     }, true);
37633     if (nextPage > maxPages) return;
37634     var id2 = tile.id + "," + String(nextPage);
37635     if (cache.loaded[id2] || cache.inflight[id2]) return;
37636     var controller = new AbortController();
37637     cache.inflight[id2] = controller;
37638     var options = {
37639       method: "POST",
37640       signal: controller.signal,
37641       body: params,
37642       headers: { "Content-Type": "application/x-www-form-urlencoded" }
37643     };
37644     json_default(url, options).then(function(data) {
37645       cache.loaded[id2] = true;
37646       delete cache.inflight[id2];
37647       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
37648         throw new Error("No Data");
37649       }
37650       var features = data.currentPageItems.map(function(item) {
37651         var loc = [+item.lng, +item.lat];
37652         var d2;
37653         if (which === "images") {
37654           d2 = {
37655             service: "photo",
37656             loc,
37657             key: item.id,
37658             ca: +item.heading,
37659             captured_at: item.shot_date || item.date_added,
37660             captured_by: item.username,
37661             imagePath: item.name,
37662             sequence_id: item.sequence_id,
37663             sequence_index: +item.sequence_index
37664           };
37665           var seq = _oscCache.sequences[d2.sequence_id];
37666           if (!seq) {
37667             seq = { rotation: 0, images: [] };
37668             _oscCache.sequences[d2.sequence_id] = seq;
37669           }
37670           seq.images[d2.sequence_index] = d2;
37671           _oscCache.images.forImageKey[d2.key] = d2;
37672         }
37673         return {
37674           minX: loc[0],
37675           minY: loc[1],
37676           maxX: loc[0],
37677           maxY: loc[1],
37678           data: d2
37679         };
37680       });
37681       cache.rtree.load(features);
37682       if (data.currentPageItems.length === maxResults) {
37683         cache.nextPage[tile.id] = nextPage + 1;
37684         loadNextTilePage(which, currZoom, url, tile);
37685       } else {
37686         cache.nextPage[tile.id] = Infinity;
37687       }
37688       if (which === "images") {
37689         dispatch5.call("loadedImages");
37690       }
37691     }).catch(function() {
37692       cache.loaded[id2] = true;
37693       delete cache.inflight[id2];
37694     });
37695   }
37696   function partitionViewport2(projection2) {
37697     var z3 = geoScaleToZoom(projection2.scale());
37698     var z22 = Math.ceil(z3 * 2) / 2 + 2.5;
37699     var tiler8 = utilTiler().zoomExtent([z22, z22]);
37700     return tiler8.getTiles(projection2).map(function(tile) {
37701       return tile.extent;
37702     });
37703   }
37704   function searchLimited2(limit, projection2, rtree) {
37705     limit = limit || 5;
37706     return partitionViewport2(projection2).reduce(function(result, extent) {
37707       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
37708         return d2.data;
37709       });
37710       return found.length ? result.concat(found) : result;
37711     }, []);
37712   }
37713   var apibase2, maxResults, tileZoom, tiler3, dispatch5, imgZoom, _oscCache, _oscSelectedImage, _loadViewerPromise2, kartaview_default;
37714   var init_kartaview = __esm({
37715     "modules/services/kartaview.js"() {
37716       "use strict";
37717       init_src4();
37718       init_src18();
37719       init_src12();
37720       init_rbush();
37721       init_localizer();
37722       init_geo2();
37723       init_util();
37724       init_services();
37725       apibase2 = "https://kartaview.org";
37726       maxResults = 1e3;
37727       tileZoom = 14;
37728       tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
37729       dispatch5 = dispatch_default("loadedImages");
37730       imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
37731       kartaview_default = {
37732         init: function() {
37733           if (!_oscCache) {
37734             this.reset();
37735           }
37736           this.event = utilRebind(this, dispatch5, "on");
37737         },
37738         reset: function() {
37739           if (_oscCache) {
37740             Object.values(_oscCache.images.inflight).forEach(abortRequest3);
37741           }
37742           _oscCache = {
37743             images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
37744             sequences: {}
37745           };
37746         },
37747         images: function(projection2) {
37748           var limit = 5;
37749           return searchLimited2(limit, projection2, _oscCache.images.rtree);
37750         },
37751         sequences: function(projection2) {
37752           var viewport = projection2.clipExtent();
37753           var min3 = [viewport[0][0], viewport[1][1]];
37754           var max3 = [viewport[1][0], viewport[0][1]];
37755           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37756           var sequenceKeys = {};
37757           _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
37758             sequenceKeys[d2.data.sequence_id] = true;
37759           });
37760           var lineStrings = [];
37761           Object.keys(sequenceKeys).forEach(function(sequenceKey) {
37762             var seq = _oscCache.sequences[sequenceKey];
37763             var images = seq && seq.images;
37764             if (images) {
37765               lineStrings.push({
37766                 type: "LineString",
37767                 coordinates: images.map(function(d2) {
37768                   return d2.loc;
37769                 }).filter(Boolean),
37770                 properties: {
37771                   captured_at: images[0] ? images[0].captured_at : null,
37772                   captured_by: images[0] ? images[0].captured_by : null,
37773                   key: sequenceKey
37774                 }
37775               });
37776             }
37777           });
37778           return lineStrings;
37779         },
37780         cachedImage: function(imageKey) {
37781           return _oscCache.images.forImageKey[imageKey];
37782         },
37783         loadImages: function(projection2) {
37784           var url = apibase2 + "/1.0/list/nearby-photos/";
37785           loadTiles2("images", url, projection2);
37786         },
37787         ensureViewerLoaded: function(context) {
37788           if (_loadViewerPromise2) return _loadViewerPromise2;
37789           var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
37790           var that = this;
37791           var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan2)).on("dblclick.zoom", null);
37792           wrapEnter.append("div").attr("class", "photo-attribution fillD");
37793           var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
37794           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
37795           controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
37796           controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
37797           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
37798           wrapEnter.append("div").attr("class", "kartaview-image-wrap");
37799           context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
37800             imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
37801           });
37802           function zoomPan2(d3_event) {
37803             var t2 = d3_event.transform;
37804             context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
37805           }
37806           function rotate(deg) {
37807             return function() {
37808               if (!_oscSelectedImage) return;
37809               var sequenceKey = _oscSelectedImage.sequence_id;
37810               var sequence = _oscCache.sequences[sequenceKey];
37811               if (!sequence) return;
37812               var r2 = sequence.rotation || 0;
37813               r2 += deg;
37814               if (r2 > 180) r2 -= 360;
37815               if (r2 < -180) r2 += 360;
37816               sequence.rotation = r2;
37817               var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
37818               wrap3.transition().duration(100).call(imgZoom.transform, identity2);
37819               wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
37820             };
37821           }
37822           function step(stepBy) {
37823             return function() {
37824               if (!_oscSelectedImage) return;
37825               var sequenceKey = _oscSelectedImage.sequence_id;
37826               var sequence = _oscCache.sequences[sequenceKey];
37827               if (!sequence) return;
37828               var nextIndex = _oscSelectedImage.sequence_index + stepBy;
37829               var nextImage = sequence.images[nextIndex];
37830               if (!nextImage) return;
37831               context.map().centerEase(nextImage.loc);
37832               that.selectImage(context, nextImage.key);
37833             };
37834           }
37835           _loadViewerPromise2 = Promise.resolve();
37836           return _loadViewerPromise2;
37837         },
37838         showViewer: function(context) {
37839           const wrap2 = context.container().select(".photoviewer");
37840           const isHidden = wrap2.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
37841           if (isHidden) {
37842             for (const service of Object.values(services)) {
37843               if (service === this) continue;
37844               if (typeof service.hideViewer === "function") {
37845                 service.hideViewer(context);
37846               }
37847             }
37848             wrap2.classed("hide", false).selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
37849           }
37850           return this;
37851         },
37852         hideViewer: function(context) {
37853           _oscSelectedImage = null;
37854           this.updateUrlImage(null);
37855           var viewer = context.container().select(".photoviewer");
37856           if (!viewer.empty()) viewer.datum(null);
37857           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
37858           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
37859           return this.setStyles(context, null, true);
37860         },
37861         selectImage: function(context, imageKey) {
37862           var d2 = this.cachedImage(imageKey);
37863           _oscSelectedImage = d2;
37864           this.updateUrlImage(imageKey);
37865           var viewer = context.container().select(".photoviewer");
37866           if (!viewer.empty()) viewer.datum(d2);
37867           this.setStyles(context, null, true);
37868           context.container().selectAll(".icon-sign").classed("currentView", false);
37869           if (!d2) return this;
37870           var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
37871           var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
37872           var attribution = wrap2.selectAll(".photo-attribution").text("");
37873           wrap2.transition().duration(100).call(imgZoom.transform, identity2);
37874           imageWrap.selectAll(".kartaview-image").remove();
37875           if (d2) {
37876             var sequence = _oscCache.sequences[d2.sequence_id];
37877             var r2 = sequence && sequence.rotation || 0;
37878             imageWrap.append("img").attr("class", "kartaview-image").attr("src", (apibase2 + "/" + d2.imagePath).replace(/^https:\/\/kartaview\.org\/storage(\d+)\//, "https://storage$1.openstreetcam.org/")).style("transform", "rotate(" + r2 + "deg)");
37879             if (d2.captured_by) {
37880               attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
37881               attribution.append("span").text("|");
37882             }
37883             if (d2.captured_at) {
37884               attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
37885               attribution.append("span").text("|");
37886             }
37887             attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d2.sequence_id + "/" + d2.sequence_index).text("kartaview.org");
37888           }
37889           return this;
37890           function localeDateString2(s2) {
37891             if (!s2) return null;
37892             var options = { day: "numeric", month: "short", year: "numeric" };
37893             var d4 = new Date(s2);
37894             if (isNaN(d4.getTime())) return null;
37895             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
37896           }
37897         },
37898         getSelectedImage: function() {
37899           return _oscSelectedImage;
37900         },
37901         getSequenceKeyForImage: function(d2) {
37902           return d2 && d2.sequence_id;
37903         },
37904         // Updates the currently highlighted sequence and selected bubble.
37905         // Reset is only necessary when interacting with the viewport because
37906         // this implicitly changes the currently selected bubble/sequence
37907         setStyles: function(context, hovered, reset) {
37908           if (reset) {
37909             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
37910             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
37911           }
37912           var hoveredImageId = hovered && hovered.key;
37913           var hoveredSequenceId = this.getSequenceKeyForImage(hovered);
37914           var viewer = context.container().select(".photoviewer");
37915           var selected = viewer.empty() ? void 0 : viewer.datum();
37916           var selectedImageId = selected && selected.key;
37917           var selectedSequenceId = this.getSequenceKeyForImage(selected);
37918           context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
37919             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
37920           }).classed("hovered", function(d2) {
37921             return d2.key === hoveredImageId;
37922           }).classed("currentView", function(d2) {
37923             return d2.key === selectedImageId;
37924           });
37925           context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
37926             return d2.properties.key === hoveredSequenceId;
37927           }).classed("currentView", function(d2) {
37928             return d2.properties.key === selectedSequenceId;
37929           });
37930           context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
37931           function viewfieldPath() {
37932             var d2 = this.parentNode.__data__;
37933             if (d2.pano && d2.key !== selectedImageId) {
37934               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
37935             } else {
37936               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
37937             }
37938           }
37939           return this;
37940         },
37941         updateUrlImage: function(imageKey) {
37942           const hash2 = utilStringQs(window.location.hash);
37943           if (imageKey) {
37944             hash2.photo = "kartaview/" + imageKey;
37945           } else {
37946             delete hash2.photo;
37947           }
37948           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
37949         },
37950         cache: function() {
37951           return _oscCache;
37952         }
37953       };
37954     }
37955   });
37956
37957   // modules/services/pannellum_photo.js
37958   var pannellum_photo_exports = {};
37959   __export(pannellum_photo_exports, {
37960     default: () => pannellum_photo_default
37961   });
37962   var pannellumViewerCSS, pannellumViewerJS, dispatch6, _currScenes, _pannellumViewer, _activeSceneKey, pannellum_photo_default;
37963   var init_pannellum_photo = __esm({
37964     "modules/services/pannellum_photo.js"() {
37965       "use strict";
37966       init_src5();
37967       init_src4();
37968       init_util();
37969       pannellumViewerCSS = "pannellum/pannellum.css";
37970       pannellumViewerJS = "pannellum/pannellum.js";
37971       dispatch6 = dispatch_default("viewerChanged");
37972       _currScenes = [];
37973       pannellum_photo_default = {
37974         init: async function(context, selection2) {
37975           selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("mousedown", function(e3) {
37976             e3.stopPropagation();
37977           });
37978           if (!window.pannellum) {
37979             await this.loadPannellum(context);
37980           }
37981           const options = {
37982             "default": { firstScene: "" },
37983             scenes: {},
37984             minHfov: 20,
37985             disableKeyboardCtrl: true,
37986             sceneFadeDuration: 0
37987           };
37988           _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options);
37989           _pannellumViewer.on("mousedown", () => {
37990             select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
37991               dispatch6.call("viewerChanged");
37992             });
37993           }).on("mouseup", () => {
37994             select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
37995           }).on("animatefinished", () => {
37996             dispatch6.call("viewerChanged");
37997           });
37998           context.ui().photoviewer.on("resize.pannellum", () => {
37999             _pannellumViewer.resize();
38000           });
38001           this.event = utilRebind(this, dispatch6, "on");
38002           return this;
38003         },
38004         loadPannellum: function(context) {
38005           const head = select_default2("head");
38006           return Promise.all([
38007             new Promise((resolve, reject) => {
38008               head.selectAll("#ideditor-pannellum-viewercss").data([0]).enter().append("link").attr("id", "ideditor-pannellum-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.pannellum", resolve).on("error.pannellum", reject);
38009             }),
38010             new Promise((resolve, reject) => {
38011               head.selectAll("#ideditor-pannellum-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-pannellum-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.pannellum", resolve).on("error.pannellum", reject);
38012             })
38013           ]);
38014         },
38015         /**
38016          * Shows the photo frame if hidden
38017          * @param {*} context the HTML wrap of the frame
38018          */
38019         showPhotoFrame: function(context) {
38020           const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
38021           if (isHidden) {
38022             context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
38023             context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
38024           }
38025           return this;
38026         },
38027         /**
38028          * Hides the photo frame if shown
38029          * @param {*} context the HTML wrap of the frame
38030          */
38031         hidePhotoFrame: function(viewerContext) {
38032           viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
38033           return this;
38034         },
38035         /**
38036          * Renders an image inside the frame
38037          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
38038          * @param {boolean} keepOrientation if true, HFOV, pitch and yaw will be kept between images
38039          */
38040         selectPhoto: function(data, keepOrientation) {
38041           const key = _activeSceneKey = data.image_path;
38042           if (!_currScenes.includes(key)) {
38043             let newSceneOptions = {
38044               showFullscreenCtrl: false,
38045               autoLoad: false,
38046               compass: false,
38047               yaw: 0,
38048               type: "equirectangular",
38049               preview: data.preview_path,
38050               panorama: data.image_path,
38051               northOffset: data.ca
38052             };
38053             _currScenes.push(key);
38054             _pannellumViewer.addScene(key, newSceneOptions);
38055           }
38056           let yaw = 0;
38057           let pitch = 0;
38058           let hfov = 0;
38059           if (keepOrientation) {
38060             yaw = this.getYaw();
38061             pitch = this.getPitch();
38062             hfov = this.getHfov();
38063           }
38064           if (_pannellumViewer.isLoaded() !== false) {
38065             _pannellumViewer.loadScene(key, pitch, yaw, hfov);
38066             dispatch6.call("viewerChanged");
38067           } else {
38068             const retry = setInterval(() => {
38069               if (_pannellumViewer.isLoaded() === false) {
38070                 return;
38071               }
38072               if (_activeSceneKey === key) {
38073                 _pannellumViewer.loadScene(key, pitch, yaw, hfov);
38074                 dispatch6.call("viewerChanged");
38075               }
38076               clearInterval(retry);
38077             }, 100);
38078           }
38079           if (_currScenes.length > 3) {
38080             const old_key = _currScenes.shift();
38081             _pannellumViewer.removeScene(old_key);
38082           }
38083           _pannellumViewer.resize();
38084           return this;
38085         },
38086         getYaw: function() {
38087           return _pannellumViewer.getYaw();
38088         },
38089         getPitch: function() {
38090           return _pannellumViewer.getPitch();
38091         },
38092         getHfov: function() {
38093           return _pannellumViewer.getHfov();
38094         }
38095       };
38096     }
38097   });
38098
38099   // modules/services/plane_photo.js
38100   var plane_photo_exports = {};
38101   __export(plane_photo_exports, {
38102     default: () => plane_photo_default
38103   });
38104   function zoomPan(d3_event) {
38105     let t2 = d3_event.transform;
38106     _imageWrapper.call(utilSetTransform, t2.x, t2.y, t2.k);
38107   }
38108   function loadImage(selection2, path) {
38109     return new Promise((resolve) => {
38110       selection2.attr("src", path);
38111       selection2.on("load", () => {
38112         resolve(selection2);
38113       });
38114     });
38115   }
38116   var dispatch7, _photo, _imageWrapper, _planeWrapper, _imgZoom, plane_photo_default;
38117   var init_plane_photo = __esm({
38118     "modules/services/plane_photo.js"() {
38119       "use strict";
38120       init_src4();
38121       init_src12();
38122       init_util();
38123       dispatch7 = dispatch_default("viewerChanged");
38124       _imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
38125       plane_photo_default = {
38126         init: async function(context, selection2) {
38127           this.event = utilRebind(this, dispatch7, "on");
38128           _planeWrapper = selection2;
38129           _planeWrapper.call(_imgZoom.on("zoom", zoomPan));
38130           _imageWrapper = _planeWrapper.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
38131           _photo = _imageWrapper.append("img").attr("class", "plane-photo");
38132           context.ui().photoviewer.on("resize.plane", function(dimensions) {
38133             _imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
38134           });
38135           await Promise.resolve();
38136           return this;
38137         },
38138         /**
38139          * Shows the photo frame if hidden
38140          * @param {*} context the HTML wrap of the frame
38141          */
38142         showPhotoFrame: function(context) {
38143           const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
38144           if (isHidden) {
38145             context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
38146             context.selectAll(".photo-frame.plane-frame").classed("hide", false);
38147           }
38148           return this;
38149         },
38150         /**
38151          * Hides the photo frame if shown
38152          * @param {*} context the HTML wrap of the frame
38153          */
38154         hidePhotoFrame: function(context) {
38155           context.select("photo-frame.plane-frame").classed("hide", false);
38156           return this;
38157         },
38158         /**
38159          * Renders an image inside the frame
38160          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
38161          */
38162         selectPhoto: function(data) {
38163           dispatch7.call("viewerChanged");
38164           loadImage(_photo, "");
38165           loadImage(_photo, data.image_path).then(() => {
38166             _planeWrapper.call(_imgZoom.transform, identity2);
38167           });
38168           return this;
38169         },
38170         getYaw: function() {
38171           return 0;
38172         }
38173       };
38174     }
38175   });
38176
38177   // modules/services/vegbilder.js
38178   var vegbilder_exports = {};
38179   __export(vegbilder_exports, {
38180     default: () => vegbilder_default
38181   });
38182   async function fetchAvailableLayers() {
38183     var _a4, _b2, _c;
38184     const params = {
38185       service: "WFS",
38186       request: "GetCapabilities",
38187       version: "2.0.0"
38188     };
38189     const urlForRequest = owsEndpoint + utilQsString(params);
38190     const response = await xml_default(urlForRequest);
38191     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
38192     const availableLayers = [];
38193     for (const node of response.querySelectorAll("FeatureType > Name")) {
38194       const match = (_a4 = node.textContent) == null ? void 0 : _a4.match(regexMatcher);
38195       if (match) {
38196         availableLayers.push({
38197           name: match[0],
38198           is_sphere: !!((_b2 = match.groups) == null ? void 0 : _b2.image_type),
38199           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
38200         });
38201       }
38202     }
38203     return availableLayers;
38204   }
38205   function filterAvailableLayers(photoContex) {
38206     const fromDateString = photoContex.fromDate();
38207     const toDateString = photoContex.toDate();
38208     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
38209     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
38210     const showsFlat = photoContex.showsFlat();
38211     const showsPano = photoContex.showsPanoramic();
38212     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
38213   }
38214   function loadWFSLayers(projection2, margin, wfslayers) {
38215     const tiles = tiler4.margin(margin).getTiles(projection2);
38216     for (const cache of wfslayers) {
38217       loadWFSLayer(projection2, cache, tiles);
38218     }
38219   }
38220   function loadWFSLayer(projection2, cache, tiles) {
38221     for (const [key, controller] of cache.inflight.entries()) {
38222       const wanted = tiles.some((tile) => key === tile.id);
38223       if (!wanted) {
38224         controller.abort();
38225         cache.inflight.delete(key);
38226       }
38227     }
38228     Promise.all(tiles.map(
38229       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
38230     )).then(() => orderSequences(projection2, cache));
38231   }
38232   async function loadTile2(cache, typename, tile) {
38233     const bbox2 = tile.extent.bbox();
38234     const tileid = tile.id;
38235     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
38236     const params = {
38237       service: "WFS",
38238       request: "GetFeature",
38239       version: "2.0.0",
38240       typenames: typename,
38241       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
38242       outputFormat: "json"
38243     };
38244     const controller = new AbortController();
38245     cache.inflight.set(tileid, controller);
38246     const options = {
38247       method: "GET",
38248       signal: controller.signal
38249     };
38250     const urlForRequest = owsEndpoint + utilQsString(params);
38251     let featureCollection;
38252     try {
38253       featureCollection = await json_default(urlForRequest, options);
38254     } catch {
38255       cache.loaded.set(tileid, false);
38256       return;
38257     } finally {
38258       cache.inflight.delete(tileid);
38259     }
38260     cache.loaded.set(tileid, true);
38261     if (featureCollection.features.length === 0) {
38262       return;
38263     }
38264     const features = featureCollection.features.map((feature3) => {
38265       const loc = feature3.geometry.coordinates;
38266       const key = feature3.id;
38267       const properties = feature3.properties;
38268       const {
38269         RETNING: ca,
38270         TIDSPUNKT: captured_at,
38271         URL: image_path,
38272         URLPREVIEW: preview_path,
38273         BILDETYPE: image_type,
38274         METER: metering,
38275         FELTKODE: lane_code
38276       } = properties;
38277       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
38278       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
38279       const data = {
38280         service: "photo",
38281         loc,
38282         key,
38283         ca,
38284         image_path,
38285         preview_path,
38286         road_reference: roadReference(properties),
38287         metering,
38288         lane_code,
38289         direction,
38290         captured_at: new Date(captured_at),
38291         is_sphere: image_type === "360"
38292       };
38293       cache.points.set(key, data);
38294       return {
38295         minX: loc[0],
38296         minY: loc[1],
38297         maxX: loc[0],
38298         maxY: loc[1],
38299         data
38300       };
38301     });
38302     _vegbilderCache.rtree.load(features);
38303     dispatch8.call("loadedImages");
38304   }
38305   function orderSequences(projection2, cache) {
38306     const { points } = cache;
38307     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
38308       const key = image.road_reference;
38309       if (grouped2.has(key)) {
38310         grouped2.get(key).push(image);
38311       } else {
38312         grouped2.set(key, [image]);
38313       }
38314       return grouped2;
38315     }, /* @__PURE__ */ new Map());
38316     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
38317       imageGroup.sort((a4, b3) => {
38318         if (a4.captured_at.valueOf() > b3.captured_at.valueOf()) {
38319           return 1;
38320         } else if (a4.captured_at.valueOf() < b3.captured_at.valueOf()) {
38321           return -1;
38322         } else {
38323           const { direction } = a4;
38324           if (direction === directionEnum.forward) {
38325             return a4.metering - b3.metering;
38326           } else {
38327             return b3.metering - a4.metering;
38328           }
38329         }
38330       });
38331       let imageSequence = [imageGroup[0]];
38332       let angle2 = null;
38333       for (const [lastImage, image] of pairs(imageGroup)) {
38334         if (lastImage.ca === null) {
38335           const b3 = projection2(lastImage.loc);
38336           const a4 = projection2(image.loc);
38337           if (!geoVecEqual(a4, b3)) {
38338             angle2 = geoVecAngle(a4, b3);
38339             angle2 *= 180 / Math.PI;
38340             angle2 -= 90;
38341             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
38342           }
38343           lastImage.ca = angle2;
38344         }
38345         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
38346           imageSequence.push(image);
38347         } else {
38348           imageSequences2.push(imageSequence);
38349           imageSequence = [image];
38350         }
38351       }
38352       imageSequences2.push(imageSequence);
38353       return imageSequences2;
38354     }, []);
38355     cache.sequences = imageSequences.map((images) => {
38356       const sequence = {
38357         images,
38358         key: images[0].key,
38359         geometry: {
38360           type: "LineString",
38361           coordinates: images.map((image) => image.loc)
38362         }
38363       };
38364       for (const image of images) {
38365         _vegbilderCache.image2sequence_map.set(image.key, sequence);
38366       }
38367       return sequence;
38368     });
38369   }
38370   function roadReference(properties) {
38371     const {
38372       FYLKENUMMER: county_number,
38373       VEGKATEGORI: road_class,
38374       VEGSTATUS: road_status,
38375       VEGNUMMER: road_number,
38376       STREKNING: section,
38377       DELSTREKNING: subsection,
38378       HP: parcel,
38379       KRYSSDEL: junction_part,
38380       SIDEANLEGGSDEL: services_part,
38381       ANKERPUNKT: anker_point,
38382       AAR: year
38383     } = properties;
38384     let reference;
38385     if (year >= 2020) {
38386       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
38387       if (junction_part) {
38388         reference = `${reference} M${anker_point} KD${junction_part}`;
38389       } else if (services_part) {
38390         reference = `${reference} M${anker_point} SD${services_part}`;
38391       }
38392     } else {
38393       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
38394     }
38395     return reference;
38396   }
38397   function localeTimestamp(date) {
38398     const options = {
38399       day: "2-digit",
38400       month: "2-digit",
38401       year: "numeric",
38402       hour: "numeric",
38403       minute: "numeric",
38404       second: "numeric"
38405     };
38406     return date.toLocaleString(_mainLocalizer.localeCode(), options);
38407   }
38408   function partitionViewport3(projection2) {
38409     const zoom = geoScaleToZoom(projection2.scale());
38410     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
38411     const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
38412     return tiler8.getTiles(projection2).map((tile) => tile.extent);
38413   }
38414   function searchLimited3(limit, projection2, rtree) {
38415     limit != null ? limit : limit = 5;
38416     return partitionViewport3(projection2).reduce((result, extent) => {
38417       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
38418       return result.concat(found);
38419     }, []);
38420   }
38421   var owsEndpoint, tileZoom2, tiler4, dispatch8, directionEnum, _planeFrame, _pannellumFrame, _currentFrame, _loadViewerPromise3, _vegbilderCache, vegbilder_default;
38422   var init_vegbilder = __esm({
38423     "modules/services/vegbilder.js"() {
38424       "use strict";
38425       init_src18();
38426       init_src4();
38427       init_src();
38428       init_rbush();
38429       init_country_coder();
38430       init_localizer();
38431       init_util();
38432       init_geo2();
38433       init_pannellum_photo();
38434       init_plane_photo();
38435       init_services();
38436       owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
38437       tileZoom2 = 14;
38438       tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
38439       dispatch8 = dispatch_default("loadedImages", "viewerChanged");
38440       directionEnum = Object.freeze({
38441         forward: Symbol(0),
38442         backward: Symbol(1)
38443       });
38444       vegbilder_default = {
38445         init: function() {
38446           this.event = utilRebind(this, dispatch8, "on");
38447         },
38448         reset: async function() {
38449           if (_vegbilderCache) {
38450             for (const layer of _vegbilderCache.wfslayers.values()) {
38451               for (const controller of layer.inflight.values()) {
38452                 controller.abort();
38453               }
38454             }
38455           }
38456           _vegbilderCache = {
38457             wfslayers: /* @__PURE__ */ new Map(),
38458             rtree: new RBush(),
38459             image2sequence_map: /* @__PURE__ */ new Map()
38460           };
38461           const availableLayers = await fetchAvailableLayers();
38462           const { wfslayers } = _vegbilderCache;
38463           for (const layerInfo of availableLayers) {
38464             const cache = {
38465               layerInfo,
38466               loaded: /* @__PURE__ */ new Map(),
38467               inflight: /* @__PURE__ */ new Map(),
38468               points: /* @__PURE__ */ new Map(),
38469               sequences: []
38470             };
38471             wfslayers.set(layerInfo.name, cache);
38472           }
38473         },
38474         images: function(projection2) {
38475           const limit = 5;
38476           return searchLimited3(limit, projection2, _vegbilderCache.rtree);
38477         },
38478         sequences: function(projection2) {
38479           const viewport = projection2.clipExtent();
38480           const min3 = [viewport[0][0], viewport[1][1]];
38481           const max3 = [viewport[1][0], viewport[0][1]];
38482           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
38483           const seen = /* @__PURE__ */ new Set();
38484           const line_strings = [];
38485           for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
38486             const sequence = _vegbilderCache.image2sequence_map.get(data.key);
38487             if (!sequence) continue;
38488             const { key, geometry, images } = sequence;
38489             if (seen.has(key)) continue;
38490             seen.add(key);
38491             const line = {
38492               type: "LineString",
38493               coordinates: geometry.coordinates,
38494               key,
38495               images
38496             };
38497             line_strings.push(line);
38498           }
38499           return line_strings;
38500         },
38501         cachedImage: function(key) {
38502           for (const { points } of _vegbilderCache.wfslayers.values()) {
38503             if (points.has(key)) return points.get(key);
38504           }
38505         },
38506         getSequenceForImage: function(image) {
38507           return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
38508         },
38509         loadImages: async function(context, margin) {
38510           if (!_vegbilderCache) {
38511             await this.reset();
38512           }
38513           margin != null ? margin : margin = 1;
38514           const wfslayers = filterAvailableLayers(context.photos());
38515           loadWFSLayers(context.projection, margin, wfslayers);
38516         },
38517         photoFrame: function() {
38518           return _currentFrame;
38519         },
38520         ensureViewerLoaded: function(context) {
38521           if (_loadViewerPromise3) return _loadViewerPromise3;
38522           const step = (stepBy) => () => {
38523             const viewer = context.container().select(".photoviewer");
38524             const selected = viewer.empty() ? void 0 : viewer.datum();
38525             if (!selected) return;
38526             const sequence = this.getSequenceForImage(selected);
38527             const nextIndex = sequence.images.indexOf(selected) + stepBy;
38528             const nextImage = sequence.images[nextIndex];
38529             if (!nextImage) return;
38530             context.map().centerEase(nextImage.loc);
38531             this.selectImage(context, nextImage.key, true);
38532           };
38533           const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
38534           const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
38535           wrapEnter.append("div").attr("class", "photo-attribution fillD");
38536           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
38537           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
38538           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
38539           _loadViewerPromise3 = Promise.all([
38540             pannellum_photo_default.init(context, wrapEnter),
38541             plane_photo_default.init(context, wrapEnter)
38542           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
38543             _pannellumFrame = pannellumPhotoFrame;
38544             _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
38545             _planeFrame = planePhotoFrame;
38546             _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
38547           });
38548           return _loadViewerPromise3;
38549         },
38550         selectImage: function(context, key, keepOrientation) {
38551           const d2 = this.cachedImage(key);
38552           this.updateUrlImage(key);
38553           const viewer = context.container().select(".photoviewer");
38554           if (!viewer.empty()) {
38555             viewer.datum(d2);
38556           }
38557           this.setStyles(context, null, true);
38558           if (!d2) return this;
38559           const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
38560           const attribution = wrap2.selectAll(".photo-attribution").text("");
38561           if (d2.captured_at) {
38562             attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
38563           }
38564           attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
38565           attribution.append("a").attr("target", "_blank").attr("href", `https://vegbilder.atlas.vegvesen.no/?year=${d2.captured_at.getFullYear()}&lat=${d2.loc[1]}&lng=${d2.loc[0]}&view=image&imageId=${d2.key}`).call(_t.append("vegbilder.view_on"));
38566           _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
38567           _currentFrame.showPhotoFrame(wrap2).selectPhoto(d2, keepOrientation);
38568           return this;
38569         },
38570         showViewer: function(context) {
38571           const viewer = context.container().select(".photoviewer");
38572           const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
38573           if (isHidden) {
38574             for (const service of Object.values(services)) {
38575               if (service === this) continue;
38576               if (typeof service.hideViewer === "function") {
38577                 service.hideViewer(context);
38578               }
38579             }
38580             viewer.classed("hide", false).selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
38581           }
38582           return this;
38583         },
38584         hideViewer: function(context) {
38585           this.updateUrlImage(null);
38586           const viewer = context.container().select(".photoviewer");
38587           if (!viewer.empty()) viewer.datum(null);
38588           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
38589           context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
38590           return this.setStyles(context, null, true);
38591         },
38592         // Updates the currently highlighted sequence and selected bubble.
38593         // Reset is only necessary when interacting with the viewport because
38594         // this implicitly changes the currently selected bubble/sequence
38595         setStyles: function(context, hovered, reset) {
38596           var _a4, _b2;
38597           if (reset) {
38598             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
38599             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
38600           }
38601           const hoveredImageKey = hovered == null ? void 0 : hovered.key;
38602           const hoveredSequence = this.getSequenceForImage(hovered);
38603           const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
38604           const hoveredImageKeys = (_a4 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a4 : [];
38605           const viewer = context.container().select(".photoviewer");
38606           const selected = viewer.empty() ? void 0 : viewer.datum();
38607           const selectedImageKey = selected == null ? void 0 : selected.key;
38608           const selectedSequence = this.getSequenceForImage(selected);
38609           const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
38610           const selectedImageKeys = (_b2 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b2 : [];
38611           const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
38612           context.container().selectAll(".layer-vegbilder .viewfield-group").classed("highlighted", (d2) => highlightedImageKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredImageKey).classed("currentView", (d2) => d2.key === selectedImageKey);
38613           context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
38614           context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
38615           function viewfieldPath() {
38616             const d2 = this.parentNode.__data__;
38617             if (d2.is_sphere && d2.key !== selectedImageKey) {
38618               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
38619             } else {
38620               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
38621             }
38622           }
38623           return this;
38624         },
38625         updateUrlImage: function(key) {
38626           const hash2 = utilStringQs(window.location.hash);
38627           if (key) {
38628             hash2.photo = "vegbilder/" + key;
38629           } else {
38630             delete hash2.photo;
38631           }
38632           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
38633         },
38634         validHere: function(extent) {
38635           const bbox2 = Object.values(extent.bbox());
38636           return iso1A2Codes(bbox2).includes("NO");
38637         },
38638         cache: function() {
38639           return _vegbilderCache;
38640         }
38641       };
38642     }
38643   });
38644
38645   // node_modules/osm-auth/src/osm-auth.mjs
38646   function osmAuth(o2) {
38647     var oauth2 = {};
38648     var CHANNEL_ID = "osm-api-auth-complete";
38649     var _store = null;
38650     try {
38651       _store = window.localStorage;
38652     } catch (e3) {
38653       var _mock = /* @__PURE__ */ new Map();
38654       _store = {
38655         isMocked: true,
38656         hasItem: (k3) => _mock.has(k3),
38657         getItem: (k3) => _mock.get(k3),
38658         setItem: (k3, v3) => _mock.set(k3, v3),
38659         removeItem: (k3) => _mock.delete(k3),
38660         clear: () => _mock.clear()
38661       };
38662     }
38663     function token(k3, v3) {
38664       var key = o2.url + k3;
38665       if (arguments.length === 1) {
38666         var val = _store.getItem(key) || "";
38667         return val.replace(/"/g, "");
38668       } else if (arguments.length === 2) {
38669         if (v3) {
38670           return _store.setItem(key, v3);
38671         } else {
38672           return _store.removeItem(key);
38673         }
38674       }
38675     }
38676     oauth2.authenticated = function() {
38677       return !!token("oauth2_access_token");
38678     };
38679     oauth2.logout = function() {
38680       token("oauth2_access_token", "");
38681       token("oauth_token", "");
38682       token("oauth_token_secret", "");
38683       token("oauth_request_token_secret", "");
38684       return oauth2;
38685     };
38686     oauth2.authenticate = function(callback, options) {
38687       if (oauth2.authenticated()) {
38688         callback(null, oauth2);
38689         return;
38690       }
38691       oauth2.logout();
38692       _preopenPopup(function(error, popup) {
38693         if (error) {
38694           callback(error);
38695         } else {
38696           _generatePkceChallenge(function(pkce) {
38697             _authenticate(pkce, options, popup, callback);
38698           });
38699         }
38700       });
38701     };
38702     oauth2.authenticateAsync = function(options) {
38703       if (oauth2.authenticated()) {
38704         return Promise.resolve(oauth2);
38705       }
38706       oauth2.logout();
38707       return new Promise((resolve, reject) => {
38708         var errback = (err, result) => {
38709           if (err) {
38710             reject(err);
38711           } else {
38712             resolve(result);
38713           }
38714         };
38715         _preopenPopup((error, popup) => {
38716           if (error) {
38717             errback(error);
38718           } else {
38719             _generatePkceChallenge((pkce) => _authenticate(pkce, options, popup, errback));
38720           }
38721         });
38722       });
38723     };
38724     function _preopenPopup(callback) {
38725       if (o2.singlepage) {
38726         callback(null, void 0);
38727         return;
38728       }
38729       var w3 = 550;
38730       var h3 = 610;
38731       var settings = [
38732         ["width", w3],
38733         ["height", h3],
38734         ["left", window.screen.width / 2 - w3 / 2],
38735         ["top", window.screen.height / 2 - h3 / 2]
38736       ].map(function(x2) {
38737         return x2.join("=");
38738       }).join(",");
38739       var popup = window.open("about:blank", "oauth_window", settings);
38740       if (popup) {
38741         callback(null, popup);
38742       } else {
38743         var error = new Error("Popup was blocked");
38744         error.status = "popup-blocked";
38745         callback(error);
38746       }
38747     }
38748     function _authenticate(pkce, options, popup, callback) {
38749       var state = generateState();
38750       var path = "/oauth2/authorize?" + utilQsString2({
38751         client_id: o2.client_id,
38752         redirect_uri: o2.redirect_uri,
38753         response_type: "code",
38754         scope: o2.scope,
38755         state,
38756         code_challenge: pkce.code_challenge,
38757         code_challenge_method: pkce.code_challenge_method,
38758         locale: o2.locale || ""
38759       });
38760       var url = (options == null ? void 0 : options.switchUser) ? `${o2.url}/logout?referer=${encodeURIComponent(`/login?referer=${encodeURIComponent(path)}`)}` : o2.url + path;
38761       if (o2.singlepage) {
38762         if (_store.isMocked) {
38763           var error = new Error("localStorage unavailable, but required in singlepage mode");
38764           error.status = "pkce-localstorage-unavailable";
38765           callback(error);
38766           return;
38767         }
38768         var params = utilStringQs2(window.location.search.slice(1));
38769         if (params.code) {
38770           oauth2.bootstrapToken(params.code, callback);
38771         } else {
38772           token("oauth2_state", state);
38773           token("oauth2_pkce_code_verifier", pkce.code_verifier);
38774           window.location = url;
38775         }
38776       } else {
38777         oauth2.popupWindow = popup;
38778         popup.location = url;
38779       }
38780       var bc = new BroadcastChannel(CHANNEL_ID);
38781       bc.addEventListener("message", (event) => {
38782         var url2 = event.data;
38783         var params2 = utilStringQs2(url2.split("?")[1]);
38784         if (params2.state !== state) {
38785           var error2 = new Error("Invalid state");
38786           error2.status = "invalid-state";
38787           callback(error2);
38788           return;
38789         }
38790         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
38791         bc.close();
38792       });
38793       function accessTokenDone(err, xhr) {
38794         o2.done();
38795         if (err) {
38796           callback(err);
38797           return;
38798         }
38799         var access_token = JSON.parse(xhr.response);
38800         token("oauth2_access_token", access_token.access_token);
38801         callback(null, oauth2);
38802       }
38803     }
38804     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
38805       var url = o2.url + "/oauth2/token?" + utilQsString2({
38806         client_id: o2.client_id,
38807         redirect_uri: o2.redirect_uri,
38808         grant_type: "authorization_code",
38809         code: auth_code,
38810         code_verifier
38811       });
38812       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
38813       o2.loading();
38814     }
38815     oauth2.bringPopupWindowToFront = function() {
38816       var broughtPopupToFront = false;
38817       try {
38818         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
38819           oauth2.popupWindow.focus();
38820           broughtPopupToFront = true;
38821         }
38822       } catch (err) {
38823       }
38824       return broughtPopupToFront;
38825     };
38826     oauth2.bootstrapToken = function(auth_code, callback) {
38827       var state = token("oauth2_state");
38828       token("oauth2_state", "");
38829       var params = utilStringQs2(window.location.search.slice(1));
38830       if (params.state !== state) {
38831         var error = new Error("Invalid state");
38832         error.status = "invalid-state";
38833         callback(error);
38834         return;
38835       }
38836       var code_verifier = token("oauth2_pkce_code_verifier");
38837       token("oauth2_pkce_code_verifier", "");
38838       _getAccessToken(auth_code, code_verifier, accessTokenDone);
38839       function accessTokenDone(err, xhr) {
38840         o2.done();
38841         if (err) {
38842           callback(err);
38843           return;
38844         }
38845         var access_token = JSON.parse(xhr.response);
38846         token("oauth2_access_token", access_token.access_token);
38847         callback(null, oauth2);
38848       }
38849     };
38850     oauth2.fetch = function(resource, options) {
38851       if (oauth2.authenticated()) {
38852         return _doFetch();
38853       } else {
38854         if (o2.auto) {
38855           return oauth2.authenticateAsync().then(_doFetch);
38856         } else {
38857           return Promise.reject(new Error("not authenticated"));
38858         }
38859       }
38860       function _doFetch() {
38861         options = options || {};
38862         if (!options.headers) {
38863           options.headers = { "Content-Type": "application/x-www-form-urlencoded" };
38864         }
38865         options.headers.Authorization = "Bearer " + token("oauth2_access_token");
38866         return fetch(resource, options);
38867       }
38868     };
38869     oauth2.xhr = function(options, callback) {
38870       if (oauth2.authenticated()) {
38871         return _doXHR();
38872       } else {
38873         if (o2.auto) {
38874           oauth2.authenticate(_doXHR);
38875           return;
38876         } else {
38877           callback("not authenticated", null);
38878           return;
38879         }
38880       }
38881       function _doXHR() {
38882         var url = options.prefix !== false ? o2.apiUrl + options.path : options.path;
38883         return oauth2.rawxhr(
38884           options.method,
38885           url,
38886           token("oauth2_access_token"),
38887           options.content,
38888           options.headers,
38889           done
38890         );
38891       }
38892       function done(err, xhr) {
38893         if (err) {
38894           callback(err);
38895         } else if (xhr.responseXML) {
38896           callback(err, xhr.responseXML);
38897         } else {
38898           callback(err, xhr.response);
38899         }
38900       }
38901     };
38902     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
38903       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
38904       if (access_token) {
38905         headers.Authorization = "Bearer " + access_token;
38906       }
38907       var xhr = new XMLHttpRequest();
38908       xhr.onreadystatechange = function() {
38909         if (4 === xhr.readyState && 0 !== xhr.status) {
38910           if (/^20\d$/.test(xhr.status)) {
38911             callback(null, xhr);
38912           } else {
38913             callback(xhr, null);
38914           }
38915         }
38916       };
38917       xhr.onerror = function(e3) {
38918         callback(e3, null);
38919       };
38920       xhr.open(method, url, true);
38921       for (var h3 in headers) xhr.setRequestHeader(h3, headers[h3]);
38922       xhr.send(data);
38923       return xhr;
38924     };
38925     oauth2.preauth = function(val) {
38926       if (val && val.access_token) {
38927         token("oauth2_access_token", val.access_token);
38928       }
38929       return oauth2;
38930     };
38931     oauth2.options = function(val) {
38932       if (!arguments.length) return o2;
38933       o2 = val;
38934       o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
38935       o2.url = o2.url || "https://www.openstreetmap.org";
38936       o2.auto = o2.auto || false;
38937       o2.singlepage = o2.singlepage || false;
38938       o2.loading = o2.loading || function() {
38939       };
38940       o2.done = o2.done || function() {
38941       };
38942       return oauth2.preauth(o2);
38943     };
38944     oauth2.options(o2);
38945     return oauth2;
38946   }
38947   function utilQsString2(obj) {
38948     return Object.keys(obj).filter(function(key) {
38949       return obj[key] !== void 0;
38950     }).sort().map(function(key) {
38951       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
38952     }).join("&");
38953   }
38954   function utilStringQs2(str) {
38955     var i3 = 0;
38956     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
38957     str = str.slice(i3);
38958     return str.split("&").reduce(function(obj, pair3) {
38959       var parts = pair3.split("=");
38960       if (parts.length === 2) {
38961         obj[parts[0]] = decodeURIComponent(parts[1]);
38962       }
38963       return obj;
38964     }, {});
38965   }
38966   function supportsWebCryptoAPI() {
38967     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
38968   }
38969   function _generatePkceChallenge(callback) {
38970     var code_verifier;
38971     if (supportsWebCryptoAPI()) {
38972       var random = window.crypto.getRandomValues(new Uint8Array(32));
38973       code_verifier = base64(random.buffer);
38974       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
38975         return char.charCodeAt(0);
38976       }));
38977       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash2) {
38978         var code_challenge = base64(hash2);
38979         callback({
38980           code_challenge,
38981           code_verifier,
38982           code_challenge_method: "S256"
38983         });
38984       });
38985     } else {
38986       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
38987       code_verifier = "";
38988       for (var i3 = 0; i3 < 64; i3++) {
38989         code_verifier += chars[Math.floor(Math.random() * chars.length)];
38990       }
38991       callback({
38992         code_verifier,
38993         code_challenge: code_verifier,
38994         code_challenge_method: "plain"
38995       });
38996     }
38997   }
38998   function generateState() {
38999     var state;
39000     if (supportsWebCryptoAPI()) {
39001       var random = window.crypto.getRandomValues(new Uint8Array(32));
39002       state = base64(random.buffer);
39003     } else {
39004       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
39005       state = "";
39006       for (var i3 = 0; i3 < 64; i3++) {
39007         state += chars[Math.floor(Math.random() * chars.length)];
39008       }
39009     }
39010     return state;
39011   }
39012   function base64(buffer) {
39013     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
39014   }
39015   var init_osm_auth = __esm({
39016     "node_modules/osm-auth/src/osm-auth.mjs"() {
39017     }
39018   });
39019
39020   // modules/util/jxon.js
39021   var jxon_exports = {};
39022   __export(jxon_exports, {
39023     JXON: () => JXON
39024   });
39025   var JXON;
39026   var init_jxon = __esm({
39027     "modules/util/jxon.js"() {
39028       "use strict";
39029       JXON = new function() {
39030         var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
39031         function parseText(sValue) {
39032           if (rIsNull.test(sValue)) {
39033             return null;
39034           }
39035           if (rIsBool.test(sValue)) {
39036             return sValue.toLowerCase() === "true";
39037           }
39038           if (isFinite(sValue)) {
39039             return parseFloat(sValue);
39040           }
39041           if (isFinite(Date.parse(sValue))) {
39042             return new Date(sValue);
39043           }
39044           return sValue;
39045         }
39046         function EmptyTree() {
39047         }
39048         EmptyTree.prototype.toString = function() {
39049           return "null";
39050         };
39051         EmptyTree.prototype.valueOf = function() {
39052           return null;
39053         };
39054         function objectify(vValue) {
39055           return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
39056         }
39057         function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
39058           var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
39059           var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
39060             /* put here the default value for empty nodes: */
39061             true
39062           );
39063           if (bChildren) {
39064             for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
39065               oNode = oParentNode.childNodes.item(nItem);
39066               if (oNode.nodeType === 4) {
39067                 sCollectedTxt += oNode.nodeValue;
39068               } else if (oNode.nodeType === 3) {
39069                 sCollectedTxt += oNode.nodeValue.trim();
39070               } else if (oNode.nodeType === 1 && !oNode.prefix) {
39071                 aCache.push(oNode);
39072               }
39073             }
39074           }
39075           var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
39076           if (!bHighVerb && (bChildren || bAttributes)) {
39077             vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
39078           }
39079           for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
39080             sProp = aCache[nElId].nodeName.toLowerCase();
39081             vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
39082             if (vResult.hasOwnProperty(sProp)) {
39083               if (vResult[sProp].constructor !== Array) {
39084                 vResult[sProp] = [vResult[sProp]];
39085               }
39086               vResult[sProp].push(vContent);
39087             } else {
39088               vResult[sProp] = vContent;
39089               nLength++;
39090             }
39091           }
39092           if (bAttributes) {
39093             var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
39094             for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
39095               oAttrib = oParentNode.attributes.item(nAttrib);
39096               oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
39097             }
39098             if (bNesteAttr) {
39099               if (bFreeze) {
39100                 Object.freeze(oAttrParent);
39101               }
39102               vResult[sAttributesProp] = oAttrParent;
39103               nLength -= nAttrLen - 1;
39104             }
39105           }
39106           if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
39107             vResult[sValueProp] = vBuiltVal;
39108           } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
39109             vResult = vBuiltVal;
39110           }
39111           if (bFreeze && (bHighVerb || nLength > 0)) {
39112             Object.freeze(vResult);
39113           }
39114           aCache.length = nLevelStart;
39115           return vResult;
39116         }
39117         function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
39118           var vValue, oChild;
39119           if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
39120             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
39121           } else if (oParentObj.constructor === Date) {
39122             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
39123           }
39124           for (var sName in oParentObj) {
39125             vValue = oParentObj[sName];
39126             if (isFinite(sName) || vValue instanceof Function) {
39127               continue;
39128             }
39129             if (sName === sValueProp) {
39130               if (vValue !== null && vValue !== true) {
39131                 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
39132               }
39133             } else if (sName === sAttributesProp) {
39134               for (var sAttrib in vValue) {
39135                 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
39136               }
39137             } else if (sName.charAt(0) === sAttrPref) {
39138               oParentEl.setAttribute(sName.slice(1), vValue);
39139             } else if (vValue.constructor === Array) {
39140               for (var nItem = 0; nItem < vValue.length; nItem++) {
39141                 oChild = oXMLDoc.createElement(sName);
39142                 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
39143                 oParentEl.appendChild(oChild);
39144               }
39145             } else {
39146               oChild = oXMLDoc.createElement(sName);
39147               if (vValue instanceof Object) {
39148                 loadObjTree(oXMLDoc, oChild, vValue);
39149               } else if (vValue !== null && vValue !== true) {
39150                 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
39151               }
39152               oParentEl.appendChild(oChild);
39153             }
39154           }
39155         }
39156         this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
39157           var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
39158             /* put here the default verbosity level: */
39159             1
39160           );
39161           return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
39162         };
39163         this.unbuild = function(oObjTree) {
39164           var oNewDoc = document.implementation.createDocument("", "", null);
39165           loadObjTree(oNewDoc, oNewDoc, oObjTree);
39166           return oNewDoc;
39167         };
39168         this.stringify = function(oObjTree) {
39169           return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
39170         };
39171       }();
39172     }
39173   });
39174
39175   // modules/services/osm.js
39176   var osm_exports2 = {};
39177   __export(osm_exports2, {
39178     default: () => osm_default
39179   });
39180   function authLoading() {
39181     dispatch9.call("authLoading");
39182   }
39183   function authDone() {
39184     dispatch9.call("authDone");
39185   }
39186   function abortRequest4(controllerOrXHR) {
39187     if (controllerOrXHR) {
39188       controllerOrXHR.abort();
39189     }
39190   }
39191   function hasInflightRequests(cache) {
39192     return Object.keys(cache.inflight).length;
39193   }
39194   function abortUnwantedRequests3(cache, visibleTiles) {
39195     Object.keys(cache.inflight).forEach(function(k3) {
39196       if (cache.toLoad[k3]) return;
39197       if (visibleTiles.find(function(tile) {
39198         return k3 === tile.id;
39199       })) return;
39200       abortRequest4(cache.inflight[k3]);
39201       delete cache.inflight[k3];
39202     });
39203   }
39204   function getLoc(attrs) {
39205     var lon = attrs.lon && attrs.lon.value;
39206     var lat = attrs.lat && attrs.lat.value;
39207     return [Number(lon), Number(lat)];
39208   }
39209   function getNodes(obj) {
39210     var elems = obj.getElementsByTagName("nd");
39211     var nodes = new Array(elems.length);
39212     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39213       nodes[i3] = "n" + elems[i3].attributes.ref.value;
39214     }
39215     return nodes;
39216   }
39217   function getNodesJSON(obj) {
39218     var elems = obj.nodes;
39219     var nodes = new Array(elems.length);
39220     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39221       nodes[i3] = "n" + elems[i3];
39222     }
39223     return nodes;
39224   }
39225   function getTags(obj) {
39226     var elems = obj.getElementsByTagName("tag");
39227     var tags = {};
39228     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39229       var attrs = elems[i3].attributes;
39230       tags[attrs.k.value] = attrs.v.value;
39231     }
39232     return tags;
39233   }
39234   function getMembers(obj) {
39235     var elems = obj.getElementsByTagName("member");
39236     var members = new Array(elems.length);
39237     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39238       var attrs = elems[i3].attributes;
39239       members[i3] = {
39240         id: attrs.type.value[0] + attrs.ref.value,
39241         type: attrs.type.value,
39242         role: attrs.role.value
39243       };
39244     }
39245     return members;
39246   }
39247   function getMembersJSON(obj) {
39248     var elems = obj.members;
39249     var members = new Array(elems.length);
39250     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
39251       var attrs = elems[i3];
39252       members[i3] = {
39253         id: attrs.type[0] + attrs.ref,
39254         type: attrs.type,
39255         role: attrs.role
39256       };
39257     }
39258     return members;
39259   }
39260   function getVisible(attrs) {
39261     return !attrs.visible || attrs.visible.value !== "false";
39262   }
39263   function parseComments(comments) {
39264     var parsedComments = [];
39265     for (var i3 = 0; i3 < comments.length; i3++) {
39266       var comment = comments[i3];
39267       if (comment.nodeName === "comment") {
39268         var childNodes = comment.childNodes;
39269         var parsedComment = {};
39270         for (var j3 = 0; j3 < childNodes.length; j3++) {
39271           var node = childNodes[j3];
39272           var nodeName = node.nodeName;
39273           if (nodeName === "#text") continue;
39274           parsedComment[nodeName] = node.textContent;
39275           if (nodeName === "uid") {
39276             var uid = node.textContent;
39277             if (uid && !_userCache.user[uid]) {
39278               _userCache.toLoad[uid] = true;
39279             }
39280           }
39281         }
39282         if (parsedComment) {
39283           parsedComments.push(parsedComment);
39284         }
39285       }
39286     }
39287     return parsedComments;
39288   }
39289   function encodeNoteRtree(note) {
39290     return {
39291       minX: note.loc[0],
39292       minY: note.loc[1],
39293       maxX: note.loc[0],
39294       maxY: note.loc[1],
39295       data: note
39296     };
39297   }
39298   function parseJSON(payload, callback, options) {
39299     options = Object.assign({ skipSeen: true }, options);
39300     if (!payload) {
39301       return callback({ message: "No JSON", status: -1 });
39302     }
39303     var json = payload;
39304     if (typeof json !== "object") json = JSON.parse(payload);
39305     if (!json.elements) return callback({ message: "No JSON", status: -1 });
39306     var children2 = json.elements;
39307     var handle = window.requestIdleCallback(function() {
39308       _deferred.delete(handle);
39309       var results = [];
39310       var result;
39311       for (var i3 = 0; i3 < children2.length; i3++) {
39312         result = parseChild(children2[i3]);
39313         if (result) results.push(result);
39314       }
39315       callback(null, results);
39316     });
39317     _deferred.add(handle);
39318     function parseChild(child) {
39319       var parser2 = jsonparsers[child.type];
39320       if (!parser2) return null;
39321       var uid;
39322       uid = osmEntity.id.fromOSM(child.type, child.id);
39323       if (options.skipSeen) {
39324         if (_tileCache.seen[uid]) return null;
39325         _tileCache.seen[uid] = true;
39326       }
39327       return parser2(child, uid);
39328     }
39329   }
39330   function parseUserJSON(payload, callback, options) {
39331     options = Object.assign({ skipSeen: true }, options);
39332     if (!payload) {
39333       return callback({ message: "No JSON", status: -1 });
39334     }
39335     var json = payload;
39336     if (typeof json !== "object") json = JSON.parse(payload);
39337     if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
39338     var objs = json.users || [json];
39339     var handle = window.requestIdleCallback(function() {
39340       _deferred.delete(handle);
39341       var results = [];
39342       var result;
39343       for (var i3 = 0; i3 < objs.length; i3++) {
39344         result = parseObj(objs[i3]);
39345         if (result) results.push(result);
39346       }
39347       callback(null, results);
39348     });
39349     _deferred.add(handle);
39350     function parseObj(obj) {
39351       var uid = obj.user.id && obj.user.id.toString();
39352       if (options.skipSeen && _userCache.user[uid]) {
39353         delete _userCache.toLoad[uid];
39354         return null;
39355       }
39356       var user = jsonparsers.user(obj.user, uid);
39357       _userCache.user[uid] = user;
39358       delete _userCache.toLoad[uid];
39359       return user;
39360     }
39361   }
39362   function parseXML(xml, callback, options) {
39363     options = Object.assign({ skipSeen: true }, options);
39364     if (!xml || !xml.childNodes) {
39365       return callback({ message: "No XML", status: -1 });
39366     }
39367     var root3 = xml.childNodes[0];
39368     var children2 = root3.childNodes;
39369     var handle = window.requestIdleCallback(function() {
39370       _deferred.delete(handle);
39371       var results = [];
39372       var result;
39373       for (var i3 = 0; i3 < children2.length; i3++) {
39374         result = parseChild(children2[i3]);
39375         if (result) results.push(result);
39376       }
39377       callback(null, results);
39378     });
39379     _deferred.add(handle);
39380     function parseChild(child) {
39381       var parser2 = parsers[child.nodeName];
39382       if (!parser2) return null;
39383       var uid;
39384       if (child.nodeName === "user") {
39385         uid = child.attributes.id.value;
39386         if (options.skipSeen && _userCache.user[uid]) {
39387           delete _userCache.toLoad[uid];
39388           return null;
39389         }
39390       } else if (child.nodeName === "note") {
39391         uid = child.getElementsByTagName("id")[0].textContent;
39392       } else {
39393         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
39394         if (options.skipSeen) {
39395           if (_tileCache.seen[uid]) return null;
39396           _tileCache.seen[uid] = true;
39397         }
39398       }
39399       return parser2(child, uid);
39400     }
39401   }
39402   function updateRtree3(item, replace) {
39403     _noteCache.rtree.remove(item, function isEql(a4, b3) {
39404       return a4.data.id === b3.data.id;
39405     });
39406     if (replace) {
39407       _noteCache.rtree.insert(item);
39408     }
39409   }
39410   function wrapcb(thisArg, callback, cid) {
39411     return function(err, result) {
39412       if (err) {
39413         return callback.call(thisArg, err);
39414       } else if (thisArg.getConnectionId() !== cid) {
39415         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
39416       } else {
39417         return callback.call(thisArg, err, result);
39418       }
39419     };
39420   }
39421   var tiler5, dispatch9, urlroot, apiUrlroot, redirectPath, oauth, _apiConnections, _imageryBlocklists, _tileCache, _noteCache, _userCache, _cachedApiStatus, _changeset, _deferred, _connectionID, _tileZoom3, _noteZoom, _rateLimitError, _userChangesets, _userDetails, _off, _maxWayNodes, jsonparsers, parsers, osm_default;
39422   var init_osm2 = __esm({
39423     "modules/services/osm.js"() {
39424       "use strict";
39425       init_throttle();
39426       init_src4();
39427       init_src18();
39428       init_osm_auth();
39429       init_rbush();
39430       init_jxon();
39431       init_geo2();
39432       init_osm();
39433       init_util();
39434       init_localizer();
39435       init_id();
39436       tiler5 = utilTiler();
39437       dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
39438       urlroot = osmApiConnections[0].url;
39439       apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
39440       redirectPath = window.location.origin + window.location.pathname;
39441       oauth = osmAuth({
39442         url: urlroot,
39443         apiUrl: apiUrlroot,
39444         client_id: osmApiConnections[0].client_id,
39445         scope: "read_prefs write_prefs write_api read_gpx write_notes",
39446         redirect_uri: redirectPath + "land.html",
39447         loading: authLoading,
39448         done: authDone
39449       });
39450       _apiConnections = osmApiConnections;
39451       _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
39452       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
39453       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
39454       _userCache = { toLoad: {}, user: {} };
39455       _changeset = {};
39456       _deferred = /* @__PURE__ */ new Set();
39457       _connectionID = 1;
39458       _tileZoom3 = 16;
39459       _noteZoom = 12;
39460       _maxWayNodes = 2e3;
39461       jsonparsers = {
39462         node: function nodeData(obj, uid) {
39463           return new osmNode({
39464             id: uid,
39465             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39466             version: obj.version && obj.version.toString(),
39467             changeset: obj.changeset && obj.changeset.toString(),
39468             timestamp: obj.timestamp,
39469             user: obj.user,
39470             uid: obj.uid && obj.uid.toString(),
39471             loc: [Number(obj.lon), Number(obj.lat)],
39472             tags: obj.tags
39473           });
39474         },
39475         way: function wayData(obj, uid) {
39476           return new osmWay({
39477             id: uid,
39478             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39479             version: obj.version && obj.version.toString(),
39480             changeset: obj.changeset && obj.changeset.toString(),
39481             timestamp: obj.timestamp,
39482             user: obj.user,
39483             uid: obj.uid && obj.uid.toString(),
39484             tags: obj.tags,
39485             nodes: getNodesJSON(obj)
39486           });
39487         },
39488         relation: function relationData(obj, uid) {
39489           return new osmRelation({
39490             id: uid,
39491             visible: typeof obj.visible === "boolean" ? obj.visible : true,
39492             version: obj.version && obj.version.toString(),
39493             changeset: obj.changeset && obj.changeset.toString(),
39494             timestamp: obj.timestamp,
39495             user: obj.user,
39496             uid: obj.uid && obj.uid.toString(),
39497             tags: obj.tags,
39498             members: getMembersJSON(obj)
39499           });
39500         },
39501         user: function parseUser(obj, uid) {
39502           return {
39503             id: uid,
39504             display_name: obj.display_name,
39505             account_created: obj.account_created,
39506             image_url: obj.img && obj.img.href,
39507             changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
39508             active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
39509           };
39510         }
39511       };
39512       parsers = {
39513         node: function nodeData2(obj, uid) {
39514           var attrs = obj.attributes;
39515           return new osmNode({
39516             id: uid,
39517             visible: getVisible(attrs),
39518             version: attrs.version.value,
39519             changeset: attrs.changeset && attrs.changeset.value,
39520             timestamp: attrs.timestamp && attrs.timestamp.value,
39521             user: attrs.user && attrs.user.value,
39522             uid: attrs.uid && attrs.uid.value,
39523             loc: getLoc(attrs),
39524             tags: getTags(obj)
39525           });
39526         },
39527         way: function wayData2(obj, uid) {
39528           var attrs = obj.attributes;
39529           return new osmWay({
39530             id: uid,
39531             visible: getVisible(attrs),
39532             version: attrs.version.value,
39533             changeset: attrs.changeset && attrs.changeset.value,
39534             timestamp: attrs.timestamp && attrs.timestamp.value,
39535             user: attrs.user && attrs.user.value,
39536             uid: attrs.uid && attrs.uid.value,
39537             tags: getTags(obj),
39538             nodes: getNodes(obj)
39539           });
39540         },
39541         relation: function relationData2(obj, uid) {
39542           var attrs = obj.attributes;
39543           return new osmRelation({
39544             id: uid,
39545             visible: getVisible(attrs),
39546             version: attrs.version.value,
39547             changeset: attrs.changeset && attrs.changeset.value,
39548             timestamp: attrs.timestamp && attrs.timestamp.value,
39549             user: attrs.user && attrs.user.value,
39550             uid: attrs.uid && attrs.uid.value,
39551             tags: getTags(obj),
39552             members: getMembers(obj)
39553           });
39554         },
39555         note: function parseNote(obj, uid) {
39556           var attrs = obj.attributes;
39557           var childNodes = obj.childNodes;
39558           var props = {};
39559           props.id = uid;
39560           props.loc = getLoc(attrs);
39561           if (!_noteCache.note[uid]) {
39562             let coincident = false;
39563             const epsilon3 = 1e-5;
39564             do {
39565               if (coincident) {
39566                 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
39567               }
39568               const bbox2 = geoExtent(props.loc).bbox();
39569               coincident = _noteCache.rtree.search(bbox2).length;
39570             } while (coincident);
39571           } else {
39572             props.loc = _noteCache.note[uid].loc;
39573           }
39574           for (var i3 = 0; i3 < childNodes.length; i3++) {
39575             var node = childNodes[i3];
39576             var nodeName = node.nodeName;
39577             if (nodeName === "#text") continue;
39578             if (nodeName === "comments") {
39579               props[nodeName] = parseComments(node.childNodes);
39580             } else {
39581               props[nodeName] = node.textContent;
39582             }
39583           }
39584           var note = new osmNote(props);
39585           var item = encodeNoteRtree(note);
39586           _noteCache.note[note.id] = note;
39587           updateRtree3(item, true);
39588           return note;
39589         },
39590         user: function parseUser2(obj, uid) {
39591           var attrs = obj.attributes;
39592           var user = {
39593             id: uid,
39594             display_name: attrs.display_name && attrs.display_name.value,
39595             account_created: attrs.account_created && attrs.account_created.value,
39596             changesets_count: "0",
39597             active_blocks: "0"
39598           };
39599           var img = obj.getElementsByTagName("img");
39600           if (img && img[0] && img[0].getAttribute("href")) {
39601             user.image_url = img[0].getAttribute("href");
39602           }
39603           var changesets = obj.getElementsByTagName("changesets");
39604           if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
39605             user.changesets_count = changesets[0].getAttribute("count");
39606           }
39607           var blocks = obj.getElementsByTagName("blocks");
39608           if (blocks && blocks[0]) {
39609             var received = blocks[0].getElementsByTagName("received");
39610             if (received && received[0] && received[0].getAttribute("active")) {
39611               user.active_blocks = received[0].getAttribute("active");
39612             }
39613           }
39614           _userCache.user[uid] = user;
39615           delete _userCache.toLoad[uid];
39616           return user;
39617         }
39618       };
39619       osm_default = {
39620         init: function() {
39621           utilRebind(this, dispatch9, "on");
39622         },
39623         reset: function() {
39624           Array.from(_deferred).forEach(function(handle) {
39625             window.cancelIdleCallback(handle);
39626             _deferred.delete(handle);
39627           });
39628           _connectionID++;
39629           _userChangesets = void 0;
39630           _userDetails = void 0;
39631           _rateLimitError = void 0;
39632           Object.values(_tileCache.inflight).forEach(abortRequest4);
39633           Object.values(_noteCache.inflight).forEach(abortRequest4);
39634           Object.values(_noteCache.inflightPost).forEach(abortRequest4);
39635           if (_changeset.inflight) abortRequest4(_changeset.inflight);
39636           _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
39637           _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
39638           _userCache = { toLoad: {}, user: {} };
39639           _cachedApiStatus = void 0;
39640           _changeset = {};
39641           return this;
39642         },
39643         getConnectionId: function() {
39644           return _connectionID;
39645         },
39646         getUrlRoot: function() {
39647           return urlroot;
39648         },
39649         getApiUrlRoot: function() {
39650           return apiUrlroot;
39651         },
39652         changesetURL: function(changesetID) {
39653           return urlroot + "/changeset/" + changesetID;
39654         },
39655         changesetsURL: function(center, zoom) {
39656           var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
39657           return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
39658         },
39659         entityURL: function(entity) {
39660           return urlroot + "/" + entity.type + "/" + entity.osmId();
39661         },
39662         historyURL: function(entity) {
39663           return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
39664         },
39665         userURL: function(username) {
39666           return urlroot + "/user/" + encodeURIComponent(username);
39667         },
39668         noteURL: function(note) {
39669           return urlroot + "/note/" + note.id;
39670         },
39671         noteReportURL: function(note) {
39672           return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
39673         },
39674         // Generic method to load data from the OSM API
39675         // Can handle either auth or unauth calls.
39676         loadFromAPI: function(path, callback, options) {
39677           options = Object.assign({ skipSeen: true }, options);
39678           var that = this;
39679           var cid = _connectionID;
39680           function done(err, payload) {
39681             if (that.getConnectionId() !== cid) {
39682               if (callback) callback({ message: "Connection Switched", status: -1 });
39683               return;
39684             }
39685             if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
39686               that.reloadApiStatus();
39687             }
39688             if (callback) {
39689               if (err) {
39690                 console.error("API error:", err);
39691                 return callback(err);
39692               } else {
39693                 if (path.indexOf(".json") !== -1) {
39694                   return parseJSON(payload, callback, options);
39695                 } else {
39696                   return parseXML(payload, callback, options);
39697                 }
39698               }
39699             }
39700           }
39701           if (this.authenticated()) {
39702             return oauth.xhr({
39703               method: "GET",
39704               path
39705             }, done);
39706           } else {
39707             var url = apiUrlroot + path;
39708             var controller = new AbortController();
39709             var fn;
39710             if (path.indexOf(".json") !== -1) {
39711               fn = json_default;
39712             } else {
39713               fn = xml_default;
39714             }
39715             fn(url, { signal: controller.signal }).then(function(data) {
39716               done(null, data);
39717             }).catch(function(err) {
39718               if (err.name === "AbortError") return;
39719               var match = err.message.match(/^\d{3}/);
39720               if (match) {
39721                 done({ status: +match[0], statusText: err.message });
39722               } else {
39723                 done(err.message);
39724               }
39725             });
39726             return controller;
39727           }
39728         },
39729         // Load a single entity by id (ways and relations use the `/full` call to include
39730         // nodes and members). Parent relations are not included, see `loadEntityRelations`.
39731         // GET /api/0.6/node/#id
39732         // GET /api/0.6/[way|relation]/#id/full
39733         loadEntity: function(id2, callback) {
39734           var type2 = osmEntity.id.type(id2);
39735           var osmID = osmEntity.id.toOSM(id2);
39736           var options = { skipSeen: false };
39737           this.loadFromAPI(
39738             "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
39739             function(err, entities) {
39740               if (callback) callback(err, { data: entities });
39741             },
39742             options
39743           );
39744         },
39745         // Load a single note by id , XML format
39746         // GET /api/0.6/notes/#id
39747         loadEntityNote: function(id2, callback) {
39748           var options = { skipSeen: false };
39749           this.loadFromAPI(
39750             "/api/0.6/notes/" + id2,
39751             function(err, entities) {
39752               if (callback) callback(err, { data: entities });
39753             },
39754             options
39755           );
39756         },
39757         // Load a single entity with a specific version
39758         // GET /api/0.6/[node|way|relation]/#id/#version
39759         loadEntityVersion: function(id2, version, callback) {
39760           var type2 = osmEntity.id.type(id2);
39761           var osmID = osmEntity.id.toOSM(id2);
39762           var options = { skipSeen: false };
39763           this.loadFromAPI(
39764             "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
39765             function(err, entities) {
39766               if (callback) callback(err, { data: entities });
39767             },
39768             options
39769           );
39770         },
39771         // Load the relations of a single entity with the given.
39772         // GET /api/0.6/[node|way|relation]/#id/relations
39773         loadEntityRelations: function(id2, callback) {
39774           var type2 = osmEntity.id.type(id2);
39775           var osmID = osmEntity.id.toOSM(id2);
39776           var options = { skipSeen: false };
39777           this.loadFromAPI(
39778             "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
39779             function(err, entities) {
39780               if (callback) callback(err, { data: entities });
39781             },
39782             options
39783           );
39784         },
39785         // Load multiple entities in chunks
39786         // (note: callback may be called multiple times)
39787         // Unlike `loadEntity`, child nodes and members are not fetched
39788         // GET /api/0.6/[nodes|ways|relations]?#parameters
39789         loadMultiple: function(ids, callback) {
39790           var that = this;
39791           var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
39792           Object.keys(groups).forEach(function(k3) {
39793             var type2 = k3 + "s";
39794             var osmIDs = groups[k3].map(function(id2) {
39795               return osmEntity.id.toOSM(id2);
39796             });
39797             var options = { skipSeen: false };
39798             utilArrayChunk(osmIDs, 150).forEach(function(arr) {
39799               that.loadFromAPI(
39800                 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
39801                 function(err, entities) {
39802                   if (callback) callback(err, { data: entities });
39803                 },
39804                 options
39805               );
39806             });
39807           });
39808         },
39809         // Create, upload, and close a changeset
39810         // PUT /api/0.6/changeset/create
39811         // POST /api/0.6/changeset/#id/upload
39812         // PUT /api/0.6/changeset/#id/close
39813         putChangeset: function(changeset, changes, callback) {
39814           var cid = _connectionID;
39815           if (_changeset.inflight) {
39816             return callback({ message: "Changeset already inflight", status: -2 }, changeset);
39817           } else if (_changeset.open) {
39818             return createdChangeset.call(this, null, _changeset.open);
39819           } else {
39820             var options = {
39821               method: "PUT",
39822               path: "/api/0.6/changeset/create",
39823               headers: { "Content-Type": "text/xml" },
39824               content: JXON.stringify(changeset.asJXON())
39825             };
39826             _changeset.inflight = oauth.xhr(
39827               options,
39828               wrapcb(this, createdChangeset, cid)
39829             );
39830           }
39831           function createdChangeset(err, changesetID) {
39832             _changeset.inflight = null;
39833             if (err) {
39834               return callback(err, changeset);
39835             }
39836             _changeset.open = changesetID;
39837             changeset = changeset.update({ id: changesetID });
39838             var options2 = {
39839               method: "POST",
39840               path: "/api/0.6/changeset/" + changesetID + "/upload",
39841               headers: { "Content-Type": "text/xml" },
39842               content: JXON.stringify(changeset.osmChangeJXON(changes))
39843             };
39844             _changeset.inflight = oauth.xhr(
39845               options2,
39846               wrapcb(this, uploadedChangeset, cid)
39847             );
39848           }
39849           function uploadedChangeset(err) {
39850             _changeset.inflight = null;
39851             if (err) return callback(err, changeset);
39852             window.setTimeout(function() {
39853               callback(null, changeset);
39854             }, 2500);
39855             _changeset.open = null;
39856             if (this.getConnectionId() === cid) {
39857               oauth.xhr({
39858                 method: "PUT",
39859                 path: "/api/0.6/changeset/" + changeset.id + "/close",
39860                 headers: { "Content-Type": "text/xml" }
39861               }, function() {
39862                 return true;
39863               });
39864             }
39865           }
39866         },
39867         /** updates the tags on an existing unclosed changeset */
39868         // PUT /api/0.6/changeset/#id
39869         updateChangesetTags: (changeset) => {
39870           return oauth.fetch(`${oauth.options().apiUrl}/api/0.6/changeset/${changeset.id}`, {
39871             method: "PUT",
39872             headers: { "Content-Type": "text/xml" },
39873             body: JXON.stringify(changeset.asJXON())
39874           });
39875         },
39876         // Load multiple users in chunks
39877         // (note: callback may be called multiple times)
39878         // GET /api/0.6/users?users=#id1,#id2,...,#idn
39879         loadUsers: function(uids, callback) {
39880           var toLoad = [];
39881           var cached = [];
39882           utilArrayUniq(uids).forEach(function(uid) {
39883             if (_userCache.user[uid]) {
39884               delete _userCache.toLoad[uid];
39885               cached.push(_userCache.user[uid]);
39886             } else {
39887               toLoad.push(uid);
39888             }
39889           });
39890           if (cached.length || !this.authenticated()) {
39891             callback(void 0, cached);
39892             if (!this.authenticated()) return;
39893           }
39894           utilArrayChunk(toLoad, 150).forEach((function(arr) {
39895             oauth.xhr({
39896               method: "GET",
39897               path: "/api/0.6/users.json?users=" + arr.join()
39898             }, wrapcb(this, done, _connectionID));
39899           }).bind(this));
39900           function done(err, payload) {
39901             if (err) return callback(err);
39902             var options = { skipSeen: true };
39903             return parseUserJSON(payload, function(err2, results) {
39904               if (err2) return callback(err2);
39905               return callback(void 0, results);
39906             }, options);
39907           }
39908         },
39909         // Load a given user by id
39910         // GET /api/0.6/user/#id
39911         loadUser: function(uid, callback) {
39912           if (_userCache.user[uid] || !this.authenticated()) {
39913             delete _userCache.toLoad[uid];
39914             return callback(void 0, _userCache.user[uid]);
39915           }
39916           oauth.xhr({
39917             method: "GET",
39918             path: "/api/0.6/user/" + uid + ".json"
39919           }, wrapcb(this, done, _connectionID));
39920           function done(err, payload) {
39921             if (err) return callback(err);
39922             var options = { skipSeen: true };
39923             return parseUserJSON(payload, function(err2, results) {
39924               if (err2) return callback(err2);
39925               return callback(void 0, results[0]);
39926             }, options);
39927           }
39928         },
39929         // Load the details of the logged-in user
39930         // GET /api/0.6/user/details
39931         userDetails: function(callback) {
39932           if (_userDetails) {
39933             return callback(void 0, _userDetails);
39934           }
39935           oauth.xhr({
39936             method: "GET",
39937             path: "/api/0.6/user/details.json"
39938           }, wrapcb(this, done, _connectionID));
39939           function done(err, payload) {
39940             if (err) return callback(err);
39941             var options = { skipSeen: false };
39942             return parseUserJSON(payload, function(err2, results) {
39943               if (err2) return callback(err2);
39944               _userDetails = results[0];
39945               return callback(void 0, _userDetails);
39946             }, options);
39947           }
39948         },
39949         // Load previous changesets for the logged in user
39950         // GET /api/0.6/changesets?user=#id
39951         userChangesets: function(callback) {
39952           if (_userChangesets) {
39953             return callback(void 0, _userChangesets);
39954           }
39955           this.userDetails(
39956             wrapcb(this, gotDetails, _connectionID)
39957           );
39958           function gotDetails(err, user) {
39959             if (err) {
39960               return callback(err);
39961             }
39962             oauth.xhr({
39963               method: "GET",
39964               path: "/api/0.6/changesets?user=" + user.id
39965             }, wrapcb(this, done, _connectionID));
39966           }
39967           function done(err, xml) {
39968             if (err) {
39969               return callback(err);
39970             }
39971             _userChangesets = Array.prototype.map.call(
39972               xml.getElementsByTagName("changeset"),
39973               function(changeset) {
39974                 return { tags: getTags(changeset) };
39975               }
39976             ).filter(function(changeset) {
39977               var comment = changeset.tags.comment;
39978               return comment && comment !== "";
39979             });
39980             return callback(void 0, _userChangesets);
39981           }
39982         },
39983         // Fetch the status of the OSM API
39984         // GET /api/capabilities
39985         status: function(callback) {
39986           var url = apiUrlroot + "/api/capabilities";
39987           var errback = wrapcb(this, done, _connectionID);
39988           xml_default(url).then(function(data) {
39989             errback(null, data);
39990           }).catch(function(err) {
39991             errback(err.message);
39992           });
39993           function done(err, xml) {
39994             if (err) {
39995               return callback(err, null);
39996             }
39997             var elements = xml.getElementsByTagName("blacklist");
39998             var regexes = [];
39999             for (var i3 = 0; i3 < elements.length; i3++) {
40000               var regexString = elements[i3].getAttribute("regex");
40001               if (regexString) {
40002                 try {
40003                   var regex = new RegExp(regexString);
40004                   regexes.push(regex);
40005                 } catch {
40006                 }
40007               }
40008             }
40009             if (regexes.length) {
40010               _imageryBlocklists = regexes;
40011             }
40012             if (_rateLimitError) {
40013               return callback(_rateLimitError, "rateLimited");
40014             } else {
40015               var waynodes = xml.getElementsByTagName("waynodes");
40016               var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
40017               if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
40018               var apiStatus = xml.getElementsByTagName("status");
40019               var val = apiStatus[0].getAttribute("api");
40020               return callback(void 0, val);
40021             }
40022           }
40023         },
40024         // Calls `status` and dispatches an `apiStatusChange` event if the returned
40025         // status differs from the cached status.
40026         reloadApiStatus: function() {
40027           if (!this.throttledReloadApiStatus) {
40028             var that = this;
40029             this.throttledReloadApiStatus = throttle_default(function() {
40030               that.status(function(err, status) {
40031                 if (status !== _cachedApiStatus) {
40032                   _cachedApiStatus = status;
40033                   dispatch9.call("apiStatusChange", that, err, status);
40034                 }
40035               });
40036             }, 500);
40037           }
40038           this.throttledReloadApiStatus();
40039         },
40040         // Returns the maximum number of nodes a single way can have
40041         maxWayNodes: function() {
40042           return _maxWayNodes;
40043         },
40044         // Load data (entities) from the API in tiles
40045         // GET /api/0.6/map?bbox=
40046         loadTiles: function(projection2, callback) {
40047           if (_off) return;
40048           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
40049           var hadRequests = hasInflightRequests(_tileCache);
40050           abortUnwantedRequests3(_tileCache, tiles);
40051           if (hadRequests && !hasInflightRequests(_tileCache)) {
40052             if (_rateLimitError) {
40053               _rateLimitError = void 0;
40054               dispatch9.call("change");
40055               this.reloadApiStatus();
40056             }
40057             dispatch9.call("loaded");
40058           }
40059           tiles.forEach(function(tile) {
40060             this.loadTile(tile, callback);
40061           }, this);
40062         },
40063         // Load a single data tile
40064         // GET /api/0.6/map?bbox=
40065         loadTile: function(tile, callback) {
40066           if (_off) return;
40067           if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
40068           if (!hasInflightRequests(_tileCache)) {
40069             dispatch9.call("loading");
40070           }
40071           var path = "/api/0.6/map.json?bbox=";
40072           var options = { skipSeen: true };
40073           _tileCache.inflight[tile.id] = this.loadFromAPI(
40074             path + tile.extent.toParam(),
40075             tileCallback.bind(this),
40076             options
40077           );
40078           function tileCallback(err, parsed) {
40079             if (!err) {
40080               delete _tileCache.inflight[tile.id];
40081               delete _tileCache.toLoad[tile.id];
40082               _tileCache.loaded[tile.id] = true;
40083               var bbox2 = tile.extent.bbox();
40084               bbox2.id = tile.id;
40085               _tileCache.rtree.insert(bbox2);
40086             } else {
40087               if (!_rateLimitError && err.status === 509 || err.status === 429) {
40088                 _rateLimitError = err;
40089                 dispatch9.call("change");
40090                 this.reloadApiStatus();
40091               }
40092               setTimeout(() => {
40093                 delete _tileCache.inflight[tile.id];
40094                 this.loadTile(tile, callback);
40095               }, 8e3);
40096             }
40097             if (callback) {
40098               callback(err, Object.assign({ data: parsed }, tile));
40099             }
40100             if (!hasInflightRequests(_tileCache)) {
40101               if (_rateLimitError) {
40102                 _rateLimitError = void 0;
40103                 dispatch9.call("change");
40104                 this.reloadApiStatus();
40105               }
40106               dispatch9.call("loaded");
40107             }
40108           }
40109         },
40110         isDataLoaded: function(loc) {
40111           var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
40112           return _tileCache.rtree.collides(bbox2);
40113         },
40114         // load the tile that covers the given `loc`
40115         loadTileAtLoc: function(loc, callback) {
40116           if (Object.keys(_tileCache.toLoad).length > 50) return;
40117           var k3 = geoZoomToScale(_tileZoom3 + 1);
40118           var offset = geoRawMercator().scale(k3)(loc);
40119           var projection2 = geoRawMercator().transform({ k: k3, x: -offset[0], y: -offset[1] });
40120           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
40121           tiles.forEach(function(tile) {
40122             if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
40123             _tileCache.toLoad[tile.id] = true;
40124             this.loadTile(tile, callback);
40125           }, this);
40126         },
40127         // Load notes from the API in tiles
40128         // GET /api/0.6/notes?bbox=
40129         loadNotes: function(projection2, noteOptions) {
40130           noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
40131           if (_off) return;
40132           var that = this;
40133           var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
40134           var throttleLoadUsers = throttle_default(function() {
40135             var uids = Object.keys(_userCache.toLoad);
40136             if (!uids.length) return;
40137             that.loadUsers(uids, function() {
40138             });
40139           }, 750);
40140           var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
40141           abortUnwantedRequests3(_noteCache, tiles);
40142           tiles.forEach(function(tile) {
40143             if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
40144             var options = { skipSeen: false };
40145             _noteCache.inflight[tile.id] = that.loadFromAPI(
40146               path + tile.extent.toParam(),
40147               function(err) {
40148                 delete _noteCache.inflight[tile.id];
40149                 if (!err) {
40150                   _noteCache.loaded[tile.id] = true;
40151                 }
40152                 throttleLoadUsers();
40153                 dispatch9.call("loadedNotes");
40154               },
40155               options
40156             );
40157           });
40158         },
40159         // Create a note
40160         // POST /api/0.6/notes?params
40161         postNoteCreate: function(note, callback) {
40162           if (!this.authenticated()) {
40163             return callback({ message: "Not Authenticated", status: -3 }, note);
40164           }
40165           if (_noteCache.inflightPost[note.id]) {
40166             return callback({ message: "Note update already inflight", status: -2 }, note);
40167           }
40168           if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
40169           var comment = note.newComment;
40170           if (note.newCategory && note.newCategory !== "None") {
40171             comment += " #" + note.newCategory;
40172           }
40173           var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
40174           _noteCache.inflightPost[note.id] = oauth.xhr({
40175             method: "POST",
40176             path
40177           }, wrapcb(this, done, _connectionID));
40178           function done(err, xml) {
40179             delete _noteCache.inflightPost[note.id];
40180             if (err) {
40181               return callback(err);
40182             }
40183             this.removeNote(note);
40184             var options = { skipSeen: false };
40185             return parseXML(xml, function(err2, results) {
40186               if (err2) {
40187                 return callback(err2);
40188               } else {
40189                 return callback(void 0, results[0]);
40190               }
40191             }, options);
40192           }
40193         },
40194         // Update a note
40195         // POST /api/0.6/notes/#id/comment?text=comment
40196         // POST /api/0.6/notes/#id/close?text=comment
40197         // POST /api/0.6/notes/#id/reopen?text=comment
40198         postNoteUpdate: function(note, newStatus, callback) {
40199           if (!this.authenticated()) {
40200             return callback({ message: "Not Authenticated", status: -3 }, note);
40201           }
40202           if (_noteCache.inflightPost[note.id]) {
40203             return callback({ message: "Note update already inflight", status: -2 }, note);
40204           }
40205           var action;
40206           if (note.status !== "closed" && newStatus === "closed") {
40207             action = "close";
40208           } else if (note.status !== "open" && newStatus === "open") {
40209             action = "reopen";
40210           } else {
40211             action = "comment";
40212             if (!note.newComment) return;
40213           }
40214           var path = "/api/0.6/notes/" + note.id + "/" + action;
40215           if (note.newComment) {
40216             path += "?" + utilQsString({ text: note.newComment });
40217           }
40218           _noteCache.inflightPost[note.id] = oauth.xhr({
40219             method: "POST",
40220             path
40221           }, wrapcb(this, done, _connectionID));
40222           function done(err, xml) {
40223             delete _noteCache.inflightPost[note.id];
40224             if (err) {
40225               return callback(err);
40226             }
40227             this.removeNote(note);
40228             if (action === "close") {
40229               _noteCache.closed[note.id] = true;
40230             } else if (action === "reopen") {
40231               delete _noteCache.closed[note.id];
40232             }
40233             var options = { skipSeen: false };
40234             return parseXML(xml, function(err2, results) {
40235               if (err2) {
40236                 return callback(err2);
40237               } else {
40238                 return callback(void 0, results[0]);
40239               }
40240             }, options);
40241           }
40242         },
40243         /* connection options for source switcher (optional) */
40244         apiConnections: function(val) {
40245           if (!arguments.length) return _apiConnections;
40246           _apiConnections = val;
40247           return this;
40248         },
40249         switch: function(newOptions) {
40250           urlroot = newOptions.url;
40251           apiUrlroot = newOptions.apiUrl || urlroot;
40252           if (newOptions.url && !newOptions.apiUrl) {
40253             newOptions = {
40254               ...newOptions,
40255               apiUrl: newOptions.url
40256             };
40257           }
40258           const oldOptions = utilObjectOmit(oauth.options(), "access_token");
40259           oauth.options({ ...oldOptions, ...newOptions });
40260           this.reset();
40261           this.userChangesets(function() {
40262           });
40263           dispatch9.call("change");
40264           return this;
40265         },
40266         toggle: function(val) {
40267           _off = !val;
40268           return this;
40269         },
40270         isChangesetInflight: function() {
40271           return !!_changeset.inflight;
40272         },
40273         // get/set cached data
40274         // This is used to save/restore the state when entering/exiting the walkthrough
40275         // Also used for testing purposes.
40276         caches: function(obj) {
40277           function cloneCache(source) {
40278             var target = {};
40279             Object.keys(source).forEach(function(k3) {
40280               if (k3 === "rtree") {
40281                 target.rtree = new RBush().fromJSON(source.rtree.toJSON());
40282               } else if (k3 === "note") {
40283                 target.note = {};
40284                 Object.keys(source.note).forEach(function(id2) {
40285                   target.note[id2] = osmNote(source.note[id2]);
40286                 });
40287               } else {
40288                 target[k3] = JSON.parse(JSON.stringify(source[k3]));
40289               }
40290             });
40291             return target;
40292           }
40293           if (!arguments.length) {
40294             return {
40295               tile: cloneCache(_tileCache),
40296               note: cloneCache(_noteCache),
40297               user: cloneCache(_userCache)
40298             };
40299           }
40300           if (obj === "get") {
40301             return {
40302               tile: _tileCache,
40303               note: _noteCache,
40304               user: _userCache
40305             };
40306           }
40307           if (obj.tile) {
40308             _tileCache = obj.tile;
40309             _tileCache.inflight = {};
40310           }
40311           if (obj.note) {
40312             _noteCache = obj.note;
40313             _noteCache.inflight = {};
40314             _noteCache.inflightPost = {};
40315           }
40316           if (obj.user) {
40317             _userCache = obj.user;
40318           }
40319           return this;
40320         },
40321         logout: function() {
40322           _userChangesets = void 0;
40323           _userDetails = void 0;
40324           oauth.logout();
40325           dispatch9.call("change");
40326           return this;
40327         },
40328         authenticated: function() {
40329           return oauth.authenticated();
40330         },
40331         /** @param {import('osm-auth').LoginOptions} options */
40332         authenticate: function(callback, options) {
40333           var that = this;
40334           var cid = _connectionID;
40335           _userChangesets = void 0;
40336           _userDetails = void 0;
40337           function done(err, res) {
40338             if (err) {
40339               if (callback) callback(err);
40340               return;
40341             }
40342             if (that.getConnectionId() !== cid) {
40343               if (callback) callback({ message: "Connection Switched", status: -1 });
40344               return;
40345             }
40346             _rateLimitError = void 0;
40347             dispatch9.call("change");
40348             if (callback) callback(err, res);
40349             that.userChangesets(function() {
40350             });
40351           }
40352           oauth.options({
40353             ...oauth.options(),
40354             locale: _mainLocalizer.localeCode()
40355           });
40356           oauth.authenticate(done, options);
40357         },
40358         imageryBlocklists: function() {
40359           return _imageryBlocklists;
40360         },
40361         tileZoom: function(val) {
40362           if (!arguments.length) return _tileZoom3;
40363           _tileZoom3 = val;
40364           return this;
40365         },
40366         // get all cached notes covering the viewport
40367         notes: function(projection2) {
40368           var viewport = projection2.clipExtent();
40369           var min3 = [viewport[0][0], viewport[1][1]];
40370           var max3 = [viewport[1][0], viewport[0][1]];
40371           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
40372           return _noteCache.rtree.search(bbox2).map(function(d2) {
40373             return d2.data;
40374           });
40375         },
40376         // get a single note from the cache
40377         getNote: function(id2) {
40378           return _noteCache.note[id2];
40379         },
40380         // remove a single note from the cache
40381         removeNote: function(note) {
40382           if (!(note instanceof osmNote) || !note.id) return;
40383           delete _noteCache.note[note.id];
40384           updateRtree3(encodeNoteRtree(note), false);
40385         },
40386         // replace a single note in the cache
40387         replaceNote: function(note) {
40388           if (!(note instanceof osmNote) || !note.id) return;
40389           _noteCache.note[note.id] = note;
40390           updateRtree3(encodeNoteRtree(note), true);
40391           return note;
40392         },
40393         // Get an array of note IDs closed during this session.
40394         // Used to populate `closed:note` changeset tag
40395         getClosedIDs: function() {
40396           return Object.keys(_noteCache.closed).sort();
40397         }
40398       };
40399     }
40400   });
40401
40402   // modules/services/osm_wikibase.js
40403   var osm_wikibase_exports = {};
40404   __export(osm_wikibase_exports, {
40405     default: () => osm_wikibase_default
40406   });
40407   function request(url, callback) {
40408     if (_inflight2[url]) return;
40409     var controller = new AbortController();
40410     _inflight2[url] = controller;
40411     json_default(url, { signal: controller.signal }).then(function(result) {
40412       delete _inflight2[url];
40413       if (callback) callback(null, result);
40414     }).catch(function(err) {
40415       delete _inflight2[url];
40416       if (err.name === "AbortError") return;
40417       if (callback) callback(err.message);
40418     });
40419   }
40420   var apibase3, _inflight2, _wikibaseCache, _localeIDs, debouncedRequest, osm_wikibase_default;
40421   var init_osm_wikibase = __esm({
40422     "modules/services/osm_wikibase.js"() {
40423       "use strict";
40424       init_debounce();
40425       init_src18();
40426       init_localizer();
40427       init_util();
40428       apibase3 = "https://wiki.openstreetmap.org/w/api.php";
40429       _inflight2 = {};
40430       _wikibaseCache = {};
40431       _localeIDs = { en: false };
40432       debouncedRequest = debounce_default(request, 500, { leading: false });
40433       osm_wikibase_default = {
40434         init: function() {
40435           _inflight2 = {};
40436           _wikibaseCache = {};
40437           _localeIDs = {};
40438         },
40439         reset: function() {
40440           Object.values(_inflight2).forEach(function(controller) {
40441             controller.abort();
40442           });
40443           _inflight2 = {};
40444         },
40445         /**
40446          * Get the best value for the property, or undefined if not found
40447          * @param entity object from wikibase
40448          * @param property string e.g. 'P4' for image
40449          * @param langCode string e.g. 'fr' for French
40450          */
40451         claimToValue: function(entity, property, langCode) {
40452           if (!entity.claims[property]) return void 0;
40453           var locale3 = _localeIDs[langCode];
40454           var preferredPick, localePick;
40455           entity.claims[property].forEach(function(stmt) {
40456             if (!preferredPick && stmt.rank === "preferred") {
40457               preferredPick = stmt;
40458             }
40459             if (locale3 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale3) {
40460               localePick = stmt;
40461             }
40462           });
40463           var result = localePick || preferredPick;
40464           if (result) {
40465             var datavalue = result.mainsnak.datavalue;
40466             return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
40467           } else {
40468             return void 0;
40469           }
40470         },
40471         /**
40472          * Convert monolingual property into a key-value object (language -> value)
40473          * @param entity object from wikibase
40474          * @param property string e.g. 'P31' for monolingual wiki page title
40475          */
40476         monolingualClaimToValueObj: function(entity, property) {
40477           if (!entity || !entity.claims[property]) return void 0;
40478           return entity.claims[property].reduce(function(acc, obj) {
40479             var value = obj.mainsnak.datavalue.value;
40480             acc[value.language] = value.text;
40481             return acc;
40482           }, {});
40483         },
40484         toSitelink: function(key, value) {
40485           var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
40486           return result.replace(/_/g, " ").trim();
40487         },
40488         /**
40489          * Converts text like `tag:...=...` into clickable links
40490          *
40491          * @param {string} unsafeText - unsanitized text
40492          */
40493         linkifyWikiText(unsafeText) {
40494           return (selection2) => {
40495             const segments = unsafeText.split(/(key|tag):([\w-]+)(=([\w-]+))?/g);
40496             for (let i3 = 0; i3 < segments.length; i3 += 5) {
40497               const [plainText, , key, , value] = segments.slice(i3);
40498               if (plainText) {
40499                 selection2.append("span").text(plainText);
40500               }
40501               if (key) {
40502                 selection2.append("a").attr("href", `https://wiki.openstreetmap.org/wiki/${this.toSitelink(key, value)}`).attr("target", "_blank").attr("rel", "noreferrer").append("code").text(`${key}=${value || "*"}`);
40503               }
40504             }
40505           };
40506         },
40507         //
40508         // Pass params object of the form:
40509         // {
40510         //   key: 'string',
40511         //   value: 'string',
40512         //   langCode: 'string'
40513         // }
40514         //
40515         getEntity: function(params, callback) {
40516           var doRequest = params.debounce ? debouncedRequest : request;
40517           var that = this;
40518           var titles = [];
40519           var result = {};
40520           var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
40521           var keySitelink = params.key ? this.toSitelink(params.key) : false;
40522           var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
40523           const localeSitelinks = [];
40524           if (params.langCodes) {
40525             params.langCodes.forEach(function(langCode) {
40526               if (_localeIDs[langCode] === void 0) {
40527                 let localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
40528                 titles.push(localeSitelink);
40529                 that.addLocale(langCode, false);
40530               }
40531             });
40532           }
40533           if (rtypeSitelink) {
40534             if (_wikibaseCache[rtypeSitelink]) {
40535               result.rtype = _wikibaseCache[rtypeSitelink];
40536             } else {
40537               titles.push(rtypeSitelink);
40538             }
40539           }
40540           if (keySitelink) {
40541             if (_wikibaseCache[keySitelink]) {
40542               result.key = _wikibaseCache[keySitelink];
40543             } else {
40544               titles.push(keySitelink);
40545             }
40546           }
40547           if (tagSitelink) {
40548             if (_wikibaseCache[tagSitelink]) {
40549               result.tag = _wikibaseCache[tagSitelink];
40550             } else {
40551               titles.push(tagSitelink);
40552             }
40553           }
40554           if (!titles.length) {
40555             return callback(null, result);
40556           }
40557           var obj = {
40558             action: "wbgetentities",
40559             sites: "wiki",
40560             titles: titles.join("|"),
40561             languages: params.langCodes.join("|"),
40562             languagefallback: 1,
40563             origin: "*",
40564             format: "json"
40565             // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
40566             // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
40567             // formatversion: 2,
40568           };
40569           var url = apibase3 + "?" + utilQsString(obj);
40570           doRequest(url, function(err, d2) {
40571             if (err) {
40572               callback(err);
40573             } else if (!d2.success || d2.error) {
40574               callback(d2.error.messages.map(function(v3) {
40575                 return v3.html["*"];
40576               }).join("<br>"));
40577             } else {
40578               Object.values(d2.entities).forEach(function(res) {
40579                 if (res.missing !== "") {
40580                   var title = res.sitelinks.wiki.title;
40581                   if (title === rtypeSitelink) {
40582                     _wikibaseCache[rtypeSitelink] = res;
40583                     result.rtype = res;
40584                   } else if (title === keySitelink) {
40585                     _wikibaseCache[keySitelink] = res;
40586                     result.key = res;
40587                   } else if (title === tagSitelink) {
40588                     _wikibaseCache[tagSitelink] = res;
40589                     result.tag = res;
40590                   } else if (localeSitelinks.includes(title)) {
40591                     const langCode = title.replace(/ /g, "_").replace(/^Locale:/, "");
40592                     that.addLocale(langCode, res.id);
40593                   } else {
40594                     console.log("Unexpected title " + title);
40595                   }
40596                 }
40597               });
40598               callback(null, result);
40599             }
40600           });
40601         },
40602         //
40603         // Pass params object of the form:
40604         // {
40605         //   key: 'string',     // required
40606         //   value: 'string'    // optional
40607         // }
40608         //
40609         // Get an result object used to display tag documentation
40610         // {
40611         //   title:        'string',
40612         //   description:  'string',
40613         //   editURL:      'string',
40614         //   imageURL:     'string',
40615         //   wiki:         { title: 'string', text: 'string', url: 'string' }
40616         // }
40617         //
40618         getDocs: function(params, callback) {
40619           var that = this;
40620           var langCodes = _mainLocalizer.localeCodes().map(function(code) {
40621             return code.toLowerCase();
40622           });
40623           params.langCodes = langCodes;
40624           this.getEntity(params, function(err, data) {
40625             if (err) {
40626               callback(err);
40627               return;
40628             }
40629             var entity = data.rtype || data.tag || data.key;
40630             if (!entity) {
40631               callback("No entity");
40632               return;
40633             }
40634             var i3;
40635             var description;
40636             for (i3 in langCodes) {
40637               let code2 = langCodes[i3];
40638               if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
40639                 description = entity.descriptions[code2];
40640                 break;
40641               }
40642             }
40643             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
40644             var result = {
40645               title: entity.title,
40646               description: that.linkifyWikiText((description == null ? void 0 : description.value) || ""),
40647               descriptionLocaleCode: description ? description.language : "",
40648               editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
40649             };
40650             if (entity.claims) {
40651               var imageroot;
40652               var image = that.claimToValue(entity, "P4", langCodes[0]);
40653               if (image) {
40654                 imageroot = "https://commons.wikimedia.org/w/index.php";
40655               } else {
40656                 image = that.claimToValue(entity, "P28", langCodes[0]);
40657                 if (image) {
40658                   imageroot = "https://wiki.openstreetmap.org/w/index.php";
40659                 }
40660               }
40661               if (imageroot && image) {
40662                 result.imageURL = imageroot + "?" + utilQsString({
40663                   title: "Special:Redirect/file/" + image,
40664                   width: 400
40665                 });
40666               }
40667             }
40668             var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
40669             var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
40670             var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
40671             var wikis = [rtypeWiki, tagWiki, keyWiki];
40672             for (i3 in wikis) {
40673               var wiki = wikis[i3];
40674               for (var j3 in langCodes) {
40675                 var code = langCodes[j3];
40676                 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
40677                 var info = getWikiInfo(wiki, code, referenceId);
40678                 if (info) {
40679                   result.wiki = info;
40680                   break;
40681                 }
40682               }
40683               if (result.wiki) break;
40684             }
40685             callback(null, result);
40686             function getWikiInfo(wiki2, langCode, tKey) {
40687               if (wiki2 && wiki2[langCode]) {
40688                 return {
40689                   title: wiki2[langCode],
40690                   text: tKey,
40691                   url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
40692                 };
40693               }
40694             }
40695           });
40696         },
40697         addLocale: function(langCode, qid) {
40698           _localeIDs[langCode] = qid;
40699         },
40700         apibase: function(val) {
40701           if (!arguments.length) return apibase3;
40702           apibase3 = val;
40703           return this;
40704         }
40705       };
40706     }
40707   });
40708
40709   // modules/services/streetside.js
40710   var streetside_exports = {};
40711   __export(streetside_exports, {
40712     default: () => streetside_default
40713   });
40714   function abortRequest5(i3) {
40715     i3.abort();
40716   }
40717   function localeTimestamp2(s2) {
40718     if (!s2) return null;
40719     const options = { day: "numeric", month: "short", year: "numeric" };
40720     const d2 = new Date(s2);
40721     if (isNaN(d2.getTime())) return null;
40722     return d2.toLocaleString(_mainLocalizer.localeCode(), options);
40723   }
40724   function loadTiles3(which, url, projection2, margin) {
40725     const tiles = tiler6.margin(margin).getTiles(projection2);
40726     const cache = _ssCache[which];
40727     Object.keys(cache.inflight).forEach((k3) => {
40728       const wanted = tiles.find((tile) => k3.indexOf(tile.id + ",") === 0);
40729       if (!wanted) {
40730         abortRequest5(cache.inflight[k3]);
40731         delete cache.inflight[k3];
40732       }
40733     });
40734     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
40735   }
40736   function loadNextTilePage2(which, url, tile) {
40737     const cache = _ssCache[which];
40738     const nextPage = cache.nextPage[tile.id] || 0;
40739     const id2 = tile.id + "," + String(nextPage);
40740     if (cache.loaded[id2] || cache.inflight[id2]) return;
40741     cache.inflight[id2] = getBubbles(url, tile, (response) => {
40742       cache.loaded[id2] = true;
40743       delete cache.inflight[id2];
40744       if (!response) return;
40745       if (response.resourceSets[0].resources.length === maxResults2) {
40746         const split = tile.extent.split();
40747         loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
40748         loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
40749         loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
40750         loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
40751       }
40752       const features = response.resourceSets[0].resources.map((bubble) => {
40753         const bubbleId = bubble.imageUrl;
40754         if (cache.points[bubbleId]) return null;
40755         const loc = [
40756           bubble.lon || bubble.longitude,
40757           bubble.lat || bubble.latitude
40758         ];
40759         const d2 = {
40760           service: "photo",
40761           loc,
40762           key: bubbleId,
40763           imageUrl: bubble.imageUrl.replace("{subdomain}", bubble.imageUrlSubdomains[0]),
40764           ca: bubble.he || bubble.heading,
40765           captured_at: bubble.vintageEnd,
40766           captured_by: "microsoft",
40767           pano: true,
40768           sequenceKey: null
40769         };
40770         cache.points[bubbleId] = d2;
40771         return {
40772           minX: loc[0],
40773           minY: loc[1],
40774           maxX: loc[0],
40775           maxY: loc[1],
40776           data: d2
40777         };
40778       }).filter(Boolean);
40779       cache.rtree.load(features);
40780       if (which === "bubbles") {
40781         dispatch10.call("loadedImages");
40782       }
40783     });
40784   }
40785   function getBubbles(url, tile, callback) {
40786     let rect = tile.extent.rectangle();
40787     let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
40788     const controller = new AbortController();
40789     fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
40790       if (!response.ok) {
40791         throw new Error(response.status + " " + response.statusText);
40792       }
40793       return response.json();
40794     }).then(function(result) {
40795       if (!result) {
40796         callback(null);
40797       }
40798       return callback(result || []);
40799     }).catch(function(err) {
40800       if (err.name === "AbortError") {
40801       } else {
40802         throw new Error(err);
40803       }
40804     });
40805     return controller;
40806   }
40807   function partitionViewport4(projection2) {
40808     let z3 = geoScaleToZoom(projection2.scale());
40809     let z22 = Math.ceil(z3 * 2) / 2 + 2.5;
40810     let tiler8 = utilTiler().zoomExtent([z22, z22]);
40811     return tiler8.getTiles(projection2).map((tile) => tile.extent);
40812   }
40813   function searchLimited4(limit, projection2, rtree) {
40814     limit = limit || 5;
40815     return partitionViewport4(projection2).reduce((result, extent) => {
40816       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
40817       return found.length ? result.concat(found) : result;
40818     }, []);
40819   }
40820   function loadImage2(imgInfo) {
40821     return new Promise((resolve) => {
40822       let img = new Image();
40823       img.onload = () => {
40824         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
40825         let ctx = canvas.getContext("2d");
40826         ctx.drawImage(img, imgInfo.x, imgInfo.y);
40827         resolve({ imgInfo, status: "ok" });
40828       };
40829       img.onerror = () => {
40830         resolve({ data: imgInfo, status: "error" });
40831       };
40832       img.setAttribute("crossorigin", "");
40833       img.src = imgInfo.url;
40834     });
40835   }
40836   function loadCanvas(imageGroup) {
40837     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
40838       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
40839       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
40840       let face = data[0].imgInfo.face;
40841       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
40842       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
40843     });
40844   }
40845   function loadFaces(faceGroup) {
40846     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
40847       return { status: "loadFaces done" };
40848     });
40849   }
40850   function setupCanvas(selection2, reset) {
40851     if (reset) {
40852       selection2.selectAll("#ideditor-stitcher-canvases").remove();
40853     }
40854     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", (d2) => "ideditor-" + d2).attr("width", _resolution).attr("height", _resolution);
40855   }
40856   function qkToXY(qk) {
40857     let x2 = 0;
40858     let y2 = 0;
40859     let scale = 256;
40860     for (let i3 = qk.length; i3 > 0; i3--) {
40861       const key = qk[i3 - 1];
40862       x2 += +(key === "1" || key === "3") * scale;
40863       y2 += +(key === "2" || key === "3") * scale;
40864       scale *= 2;
40865     }
40866     return [x2, y2];
40867   }
40868   function getQuadKeys() {
40869     let dim = _resolution / 256;
40870     let quadKeys;
40871     if (dim === 16) {
40872       quadKeys = [
40873         "0000",
40874         "0001",
40875         "0010",
40876         "0011",
40877         "0100",
40878         "0101",
40879         "0110",
40880         "0111",
40881         "1000",
40882         "1001",
40883         "1010",
40884         "1011",
40885         "1100",
40886         "1101",
40887         "1110",
40888         "1111",
40889         "0002",
40890         "0003",
40891         "0012",
40892         "0013",
40893         "0102",
40894         "0103",
40895         "0112",
40896         "0113",
40897         "1002",
40898         "1003",
40899         "1012",
40900         "1013",
40901         "1102",
40902         "1103",
40903         "1112",
40904         "1113",
40905         "0020",
40906         "0021",
40907         "0030",
40908         "0031",
40909         "0120",
40910         "0121",
40911         "0130",
40912         "0131",
40913         "1020",
40914         "1021",
40915         "1030",
40916         "1031",
40917         "1120",
40918         "1121",
40919         "1130",
40920         "1131",
40921         "0022",
40922         "0023",
40923         "0032",
40924         "0033",
40925         "0122",
40926         "0123",
40927         "0132",
40928         "0133",
40929         "1022",
40930         "1023",
40931         "1032",
40932         "1033",
40933         "1122",
40934         "1123",
40935         "1132",
40936         "1133",
40937         "0200",
40938         "0201",
40939         "0210",
40940         "0211",
40941         "0300",
40942         "0301",
40943         "0310",
40944         "0311",
40945         "1200",
40946         "1201",
40947         "1210",
40948         "1211",
40949         "1300",
40950         "1301",
40951         "1310",
40952         "1311",
40953         "0202",
40954         "0203",
40955         "0212",
40956         "0213",
40957         "0302",
40958         "0303",
40959         "0312",
40960         "0313",
40961         "1202",
40962         "1203",
40963         "1212",
40964         "1213",
40965         "1302",
40966         "1303",
40967         "1312",
40968         "1313",
40969         "0220",
40970         "0221",
40971         "0230",
40972         "0231",
40973         "0320",
40974         "0321",
40975         "0330",
40976         "0331",
40977         "1220",
40978         "1221",
40979         "1230",
40980         "1231",
40981         "1320",
40982         "1321",
40983         "1330",
40984         "1331",
40985         "0222",
40986         "0223",
40987         "0232",
40988         "0233",
40989         "0322",
40990         "0323",
40991         "0332",
40992         "0333",
40993         "1222",
40994         "1223",
40995         "1232",
40996         "1233",
40997         "1322",
40998         "1323",
40999         "1332",
41000         "1333",
41001         "2000",
41002         "2001",
41003         "2010",
41004         "2011",
41005         "2100",
41006         "2101",
41007         "2110",
41008         "2111",
41009         "3000",
41010         "3001",
41011         "3010",
41012         "3011",
41013         "3100",
41014         "3101",
41015         "3110",
41016         "3111",
41017         "2002",
41018         "2003",
41019         "2012",
41020         "2013",
41021         "2102",
41022         "2103",
41023         "2112",
41024         "2113",
41025         "3002",
41026         "3003",
41027         "3012",
41028         "3013",
41029         "3102",
41030         "3103",
41031         "3112",
41032         "3113",
41033         "2020",
41034         "2021",
41035         "2030",
41036         "2031",
41037         "2120",
41038         "2121",
41039         "2130",
41040         "2131",
41041         "3020",
41042         "3021",
41043         "3030",
41044         "3031",
41045         "3120",
41046         "3121",
41047         "3130",
41048         "3131",
41049         "2022",
41050         "2023",
41051         "2032",
41052         "2033",
41053         "2122",
41054         "2123",
41055         "2132",
41056         "2133",
41057         "3022",
41058         "3023",
41059         "3032",
41060         "3033",
41061         "3122",
41062         "3123",
41063         "3132",
41064         "3133",
41065         "2200",
41066         "2201",
41067         "2210",
41068         "2211",
41069         "2300",
41070         "2301",
41071         "2310",
41072         "2311",
41073         "3200",
41074         "3201",
41075         "3210",
41076         "3211",
41077         "3300",
41078         "3301",
41079         "3310",
41080         "3311",
41081         "2202",
41082         "2203",
41083         "2212",
41084         "2213",
41085         "2302",
41086         "2303",
41087         "2312",
41088         "2313",
41089         "3202",
41090         "3203",
41091         "3212",
41092         "3213",
41093         "3302",
41094         "3303",
41095         "3312",
41096         "3313",
41097         "2220",
41098         "2221",
41099         "2230",
41100         "2231",
41101         "2320",
41102         "2321",
41103         "2330",
41104         "2331",
41105         "3220",
41106         "3221",
41107         "3230",
41108         "3231",
41109         "3320",
41110         "3321",
41111         "3330",
41112         "3331",
41113         "2222",
41114         "2223",
41115         "2232",
41116         "2233",
41117         "2322",
41118         "2323",
41119         "2332",
41120         "2333",
41121         "3222",
41122         "3223",
41123         "3232",
41124         "3233",
41125         "3322",
41126         "3323",
41127         "3332",
41128         "3333"
41129       ];
41130     } else if (dim === 8) {
41131       quadKeys = [
41132         "000",
41133         "001",
41134         "010",
41135         "011",
41136         "100",
41137         "101",
41138         "110",
41139         "111",
41140         "002",
41141         "003",
41142         "012",
41143         "013",
41144         "102",
41145         "103",
41146         "112",
41147         "113",
41148         "020",
41149         "021",
41150         "030",
41151         "031",
41152         "120",
41153         "121",
41154         "130",
41155         "131",
41156         "022",
41157         "023",
41158         "032",
41159         "033",
41160         "122",
41161         "123",
41162         "132",
41163         "133",
41164         "200",
41165         "201",
41166         "210",
41167         "211",
41168         "300",
41169         "301",
41170         "310",
41171         "311",
41172         "202",
41173         "203",
41174         "212",
41175         "213",
41176         "302",
41177         "303",
41178         "312",
41179         "313",
41180         "220",
41181         "221",
41182         "230",
41183         "231",
41184         "320",
41185         "321",
41186         "330",
41187         "331",
41188         "222",
41189         "223",
41190         "232",
41191         "233",
41192         "322",
41193         "323",
41194         "332",
41195         "333"
41196       ];
41197     } else if (dim === 4) {
41198       quadKeys = [
41199         "00",
41200         "01",
41201         "10",
41202         "11",
41203         "02",
41204         "03",
41205         "12",
41206         "13",
41207         "20",
41208         "21",
41209         "30",
41210         "31",
41211         "22",
41212         "23",
41213         "32",
41214         "33"
41215       ];
41216     } else {
41217       quadKeys = [
41218         "0",
41219         "1",
41220         "2",
41221         "3"
41222       ];
41223     }
41224     return quadKeys;
41225   }
41226   var streetsideApi, maxResults2, bubbleAppKey, pannellumViewerCSS2, pannellumViewerJS2, tileZoom3, tiler6, dispatch10, minHfov, maxHfov, defaultHfov, _hires, _resolution, _currScene, _ssCache, _pannellumViewer2, _sceneOptions, _loadViewerPromise4, streetside_default;
41227   var init_streetside = __esm({
41228     "modules/services/streetside.js"() {
41229       "use strict";
41230       init_src4();
41231       init_src9();
41232       init_src5();
41233       init_rbush();
41234       init_localizer();
41235       init_geo2();
41236       init_util();
41237       init_services();
41238       streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}&uriScheme=https";
41239       maxResults2 = 500;
41240       bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
41241       pannellumViewerCSS2 = "pannellum/pannellum.css";
41242       pannellumViewerJS2 = "pannellum/pannellum.js";
41243       tileZoom3 = 16.5;
41244       tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
41245       dispatch10 = dispatch_default("loadedImages", "viewerChanged");
41246       minHfov = 10;
41247       maxHfov = 90;
41248       defaultHfov = 45;
41249       _hires = false;
41250       _resolution = 512;
41251       _currScene = 0;
41252       _sceneOptions = {
41253         showFullscreenCtrl: false,
41254         autoLoad: true,
41255         compass: true,
41256         yaw: 0,
41257         minHfov,
41258         maxHfov,
41259         hfov: defaultHfov,
41260         type: "cubemap",
41261         cubeMap: []
41262       };
41263       streetside_default = {
41264         /**
41265          * init() initialize streetside.
41266          */
41267         init: function() {
41268           if (!_ssCache) {
41269             this.reset();
41270           }
41271           this.event = utilRebind(this, dispatch10, "on");
41272         },
41273         /**
41274          * reset() reset the cache.
41275          */
41276         reset: function() {
41277           if (_ssCache) {
41278             Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
41279           }
41280           _ssCache = {
41281             bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
41282             sequences: {}
41283           };
41284         },
41285         /**
41286          * bubbles()
41287          */
41288         bubbles: function(projection2) {
41289           const limit = 5;
41290           return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
41291         },
41292         cachedImage: function(imageKey) {
41293           return _ssCache.bubbles.points[imageKey];
41294         },
41295         sequences: function(projection2) {
41296           const viewport = projection2.clipExtent();
41297           const min3 = [viewport[0][0], viewport[1][1]];
41298           const max3 = [viewport[1][0], viewport[0][1]];
41299           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41300           let seen = {};
41301           let results = [];
41302           _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
41303             const key = d2.data.sequenceKey;
41304             if (key && !seen[key]) {
41305               seen[key] = true;
41306               results.push(_ssCache.sequences[key].geojson);
41307             }
41308           });
41309           return results;
41310         },
41311         /**
41312          * loadBubbles()
41313          */
41314         loadBubbles: function(projection2, margin) {
41315           if (margin === void 0) margin = 2;
41316           loadTiles3("bubbles", streetsideApi, projection2, margin);
41317         },
41318         viewer: function() {
41319           return _pannellumViewer2;
41320         },
41321         initViewer: function() {
41322           if (!window.pannellum) return;
41323           if (_pannellumViewer2) return;
41324           _currScene += 1;
41325           const sceneID = _currScene.toString();
41326           const options = {
41327             "default": { firstScene: sceneID },
41328             scenes: {}
41329           };
41330           options.scenes[sceneID] = _sceneOptions;
41331           _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options);
41332         },
41333         ensureViewerLoaded: function(context) {
41334           if (_loadViewerPromise4) return _loadViewerPromise4;
41335           let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
41336           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
41337           let that = this;
41338           let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
41339           wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
41340             select_default2(window).on(pointerPrefix + "move.streetside", () => {
41341               dispatch10.call("viewerChanged");
41342             }, true);
41343           }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
41344             select_default2(window).on(pointerPrefix + "move.streetside", null);
41345             let t2 = timer((elapsed) => {
41346               dispatch10.call("viewerChanged");
41347               if (elapsed > 2e3) {
41348                 t2.stop();
41349               }
41350             });
41351           }).append("div").attr("class", "photo-attribution fillD");
41352           let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
41353           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
41354           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
41355           wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
41356           context.ui().photoviewer.on("resize.streetside", () => {
41357             if (_pannellumViewer2) {
41358               _pannellumViewer2.resize();
41359             }
41360           });
41361           _loadViewerPromise4 = new Promise((resolve, reject) => {
41362             let loadedCount = 0;
41363             function loaded() {
41364               loadedCount += 1;
41365               if (loadedCount === 2) resolve();
41366             }
41367             const head = select_default2("head");
41368             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(pannellumViewerCSS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
41369               reject();
41370             });
41371             head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
41372               reject();
41373             });
41374           }).catch(function() {
41375             _loadViewerPromise4 = null;
41376           });
41377           return _loadViewerPromise4;
41378           function step(stepBy) {
41379             return () => {
41380               let viewer = context.container().select(".photoviewer");
41381               let selected = viewer.empty() ? void 0 : viewer.datum();
41382               if (!selected) return;
41383               let nextID = stepBy === 1 ? selected.ne : selected.pr;
41384               let yaw = _pannellumViewer2.getYaw();
41385               let ca = selected.ca + yaw;
41386               let origin = selected.loc;
41387               const meters = 35;
41388               let p1 = [
41389                 origin[0] + geoMetersToLon(meters / 5, origin[1]),
41390                 origin[1]
41391               ];
41392               let p2 = [
41393                 origin[0] + geoMetersToLon(meters / 2, origin[1]),
41394                 origin[1] + geoMetersToLat(meters)
41395               ];
41396               let p3 = [
41397                 origin[0] - geoMetersToLon(meters / 2, origin[1]),
41398                 origin[1] + geoMetersToLat(meters)
41399               ];
41400               let p4 = [
41401                 origin[0] - geoMetersToLon(meters / 5, origin[1]),
41402                 origin[1]
41403               ];
41404               let poly = [p1, p2, p3, p4, p1];
41405               let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
41406               poly = geoRotate(poly, -angle2, origin);
41407               let extent = poly.reduce((extent2, point) => {
41408                 return extent2.extend(geoExtent(point));
41409               }, geoExtent());
41410               let minDist = Infinity;
41411               _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
41412                 if (d2.data.key === selected.key) return;
41413                 if (!geoPointInPolygon(d2.data.loc, poly)) return;
41414                 let dist = geoVecLength(d2.data.loc, selected.loc);
41415                 let theta = selected.ca - d2.data.ca;
41416                 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
41417                 if (minTheta > 20) {
41418                   dist += 5;
41419                 }
41420                 if (dist < minDist) {
41421                   nextID = d2.data.key;
41422                   minDist = dist;
41423                 }
41424               });
41425               let nextBubble = nextID && that.cachedImage(nextID);
41426               if (!nextBubble) return;
41427               context.map().centerEase(nextBubble.loc);
41428               that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
41429             };
41430           }
41431         },
41432         yaw: function(yaw) {
41433           if (typeof yaw !== "number") return yaw;
41434           _sceneOptions.yaw = yaw;
41435           return this;
41436         },
41437         /**
41438          * showViewer()
41439          */
41440         showViewer: function(context) {
41441           const wrap2 = context.container().select(".photoviewer");
41442           const isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
41443           if (isHidden) {
41444             for (const service of Object.values(services)) {
41445               if (service === this) continue;
41446               if (typeof service.hideViewer === "function") {
41447                 service.hideViewer(context);
41448               }
41449             }
41450             wrap2.classed("hide", false).selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
41451           }
41452           return this;
41453         },
41454         /**
41455          * hideViewer()
41456          */
41457         hideViewer: function(context) {
41458           let viewer = context.container().select(".photoviewer");
41459           if (!viewer.empty()) viewer.datum(null);
41460           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41461           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
41462           this.updateUrlImage(null);
41463           return this.setStyles(context, null, true);
41464         },
41465         /**
41466          * selectImage().
41467          */
41468         selectImage: function(context, key) {
41469           let that = this;
41470           let d2 = this.cachedImage(key);
41471           let viewer = context.container().select(".photoviewer");
41472           if (!viewer.empty()) viewer.datum(d2);
41473           this.setStyles(context, null, true);
41474           let wrap2 = context.container().select(".photoviewer .ms-wrapper");
41475           let attribution = wrap2.selectAll(".photo-attribution").html("");
41476           wrap2.selectAll(".pnlm-load-box").style("display", "block");
41477           if (!d2) return this;
41478           this.updateUrlImage(key);
41479           _sceneOptions.northOffset = d2.ca;
41480           let line1 = attribution.append("div").attr("class", "attribution-row");
41481           const hiresDomId = utilUniqueDomId("streetside-hires");
41482           let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
41483           label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
41484             d3_event.stopPropagation();
41485             _hires = !_hires;
41486             _resolution = _hires ? 1024 : 512;
41487             wrap2.call(setupCanvas, true);
41488             let viewstate = {
41489               yaw: _pannellumViewer2.getYaw(),
41490               pitch: _pannellumViewer2.getPitch(),
41491               hfov: _pannellumViewer2.getHfov()
41492             };
41493             _sceneOptions = Object.assign(_sceneOptions, viewstate);
41494             that.selectImage(context, d2.key).showViewer(context);
41495           });
41496           label.append("span").call(_t.append("streetside.hires"));
41497           let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
41498           if (d2.captured_by) {
41499             const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
41500             captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
41501             captureInfo.append("span").text("|");
41502           }
41503           if (d2.captured_at) {
41504             captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
41505           }
41506           let line2 = attribution.append("div").attr("class", "attribution-row");
41507           line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d2.loc[1] + "~" + d2.loc[0] + "&lvl=17&dir=" + d2.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
41508           line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d2.key) + "&focus=photo&lat=" + d2.loc[1] + "&lng=" + d2.loc[0] + "&z=17").call(_t.append("streetside.report"));
41509           const faceKeys = ["01", "02", "03", "10", "11", "12"];
41510           let quadKeys = getQuadKeys();
41511           let faces = faceKeys.map((faceKey) => {
41512             return quadKeys.map((quadKey) => {
41513               const xy = qkToXY(quadKey);
41514               return {
41515                 face: faceKey,
41516                 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
41517                 x: xy[0],
41518                 y: xy[1]
41519               };
41520             });
41521           });
41522           loadFaces(faces).then(function() {
41523             if (!_pannellumViewer2) {
41524               that.initViewer();
41525             } else {
41526               _currScene += 1;
41527               let sceneID = _currScene.toString();
41528               _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
41529               if (_currScene > 2) {
41530                 sceneID = (_currScene - 1).toString();
41531                 _pannellumViewer2.removeScene(sceneID);
41532               }
41533             }
41534           });
41535           return this;
41536         },
41537         getSequenceKeyForBubble: function(d2) {
41538           return d2 && d2.sequenceKey;
41539         },
41540         // Updates the currently highlighted sequence and selected bubble.
41541         // Reset is only necessary when interacting with the viewport because
41542         // this implicitly changes the currently selected bubble/sequence
41543         setStyles: function(context, hovered, reset) {
41544           if (reset) {
41545             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
41546             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
41547           }
41548           let hoveredBubbleKey = hovered && hovered.key;
41549           let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
41550           let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
41551           let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
41552           let viewer = context.container().select(".photoviewer");
41553           let selected = viewer.empty() ? void 0 : viewer.datum();
41554           let selectedBubbleKey = selected && selected.key;
41555           let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
41556           let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
41557           let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
41558           let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
41559           context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d2) => highlightedBubbleKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredBubbleKey).classed("currentView", (d2) => d2.key === selectedBubbleKey);
41560           context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
41561           context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
41562           function viewfieldPath() {
41563             let d2 = this.parentNode.__data__;
41564             if (d2.pano && d2.key !== selectedBubbleKey) {
41565               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
41566             } else {
41567               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
41568             }
41569           }
41570           return this;
41571         },
41572         updateUrlImage: function(imageKey) {
41573           const hash2 = utilStringQs(window.location.hash);
41574           if (imageKey) {
41575             hash2.photo = "streetside/" + imageKey;
41576           } else {
41577             delete hash2.photo;
41578           }
41579           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
41580         },
41581         /**
41582          * cache().
41583          */
41584         cache: function() {
41585           return _ssCache;
41586         }
41587       };
41588     }
41589   });
41590
41591   // modules/services/taginfo.js
41592   var taginfo_exports = {};
41593   __export(taginfo_exports, {
41594     default: () => taginfo_default
41595   });
41596   function sets(params, n3, o2) {
41597     if (params.geometry && o2[params.geometry]) {
41598       params[n3] = o2[params.geometry];
41599     }
41600     return params;
41601   }
41602   function setFilter(params) {
41603     return sets(params, "filter", tag_filters);
41604   }
41605   function setSort(params) {
41606     return sets(params, "sortname", tag_sorts);
41607   }
41608   function setSortMembers(params) {
41609     return sets(params, "sortname", tag_sort_members);
41610   }
41611   function clean(params) {
41612     return utilObjectOmit(params, ["geometry", "debounce"]);
41613   }
41614   function filterKeys(type2) {
41615     var count_type = type2 ? "count_" + type2 : "count_all";
41616     return function(d2) {
41617       return Number(d2[count_type]) > 2500 || d2.in_wiki;
41618     };
41619   }
41620   function filterMultikeys(prefix) {
41621     return function(d2) {
41622       var re4 = new RegExp("^" + prefix + "(.*)$", "i");
41623       var matches = d2.key.match(re4) || [];
41624       return matches.length === 2 && matches[1].indexOf(":") === -1;
41625     };
41626   }
41627   function filterValues(allowUpperCase) {
41628     return function(d2) {
41629       if (d2.value.match(/[;,]/) !== null) return false;
41630       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
41631       return d2.count > 100 || d2.in_wiki;
41632     };
41633   }
41634   function filterRoles(geometry) {
41635     return function(d2) {
41636       if (d2.role === "") return false;
41637       if (d2.role.match(/[A-Z*;,]/) !== null) return false;
41638       return Number(d2[tag_members_fractions[geometry]]) > 0;
41639     };
41640   }
41641   function valKey(d2) {
41642     return {
41643       value: d2.key,
41644       title: d2.key
41645     };
41646   }
41647   function valKeyDescription(d2) {
41648     var obj = {
41649       value: d2.value,
41650       title: d2.description || d2.value
41651     };
41652     return obj;
41653   }
41654   function roleKey(d2) {
41655     return {
41656       value: d2.role,
41657       title: d2.role
41658     };
41659   }
41660   function sortKeys(a4, b3) {
41661     return a4.key.indexOf(":") === -1 && b3.key.indexOf(":") !== -1 ? -1 : a4.key.indexOf(":") !== -1 && b3.key.indexOf(":") === -1 ? 1 : 0;
41662   }
41663   function request2(url, params, exactMatch, callback, loaded) {
41664     if (_inflight3[url]) return;
41665     if (checkCache(url, params, exactMatch, callback)) return;
41666     var controller = new AbortController();
41667     _inflight3[url] = controller;
41668     json_default(url, { signal: controller.signal }).then(function(result) {
41669       delete _inflight3[url];
41670       if (loaded) loaded(null, result);
41671     }).catch(function(err) {
41672       delete _inflight3[url];
41673       if (err.name === "AbortError") return;
41674       if (loaded) loaded(err.message);
41675     });
41676   }
41677   function checkCache(url, params, exactMatch, callback) {
41678     var rp = params.rp || 25;
41679     var testQuery = params.query || "";
41680     var testUrl = url;
41681     do {
41682       var hit = _taginfoCache[testUrl];
41683       if (hit && (url === testUrl || hit.length < rp)) {
41684         callback(null, hit);
41685         return true;
41686       }
41687       if (exactMatch || !testQuery.length) return false;
41688       testQuery = testQuery.slice(0, -1);
41689       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
41690     } while (testQuery.length >= 0);
41691     return false;
41692   }
41693   var apibase4, _inflight3, _popularKeys, _taginfoCache, tag_sorts, tag_sort_members, tag_filters, tag_members_fractions, debouncedRequest2, taginfo_default;
41694   var init_taginfo = __esm({
41695     "modules/services/taginfo.js"() {
41696       "use strict";
41697       init_debounce();
41698       init_src18();
41699       init_util();
41700       init_localizer();
41701       init_tags();
41702       init_id();
41703       apibase4 = taginfoApiUrl;
41704       _inflight3 = {};
41705       _popularKeys = {};
41706       _taginfoCache = {};
41707       tag_sorts = {
41708         point: "count_nodes",
41709         vertex: "count_nodes",
41710         area: "count_ways",
41711         line: "count_ways"
41712       };
41713       tag_sort_members = {
41714         point: "count_node_members",
41715         vertex: "count_node_members",
41716         area: "count_way_members",
41717         line: "count_way_members",
41718         relation: "count_relation_members"
41719       };
41720       tag_filters = {
41721         point: "nodes",
41722         vertex: "nodes",
41723         area: "ways",
41724         line: "ways"
41725       };
41726       tag_members_fractions = {
41727         point: "count_node_members_fraction",
41728         vertex: "count_node_members_fraction",
41729         area: "count_way_members_fraction",
41730         line: "count_way_members_fraction",
41731         relation: "count_relation_members_fraction"
41732       };
41733       debouncedRequest2 = debounce_default(request2, 300, { leading: false });
41734       taginfo_default = {
41735         init: function() {
41736           _inflight3 = {};
41737           _taginfoCache = {};
41738           _popularKeys = {
41739             // manually exclude some keys – #5377, #7485
41740             postal_code: true,
41741             full_name: true,
41742             loc_name: true,
41743             reg_name: true,
41744             short_name: true,
41745             sorting_name: true,
41746             artist_name: true,
41747             nat_name: true,
41748             long_name: true,
41749             via: true,
41750             "bridge:name": true
41751           };
41752           var params = {
41753             rp: 100,
41754             sortname: "values_all",
41755             sortorder: "desc",
41756             page: 1,
41757             debounce: false,
41758             lang: _mainLocalizer.languageCode()
41759           };
41760           this.keys(params, function(err, data) {
41761             if (err) return;
41762             data.forEach(function(d2) {
41763               if (d2.value === "opening_hours") return;
41764               _popularKeys[d2.value] = true;
41765             });
41766           });
41767         },
41768         reset: function() {
41769           Object.values(_inflight3).forEach(function(controller) {
41770             controller.abort();
41771           });
41772           _inflight3 = {};
41773         },
41774         keys: function(params, callback) {
41775           var doRequest = params.debounce ? debouncedRequest2 : request2;
41776           params = clean(setSort(params));
41777           params = Object.assign({
41778             rp: 10,
41779             sortname: "count_all",
41780             sortorder: "desc",
41781             page: 1,
41782             lang: _mainLocalizer.languageCode()
41783           }, params);
41784           var url = apibase4 + "keys/all?" + utilQsString(params);
41785           doRequest(url, params, false, callback, function(err, d2) {
41786             if (err) {
41787               callback(err);
41788             } else {
41789               var f2 = filterKeys(params.filter);
41790               var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
41791               _taginfoCache[url] = result;
41792               callback(null, result);
41793             }
41794           });
41795         },
41796         multikeys: function(params, callback) {
41797           var doRequest = params.debounce ? debouncedRequest2 : request2;
41798           params = clean(setSort(params));
41799           params = Object.assign({
41800             rp: 25,
41801             sortname: "count_all",
41802             sortorder: "desc",
41803             page: 1,
41804             lang: _mainLocalizer.languageCode()
41805           }, params);
41806           var prefix = params.query;
41807           var url = apibase4 + "keys/all?" + utilQsString(params);
41808           doRequest(url, params, true, callback, function(err, d2) {
41809             if (err) {
41810               callback(err);
41811             } else {
41812               var f2 = filterMultikeys(prefix);
41813               var result = d2.data.filter(f2).map(valKey);
41814               _taginfoCache[url] = result;
41815               callback(null, result);
41816             }
41817           });
41818         },
41819         values: function(params, callback) {
41820           var key = params.key;
41821           if (key && _popularKeys[key]) {
41822             callback(null, []);
41823             return;
41824           }
41825           var doRequest = params.debounce ? debouncedRequest2 : request2;
41826           params = clean(setSort(setFilter(params)));
41827           params = Object.assign({
41828             rp: 25,
41829             sortname: "count_all",
41830             sortorder: "desc",
41831             page: 1,
41832             lang: _mainLocalizer.languageCode()
41833           }, params);
41834           var url = apibase4 + "key/values?" + utilQsString(params);
41835           doRequest(url, params, false, callback, function(err, d2) {
41836             if (err) {
41837               callback(err);
41838             } else {
41839               var allowUpperCase = allowUpperCaseTagValues.test(params.key);
41840               var f2 = filterValues(allowUpperCase);
41841               var result = d2.data.filter(f2).map(valKeyDescription);
41842               _taginfoCache[url] = result;
41843               callback(null, result);
41844             }
41845           });
41846         },
41847         roles: function(params, callback) {
41848           var doRequest = params.debounce ? debouncedRequest2 : request2;
41849           var geometry = params.geometry;
41850           params = clean(setSortMembers(params));
41851           params = Object.assign({
41852             rp: 25,
41853             sortname: "count_all_members",
41854             sortorder: "desc",
41855             page: 1,
41856             lang: _mainLocalizer.languageCode()
41857           }, params);
41858           var url = apibase4 + "relation/roles?" + utilQsString(params);
41859           doRequest(url, params, true, callback, function(err, d2) {
41860             if (err) {
41861               callback(err);
41862             } else {
41863               var f2 = filterRoles(geometry);
41864               var result = d2.data.filter(f2).map(roleKey);
41865               _taginfoCache[url] = result;
41866               callback(null, result);
41867             }
41868           });
41869         },
41870         docs: function(params, callback) {
41871           var doRequest = params.debounce ? debouncedRequest2 : request2;
41872           params = clean(setSort(params));
41873           var path = "key/wiki_pages?";
41874           if (params.value) {
41875             path = "tag/wiki_pages?";
41876           } else if (params.rtype) {
41877             path = "relation/wiki_pages?";
41878           }
41879           var url = apibase4 + path + utilQsString(params);
41880           doRequest(url, params, true, callback, function(err, d2) {
41881             if (err) {
41882               callback(err);
41883             } else {
41884               _taginfoCache[url] = d2.data;
41885               callback(null, d2.data);
41886             }
41887           });
41888         },
41889         apibase: function(_3) {
41890           if (!arguments.length) return apibase4;
41891           apibase4 = _3;
41892           return this;
41893         }
41894       };
41895     }
41896   });
41897
41898   // node_modules/@turf/helpers/dist/esm/index.js
41899   function feature2(geom, properties, options = {}) {
41900     const feat = { type: "Feature" };
41901     if (options.id === 0 || options.id) {
41902       feat.id = options.id;
41903     }
41904     if (options.bbox) {
41905       feat.bbox = options.bbox;
41906     }
41907     feat.properties = properties || {};
41908     feat.geometry = geom;
41909     return feat;
41910   }
41911   function polygon(coordinates, properties, options = {}) {
41912     for (const ring of coordinates) {
41913       if (ring.length < 4) {
41914         throw new Error(
41915           "Each LinearRing of a Polygon must have 4 or more Positions."
41916         );
41917       }
41918       if (ring[ring.length - 1].length !== ring[0].length) {
41919         throw new Error("First and last Position are not equivalent.");
41920       }
41921       for (let j3 = 0; j3 < ring[ring.length - 1].length; j3++) {
41922         if (ring[ring.length - 1][j3] !== ring[0][j3]) {
41923           throw new Error("First and last Position are not equivalent.");
41924         }
41925       }
41926     }
41927     const geom = {
41928       type: "Polygon",
41929       coordinates
41930     };
41931     return feature2(geom, properties, options);
41932   }
41933   function lineString(coordinates, properties, options = {}) {
41934     if (coordinates.length < 2) {
41935       throw new Error("coordinates must be an array of two or more positions");
41936     }
41937     const geom = {
41938       type: "LineString",
41939       coordinates
41940     };
41941     return feature2(geom, properties, options);
41942   }
41943   function multiLineString(coordinates, properties, options = {}) {
41944     const geom = {
41945       type: "MultiLineString",
41946       coordinates
41947     };
41948     return feature2(geom, properties, options);
41949   }
41950   function multiPolygon(coordinates, properties, options = {}) {
41951     const geom = {
41952       type: "MultiPolygon",
41953       coordinates
41954     };
41955     return feature2(geom, properties, options);
41956   }
41957   var earthRadius, factors;
41958   var init_esm3 = __esm({
41959     "node_modules/@turf/helpers/dist/esm/index.js"() {
41960       earthRadius = 63710088e-1;
41961       factors = {
41962         centimeters: earthRadius * 100,
41963         centimetres: earthRadius * 100,
41964         degrees: 360 / (2 * Math.PI),
41965         feet: earthRadius * 3.28084,
41966         inches: earthRadius * 39.37,
41967         kilometers: earthRadius / 1e3,
41968         kilometres: earthRadius / 1e3,
41969         meters: earthRadius,
41970         metres: earthRadius,
41971         miles: earthRadius / 1609.344,
41972         millimeters: earthRadius * 1e3,
41973         millimetres: earthRadius * 1e3,
41974         nauticalmiles: earthRadius / 1852,
41975         radians: 1,
41976         yards: earthRadius * 1.0936
41977       };
41978     }
41979   });
41980
41981   // node_modules/@turf/invariant/dist/esm/index.js
41982   function getGeom(geojson) {
41983     if (geojson.type === "Feature") {
41984       return geojson.geometry;
41985     }
41986     return geojson;
41987   }
41988   var init_esm4 = __esm({
41989     "node_modules/@turf/invariant/dist/esm/index.js"() {
41990     }
41991   });
41992
41993   // node_modules/@turf/bbox-clip/dist/esm/index.js
41994   function lineclip(points, bbox2, result) {
41995     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
41996     let a4;
41997     let b3;
41998     if (!result) result = [];
41999     for (i3 = 1; i3 < len; i3++) {
42000       a4 = points[i3 - 1];
42001       b3 = points[i3];
42002       codeB = lastCode = bitCode(b3, bbox2);
42003       while (true) {
42004         if (!(codeA | codeB)) {
42005           part.push(a4);
42006           if (codeB !== lastCode) {
42007             part.push(b3);
42008             if (i3 < len - 1) {
42009               result.push(part);
42010               part = [];
42011             }
42012           } else if (i3 === len - 1) {
42013             part.push(b3);
42014           }
42015           break;
42016         } else if (codeA & codeB) {
42017           break;
42018         } else if (codeA) {
42019           a4 = intersect(a4, b3, codeA, bbox2);
42020           codeA = bitCode(a4, bbox2);
42021         } else {
42022           b3 = intersect(a4, b3, codeB, bbox2);
42023           codeB = bitCode(b3, bbox2);
42024         }
42025       }
42026       codeA = lastCode;
42027     }
42028     if (part.length) result.push(part);
42029     return result;
42030   }
42031   function polygonclip(points, bbox2) {
42032     var result, edge, prev, prevInside, i3, p2, inside;
42033     for (edge = 1; edge <= 8; edge *= 2) {
42034       result = [];
42035       prev = points[points.length - 1];
42036       prevInside = !(bitCode(prev, bbox2) & edge);
42037       for (i3 = 0; i3 < points.length; i3++) {
42038         p2 = points[i3];
42039         inside = !(bitCode(p2, bbox2) & edge);
42040         if (inside !== prevInside) result.push(intersect(prev, p2, edge, bbox2));
42041         if (inside) result.push(p2);
42042         prev = p2;
42043         prevInside = inside;
42044       }
42045       points = result;
42046       if (!points.length) break;
42047     }
42048     return result;
42049   }
42050   function intersect(a4, b3, edge, bbox2) {
42051     return edge & 8 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[3] - a4[1]) / (b3[1] - a4[1]), bbox2[3]] : edge & 4 ? [a4[0] + (b3[0] - a4[0]) * (bbox2[1] - a4[1]) / (b3[1] - a4[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a4[1] + (b3[1] - a4[1]) * (bbox2[2] - a4[0]) / (b3[0] - a4[0])] : edge & 1 ? [bbox2[0], a4[1] + (b3[1] - a4[1]) * (bbox2[0] - a4[0]) / (b3[0] - a4[0])] : null;
42052   }
42053   function bitCode(p2, bbox2) {
42054     var code = 0;
42055     if (p2[0] < bbox2[0]) code |= 1;
42056     else if (p2[0] > bbox2[2]) code |= 2;
42057     if (p2[1] < bbox2[1]) code |= 4;
42058     else if (p2[1] > bbox2[3]) code |= 8;
42059     return code;
42060   }
42061   function bboxClip(feature3, bbox2) {
42062     const geom = getGeom(feature3);
42063     const type2 = geom.type;
42064     const properties = feature3.type === "Feature" ? feature3.properties : {};
42065     let coords = geom.coordinates;
42066     switch (type2) {
42067       case "LineString":
42068       case "MultiLineString": {
42069         const lines = [];
42070         if (type2 === "LineString") {
42071           coords = [coords];
42072         }
42073         coords.forEach((line) => {
42074           lineclip(line, bbox2, lines);
42075         });
42076         if (lines.length === 1) {
42077           return lineString(lines[0], properties);
42078         }
42079         return multiLineString(lines, properties);
42080       }
42081       case "Polygon":
42082         return polygon(clipPolygon(coords, bbox2), properties);
42083       case "MultiPolygon":
42084         return multiPolygon(
42085           coords.map((poly) => {
42086             return clipPolygon(poly, bbox2);
42087           }),
42088           properties
42089         );
42090       default:
42091         throw new Error("geometry " + type2 + " not supported");
42092     }
42093   }
42094   function clipPolygon(rings, bbox2) {
42095     const outRings = [];
42096     for (const ring of rings) {
42097       const clipped = polygonclip(ring, bbox2);
42098       if (clipped.length > 0) {
42099         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
42100           clipped.push(clipped[0]);
42101         }
42102         if (clipped.length >= 4) {
42103           outRings.push(clipped);
42104         }
42105       }
42106     }
42107     return outRings;
42108   }
42109   var turf_bbox_clip_default;
42110   var init_esm5 = __esm({
42111     "node_modules/@turf/bbox-clip/dist/esm/index.js"() {
42112       init_esm3();
42113       init_esm4();
42114       turf_bbox_clip_default = bboxClip;
42115     }
42116   });
42117
42118   // node_modules/fast-json-stable-stringify/index.js
42119   var require_fast_json_stable_stringify = __commonJS({
42120     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
42121       "use strict";
42122       module2.exports = function(data, opts) {
42123         if (!opts) opts = {};
42124         if (typeof opts === "function") opts = { cmp: opts };
42125         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
42126         var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
42127           return function(node) {
42128             return function(a4, b3) {
42129               var aobj = { key: a4, value: node[a4] };
42130               var bobj = { key: b3, value: node[b3] };
42131               return f2(aobj, bobj);
42132             };
42133           };
42134         }(opts.cmp);
42135         var seen = [];
42136         return function stringify3(node) {
42137           if (node && node.toJSON && typeof node.toJSON === "function") {
42138             node = node.toJSON();
42139           }
42140           if (node === void 0) return;
42141           if (typeof node == "number") return isFinite(node) ? "" + node : "null";
42142           if (typeof node !== "object") return JSON.stringify(node);
42143           var i3, out;
42144           if (Array.isArray(node)) {
42145             out = "[";
42146             for (i3 = 0; i3 < node.length; i3++) {
42147               if (i3) out += ",";
42148               out += stringify3(node[i3]) || "null";
42149             }
42150             return out + "]";
42151           }
42152           if (node === null) return "null";
42153           if (seen.indexOf(node) !== -1) {
42154             if (cycles) return JSON.stringify("__cycle__");
42155             throw new TypeError("Converting circular structure to JSON");
42156           }
42157           var seenIndex = seen.push(node) - 1;
42158           var keys2 = Object.keys(node).sort(cmp && cmp(node));
42159           out = "";
42160           for (i3 = 0; i3 < keys2.length; i3++) {
42161             var key = keys2[i3];
42162             var value = stringify3(node[key]);
42163             if (!value) continue;
42164             if (out) out += ",";
42165             out += JSON.stringify(key) + ":" + value;
42166           }
42167           seen.splice(seenIndex, 1);
42168           return "{" + out + "}";
42169         }(data);
42170       };
42171     }
42172   });
42173
42174   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
42175   var require_polygon_clipping_umd = __commonJS({
42176     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
42177       (function(global2, factory) {
42178         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.polygonClipping = factory());
42179       })(exports2, function() {
42180         "use strict";
42181         function __generator(thisArg, body) {
42182           var _3 = {
42183             label: 0,
42184             sent: function() {
42185               if (t2[0] & 1) throw t2[1];
42186               return t2[1];
42187             },
42188             trys: [],
42189             ops: []
42190           }, f2, y2, t2, g3;
42191           return g3 = {
42192             next: verb(0),
42193             "throw": verb(1),
42194             "return": verb(2)
42195           }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
42196             return this;
42197           }), g3;
42198           function verb(n3) {
42199             return function(v3) {
42200               return step([n3, v3]);
42201             };
42202           }
42203           function step(op) {
42204             if (f2) throw new TypeError("Generator is already executing.");
42205             while (_3) try {
42206               if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2;
42207               if (y2 = 0, t2) op = [op[0] & 2, t2.value];
42208               switch (op[0]) {
42209                 case 0:
42210                 case 1:
42211                   t2 = op;
42212                   break;
42213                 case 4:
42214                   _3.label++;
42215                   return {
42216                     value: op[1],
42217                     done: false
42218                   };
42219                 case 5:
42220                   _3.label++;
42221                   y2 = op[1];
42222                   op = [0];
42223                   continue;
42224                 case 7:
42225                   op = _3.ops.pop();
42226                   _3.trys.pop();
42227                   continue;
42228                 default:
42229                   if (!(t2 = _3.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
42230                     _3 = 0;
42231                     continue;
42232                   }
42233                   if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
42234                     _3.label = op[1];
42235                     break;
42236                   }
42237                   if (op[0] === 6 && _3.label < t2[1]) {
42238                     _3.label = t2[1];
42239                     t2 = op;
42240                     break;
42241                   }
42242                   if (t2 && _3.label < t2[2]) {
42243                     _3.label = t2[2];
42244                     _3.ops.push(op);
42245                     break;
42246                   }
42247                   if (t2[2]) _3.ops.pop();
42248                   _3.trys.pop();
42249                   continue;
42250               }
42251               op = body.call(thisArg, _3);
42252             } catch (e3) {
42253               op = [6, e3];
42254               y2 = 0;
42255             } finally {
42256               f2 = t2 = 0;
42257             }
42258             if (op[0] & 5) throw op[1];
42259             return {
42260               value: op[0] ? op[1] : void 0,
42261               done: true
42262             };
42263           }
42264         }
42265         var Node = (
42266           /** @class */
42267           /* @__PURE__ */ function() {
42268             function Node2(key, data) {
42269               this.next = null;
42270               this.key = key;
42271               this.data = data;
42272               this.left = null;
42273               this.right = null;
42274             }
42275             return Node2;
42276           }()
42277         );
42278         function DEFAULT_COMPARE(a4, b3) {
42279           return a4 > b3 ? 1 : a4 < b3 ? -1 : 0;
42280         }
42281         function splay(i3, t2, comparator) {
42282           var N3 = new Node(null, null);
42283           var l2 = N3;
42284           var r2 = N3;
42285           while (true) {
42286             var cmp2 = comparator(i3, t2.key);
42287             if (cmp2 < 0) {
42288               if (t2.left === null) break;
42289               if (comparator(i3, t2.left.key) < 0) {
42290                 var y2 = t2.left;
42291                 t2.left = y2.right;
42292                 y2.right = t2;
42293                 t2 = y2;
42294                 if (t2.left === null) break;
42295               }
42296               r2.left = t2;
42297               r2 = t2;
42298               t2 = t2.left;
42299             } else if (cmp2 > 0) {
42300               if (t2.right === null) break;
42301               if (comparator(i3, t2.right.key) > 0) {
42302                 var y2 = t2.right;
42303                 t2.right = y2.left;
42304                 y2.left = t2;
42305                 t2 = y2;
42306                 if (t2.right === null) break;
42307               }
42308               l2.right = t2;
42309               l2 = t2;
42310               t2 = t2.right;
42311             } else break;
42312           }
42313           l2.right = t2.left;
42314           r2.left = t2.right;
42315           t2.left = N3.right;
42316           t2.right = N3.left;
42317           return t2;
42318         }
42319         function insert(i3, data, t2, comparator) {
42320           var node = new Node(i3, data);
42321           if (t2 === null) {
42322             node.left = node.right = null;
42323             return node;
42324           }
42325           t2 = splay(i3, t2, comparator);
42326           var cmp2 = comparator(i3, t2.key);
42327           if (cmp2 < 0) {
42328             node.left = t2.left;
42329             node.right = t2;
42330             t2.left = null;
42331           } else if (cmp2 >= 0) {
42332             node.right = t2.right;
42333             node.left = t2;
42334             t2.right = null;
42335           }
42336           return node;
42337         }
42338         function split(key, v3, comparator) {
42339           var left = null;
42340           var right = null;
42341           if (v3) {
42342             v3 = splay(key, v3, comparator);
42343             var cmp2 = comparator(v3.key, key);
42344             if (cmp2 === 0) {
42345               left = v3.left;
42346               right = v3.right;
42347             } else if (cmp2 < 0) {
42348               right = v3.right;
42349               v3.right = null;
42350               left = v3;
42351             } else {
42352               left = v3.left;
42353               v3.left = null;
42354               right = v3;
42355             }
42356           }
42357           return {
42358             left,
42359             right
42360           };
42361         }
42362         function merge3(left, right, comparator) {
42363           if (right === null) return left;
42364           if (left === null) return right;
42365           right = splay(left.key, right, comparator);
42366           right.left = left;
42367           return right;
42368         }
42369         function printRow(root3, prefix, isTail, out, printNode) {
42370           if (root3) {
42371             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
42372             var indent = prefix + (isTail ? "    " : "\u2502   ");
42373             if (root3.left) printRow(root3.left, indent, false, out, printNode);
42374             if (root3.right) printRow(root3.right, indent, true, out, printNode);
42375           }
42376         }
42377         var Tree = (
42378           /** @class */
42379           function() {
42380             function Tree2(comparator) {
42381               if (comparator === void 0) {
42382                 comparator = DEFAULT_COMPARE;
42383               }
42384               this._root = null;
42385               this._size = 0;
42386               this._comparator = comparator;
42387             }
42388             Tree2.prototype.insert = function(key, data) {
42389               this._size++;
42390               return this._root = insert(key, data, this._root, this._comparator);
42391             };
42392             Tree2.prototype.add = function(key, data) {
42393               var node = new Node(key, data);
42394               if (this._root === null) {
42395                 node.left = node.right = null;
42396                 this._size++;
42397                 this._root = node;
42398               }
42399               var comparator = this._comparator;
42400               var t2 = splay(key, this._root, comparator);
42401               var cmp2 = comparator(key, t2.key);
42402               if (cmp2 === 0) this._root = t2;
42403               else {
42404                 if (cmp2 < 0) {
42405                   node.left = t2.left;
42406                   node.right = t2;
42407                   t2.left = null;
42408                 } else if (cmp2 > 0) {
42409                   node.right = t2.right;
42410                   node.left = t2;
42411                   t2.right = null;
42412                 }
42413                 this._size++;
42414                 this._root = node;
42415               }
42416               return this._root;
42417             };
42418             Tree2.prototype.remove = function(key) {
42419               this._root = this._remove(key, this._root, this._comparator);
42420             };
42421             Tree2.prototype._remove = function(i3, t2, comparator) {
42422               var x2;
42423               if (t2 === null) return null;
42424               t2 = splay(i3, t2, comparator);
42425               var cmp2 = comparator(i3, t2.key);
42426               if (cmp2 === 0) {
42427                 if (t2.left === null) {
42428                   x2 = t2.right;
42429                 } else {
42430                   x2 = splay(i3, t2.left, comparator);
42431                   x2.right = t2.right;
42432                 }
42433                 this._size--;
42434                 return x2;
42435               }
42436               return t2;
42437             };
42438             Tree2.prototype.pop = function() {
42439               var node = this._root;
42440               if (node) {
42441                 while (node.left) node = node.left;
42442                 this._root = splay(node.key, this._root, this._comparator);
42443                 this._root = this._remove(node.key, this._root, this._comparator);
42444                 return {
42445                   key: node.key,
42446                   data: node.data
42447                 };
42448               }
42449               return null;
42450             };
42451             Tree2.prototype.findStatic = function(key) {
42452               var current = this._root;
42453               var compare2 = this._comparator;
42454               while (current) {
42455                 var cmp2 = compare2(key, current.key);
42456                 if (cmp2 === 0) return current;
42457                 else if (cmp2 < 0) current = current.left;
42458                 else current = current.right;
42459               }
42460               return null;
42461             };
42462             Tree2.prototype.find = function(key) {
42463               if (this._root) {
42464                 this._root = splay(key, this._root, this._comparator);
42465                 if (this._comparator(key, this._root.key) !== 0) return null;
42466               }
42467               return this._root;
42468             };
42469             Tree2.prototype.contains = function(key) {
42470               var current = this._root;
42471               var compare2 = this._comparator;
42472               while (current) {
42473                 var cmp2 = compare2(key, current.key);
42474                 if (cmp2 === 0) return true;
42475                 else if (cmp2 < 0) current = current.left;
42476                 else current = current.right;
42477               }
42478               return false;
42479             };
42480             Tree2.prototype.forEach = function(visitor, ctx) {
42481               var current = this._root;
42482               var Q3 = [];
42483               var done = false;
42484               while (!done) {
42485                 if (current !== null) {
42486                   Q3.push(current);
42487                   current = current.left;
42488                 } else {
42489                   if (Q3.length !== 0) {
42490                     current = Q3.pop();
42491                     visitor.call(ctx, current);
42492                     current = current.right;
42493                   } else done = true;
42494                 }
42495               }
42496               return this;
42497             };
42498             Tree2.prototype.range = function(low, high, fn, ctx) {
42499               var Q3 = [];
42500               var compare2 = this._comparator;
42501               var node = this._root;
42502               var cmp2;
42503               while (Q3.length !== 0 || node) {
42504                 if (node) {
42505                   Q3.push(node);
42506                   node = node.left;
42507                 } else {
42508                   node = Q3.pop();
42509                   cmp2 = compare2(node.key, high);
42510                   if (cmp2 > 0) {
42511                     break;
42512                   } else if (compare2(node.key, low) >= 0) {
42513                     if (fn.call(ctx, node)) return this;
42514                   }
42515                   node = node.right;
42516                 }
42517               }
42518               return this;
42519             };
42520             Tree2.prototype.keys = function() {
42521               var keys2 = [];
42522               this.forEach(function(_a4) {
42523                 var key = _a4.key;
42524                 return keys2.push(key);
42525               });
42526               return keys2;
42527             };
42528             Tree2.prototype.values = function() {
42529               var values = [];
42530               this.forEach(function(_a4) {
42531                 var data = _a4.data;
42532                 return values.push(data);
42533               });
42534               return values;
42535             };
42536             Tree2.prototype.min = function() {
42537               if (this._root) return this.minNode(this._root).key;
42538               return null;
42539             };
42540             Tree2.prototype.max = function() {
42541               if (this._root) return this.maxNode(this._root).key;
42542               return null;
42543             };
42544             Tree2.prototype.minNode = function(t2) {
42545               if (t2 === void 0) {
42546                 t2 = this._root;
42547               }
42548               if (t2) while (t2.left) t2 = t2.left;
42549               return t2;
42550             };
42551             Tree2.prototype.maxNode = function(t2) {
42552               if (t2 === void 0) {
42553                 t2 = this._root;
42554               }
42555               if (t2) while (t2.right) t2 = t2.right;
42556               return t2;
42557             };
42558             Tree2.prototype.at = function(index2) {
42559               var current = this._root;
42560               var done = false;
42561               var i3 = 0;
42562               var Q3 = [];
42563               while (!done) {
42564                 if (current) {
42565                   Q3.push(current);
42566                   current = current.left;
42567                 } else {
42568                   if (Q3.length > 0) {
42569                     current = Q3.pop();
42570                     if (i3 === index2) return current;
42571                     i3++;
42572                     current = current.right;
42573                   } else done = true;
42574                 }
42575               }
42576               return null;
42577             };
42578             Tree2.prototype.next = function(d2) {
42579               var root3 = this._root;
42580               var successor = null;
42581               if (d2.right) {
42582                 successor = d2.right;
42583                 while (successor.left) successor = successor.left;
42584                 return successor;
42585               }
42586               var comparator = this._comparator;
42587               while (root3) {
42588                 var cmp2 = comparator(d2.key, root3.key);
42589                 if (cmp2 === 0) break;
42590                 else if (cmp2 < 0) {
42591                   successor = root3;
42592                   root3 = root3.left;
42593                 } else root3 = root3.right;
42594               }
42595               return successor;
42596             };
42597             Tree2.prototype.prev = function(d2) {
42598               var root3 = this._root;
42599               var predecessor = null;
42600               if (d2.left !== null) {
42601                 predecessor = d2.left;
42602                 while (predecessor.right) predecessor = predecessor.right;
42603                 return predecessor;
42604               }
42605               var comparator = this._comparator;
42606               while (root3) {
42607                 var cmp2 = comparator(d2.key, root3.key);
42608                 if (cmp2 === 0) break;
42609                 else if (cmp2 < 0) root3 = root3.left;
42610                 else {
42611                   predecessor = root3;
42612                   root3 = root3.right;
42613                 }
42614               }
42615               return predecessor;
42616             };
42617             Tree2.prototype.clear = function() {
42618               this._root = null;
42619               this._size = 0;
42620               return this;
42621             };
42622             Tree2.prototype.toList = function() {
42623               return toList(this._root);
42624             };
42625             Tree2.prototype.load = function(keys2, values, presort) {
42626               if (values === void 0) {
42627                 values = [];
42628               }
42629               if (presort === void 0) {
42630                 presort = false;
42631               }
42632               var size = keys2.length;
42633               var comparator = this._comparator;
42634               if (presort) sort(keys2, values, 0, size - 1, comparator);
42635               if (this._root === null) {
42636                 this._root = loadRecursive(keys2, values, 0, size);
42637                 this._size = size;
42638               } else {
42639                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
42640                 size = this._size + size;
42641                 this._root = sortedListToBST({
42642                   head: mergedList
42643                 }, 0, size);
42644               }
42645               return this;
42646             };
42647             Tree2.prototype.isEmpty = function() {
42648               return this._root === null;
42649             };
42650             Object.defineProperty(Tree2.prototype, "size", {
42651               get: function() {
42652                 return this._size;
42653               },
42654               enumerable: true,
42655               configurable: true
42656             });
42657             Object.defineProperty(Tree2.prototype, "root", {
42658               get: function() {
42659                 return this._root;
42660               },
42661               enumerable: true,
42662               configurable: true
42663             });
42664             Tree2.prototype.toString = function(printNode) {
42665               if (printNode === void 0) {
42666                 printNode = function(n3) {
42667                   return String(n3.key);
42668                 };
42669               }
42670               var out = [];
42671               printRow(this._root, "", true, function(v3) {
42672                 return out.push(v3);
42673               }, printNode);
42674               return out.join("");
42675             };
42676             Tree2.prototype.update = function(key, newKey, newData) {
42677               var comparator = this._comparator;
42678               var _a4 = split(key, this._root, comparator), left = _a4.left, right = _a4.right;
42679               if (comparator(key, newKey) < 0) {
42680                 right = insert(newKey, newData, right, comparator);
42681               } else {
42682                 left = insert(newKey, newData, left, comparator);
42683               }
42684               this._root = merge3(left, right, comparator);
42685             };
42686             Tree2.prototype.split = function(key) {
42687               return split(key, this._root, this._comparator);
42688             };
42689             Tree2.prototype[Symbol.iterator] = function() {
42690               var current, Q3, done;
42691               return __generator(this, function(_a4) {
42692                 switch (_a4.label) {
42693                   case 0:
42694                     current = this._root;
42695                     Q3 = [];
42696                     done = false;
42697                     _a4.label = 1;
42698                   case 1:
42699                     if (!!done) return [3, 6];
42700                     if (!(current !== null)) return [3, 2];
42701                     Q3.push(current);
42702                     current = current.left;
42703                     return [3, 5];
42704                   case 2:
42705                     if (!(Q3.length !== 0)) return [3, 4];
42706                     current = Q3.pop();
42707                     return [4, current];
42708                   case 3:
42709                     _a4.sent();
42710                     current = current.right;
42711                     return [3, 5];
42712                   case 4:
42713                     done = true;
42714                     _a4.label = 5;
42715                   case 5:
42716                     return [3, 1];
42717                   case 6:
42718                     return [
42719                       2
42720                       /*return*/
42721                     ];
42722                 }
42723               });
42724             };
42725             return Tree2;
42726           }()
42727         );
42728         function loadRecursive(keys2, values, start2, end) {
42729           var size = end - start2;
42730           if (size > 0) {
42731             var middle = start2 + Math.floor(size / 2);
42732             var key = keys2[middle];
42733             var data = values[middle];
42734             var node = new Node(key, data);
42735             node.left = loadRecursive(keys2, values, start2, middle);
42736             node.right = loadRecursive(keys2, values, middle + 1, end);
42737             return node;
42738           }
42739           return null;
42740         }
42741         function createList(keys2, values) {
42742           var head = new Node(null, null);
42743           var p2 = head;
42744           for (var i3 = 0; i3 < keys2.length; i3++) {
42745             p2 = p2.next = new Node(keys2[i3], values[i3]);
42746           }
42747           p2.next = null;
42748           return head.next;
42749         }
42750         function toList(root3) {
42751           var current = root3;
42752           var Q3 = [];
42753           var done = false;
42754           var head = new Node(null, null);
42755           var p2 = head;
42756           while (!done) {
42757             if (current) {
42758               Q3.push(current);
42759               current = current.left;
42760             } else {
42761               if (Q3.length > 0) {
42762                 current = p2 = p2.next = Q3.pop();
42763                 current = current.right;
42764               } else done = true;
42765             }
42766           }
42767           p2.next = null;
42768           return head.next;
42769         }
42770         function sortedListToBST(list, start2, end) {
42771           var size = end - start2;
42772           if (size > 0) {
42773             var middle = start2 + Math.floor(size / 2);
42774             var left = sortedListToBST(list, start2, middle);
42775             var root3 = list.head;
42776             root3.left = left;
42777             list.head = list.head.next;
42778             root3.right = sortedListToBST(list, middle + 1, end);
42779             return root3;
42780           }
42781           return null;
42782         }
42783         function mergeLists(l1, l2, compare2) {
42784           var head = new Node(null, null);
42785           var p2 = head;
42786           var p1 = l1;
42787           var p22 = l2;
42788           while (p1 !== null && p22 !== null) {
42789             if (compare2(p1.key, p22.key) < 0) {
42790               p2.next = p1;
42791               p1 = p1.next;
42792             } else {
42793               p2.next = p22;
42794               p22 = p22.next;
42795             }
42796             p2 = p2.next;
42797           }
42798           if (p1 !== null) {
42799             p2.next = p1;
42800           } else if (p22 !== null) {
42801             p2.next = p22;
42802           }
42803           return head.next;
42804         }
42805         function sort(keys2, values, left, right, compare2) {
42806           if (left >= right) return;
42807           var pivot = keys2[left + right >> 1];
42808           var i3 = left - 1;
42809           var j3 = right + 1;
42810           while (true) {
42811             do
42812               i3++;
42813             while (compare2(keys2[i3], pivot) < 0);
42814             do
42815               j3--;
42816             while (compare2(keys2[j3], pivot) > 0);
42817             if (i3 >= j3) break;
42818             var tmp = keys2[i3];
42819             keys2[i3] = keys2[j3];
42820             keys2[j3] = tmp;
42821             tmp = values[i3];
42822             values[i3] = values[j3];
42823             values[j3] = tmp;
42824           }
42825           sort(keys2, values, left, j3, compare2);
42826           sort(keys2, values, j3 + 1, right, compare2);
42827         }
42828         const isInBbox2 = (bbox2, point) => {
42829           return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
42830         };
42831         const getBboxOverlap2 = (b1, b22) => {
42832           if (b22.ur.x < b1.ll.x || b1.ur.x < b22.ll.x || b22.ur.y < b1.ll.y || b1.ur.y < b22.ll.y) return null;
42833           const lowerX = b1.ll.x < b22.ll.x ? b22.ll.x : b1.ll.x;
42834           const upperX = b1.ur.x < b22.ur.x ? b1.ur.x : b22.ur.x;
42835           const lowerY = b1.ll.y < b22.ll.y ? b22.ll.y : b1.ll.y;
42836           const upperY = b1.ur.y < b22.ur.y ? b1.ur.y : b22.ur.y;
42837           return {
42838             ll: {
42839               x: lowerX,
42840               y: lowerY
42841             },
42842             ur: {
42843               x: upperX,
42844               y: upperY
42845             }
42846           };
42847         };
42848         let epsilon$1 = Number.EPSILON;
42849         if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
42850         const EPSILON_SQ = epsilon$1 * epsilon$1;
42851         const cmp = (a4, b3) => {
42852           if (-epsilon$1 < a4 && a4 < epsilon$1) {
42853             if (-epsilon$1 < b3 && b3 < epsilon$1) {
42854               return 0;
42855             }
42856           }
42857           const ab = a4 - b3;
42858           if (ab * ab < EPSILON_SQ * a4 * b3) {
42859             return 0;
42860           }
42861           return a4 < b3 ? -1 : 1;
42862         };
42863         class PtRounder {
42864           constructor() {
42865             this.reset();
42866           }
42867           reset() {
42868             this.xRounder = new CoordRounder();
42869             this.yRounder = new CoordRounder();
42870           }
42871           round(x2, y2) {
42872             return {
42873               x: this.xRounder.round(x2),
42874               y: this.yRounder.round(y2)
42875             };
42876           }
42877         }
42878         class CoordRounder {
42879           constructor() {
42880             this.tree = new Tree();
42881             this.round(0);
42882           }
42883           // Note: this can rounds input values backwards or forwards.
42884           //       You might ask, why not restrict this to just rounding
42885           //       forwards? Wouldn't that allow left endpoints to always
42886           //       remain left endpoints during splitting (never change to
42887           //       right). No - it wouldn't, because we snap intersections
42888           //       to endpoints (to establish independence from the segment
42889           //       angle for t-intersections).
42890           round(coord2) {
42891             const node = this.tree.add(coord2);
42892             const prevNode = this.tree.prev(node);
42893             if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
42894               this.tree.remove(coord2);
42895               return prevNode.key;
42896             }
42897             const nextNode = this.tree.next(node);
42898             if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
42899               this.tree.remove(coord2);
42900               return nextNode.key;
42901             }
42902             return coord2;
42903           }
42904         }
42905         const rounder = new PtRounder();
42906         const epsilon3 = 11102230246251565e-32;
42907         const splitter = 134217729;
42908         const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
42909         function sum(elen, e3, flen, f2, h3) {
42910           let Q3, Qnew, hh, bvirt;
42911           let enow = e3[0];
42912           let fnow = f2[0];
42913           let eindex = 0;
42914           let findex = 0;
42915           if (fnow > enow === fnow > -enow) {
42916             Q3 = enow;
42917             enow = e3[++eindex];
42918           } else {
42919             Q3 = fnow;
42920             fnow = f2[++findex];
42921           }
42922           let hindex = 0;
42923           if (eindex < elen && findex < flen) {
42924             if (fnow > enow === fnow > -enow) {
42925               Qnew = enow + Q3;
42926               hh = Q3 - (Qnew - enow);
42927               enow = e3[++eindex];
42928             } else {
42929               Qnew = fnow + Q3;
42930               hh = Q3 - (Qnew - fnow);
42931               fnow = f2[++findex];
42932             }
42933             Q3 = Qnew;
42934             if (hh !== 0) {
42935               h3[hindex++] = hh;
42936             }
42937             while (eindex < elen && findex < flen) {
42938               if (fnow > enow === fnow > -enow) {
42939                 Qnew = Q3 + enow;
42940                 bvirt = Qnew - Q3;
42941                 hh = Q3 - (Qnew - bvirt) + (enow - bvirt);
42942                 enow = e3[++eindex];
42943               } else {
42944                 Qnew = Q3 + fnow;
42945                 bvirt = Qnew - Q3;
42946                 hh = Q3 - (Qnew - bvirt) + (fnow - bvirt);
42947                 fnow = f2[++findex];
42948               }
42949               Q3 = Qnew;
42950               if (hh !== 0) {
42951                 h3[hindex++] = hh;
42952               }
42953             }
42954           }
42955           while (eindex < elen) {
42956             Qnew = Q3 + enow;
42957             bvirt = Qnew - Q3;
42958             hh = Q3 - (Qnew - bvirt) + (enow - bvirt);
42959             enow = e3[++eindex];
42960             Q3 = Qnew;
42961             if (hh !== 0) {
42962               h3[hindex++] = hh;
42963             }
42964           }
42965           while (findex < flen) {
42966             Qnew = Q3 + fnow;
42967             bvirt = Qnew - Q3;
42968             hh = Q3 - (Qnew - bvirt) + (fnow - bvirt);
42969             fnow = f2[++findex];
42970             Q3 = Qnew;
42971             if (hh !== 0) {
42972               h3[hindex++] = hh;
42973             }
42974           }
42975           if (Q3 !== 0 || hindex === 0) {
42976             h3[hindex++] = Q3;
42977           }
42978           return hindex;
42979         }
42980         function estimate(elen, e3) {
42981           let Q3 = e3[0];
42982           for (let i3 = 1; i3 < elen; i3++) Q3 += e3[i3];
42983           return Q3;
42984         }
42985         function vec(n3) {
42986           return new Float64Array(n3);
42987         }
42988         const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
42989         const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
42990         const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
42991         const B3 = vec(4);
42992         const C1 = vec(8);
42993         const C22 = vec(12);
42994         const D3 = vec(16);
42995         const u2 = vec(4);
42996         function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
42997           let acxtail, acytail, bcxtail, bcytail;
42998           let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3;
42999           const acx = ax - cx;
43000           const bcx = bx - cx;
43001           const acy = ay - cy;
43002           const bcy = by - cy;
43003           s1 = acx * bcy;
43004           c2 = splitter * acx;
43005           ahi = c2 - (c2 - acx);
43006           alo = acx - ahi;
43007           c2 = splitter * bcy;
43008           bhi = c2 - (c2 - bcy);
43009           blo = bcy - bhi;
43010           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43011           t12 = acy * bcx;
43012           c2 = splitter * acy;
43013           ahi = c2 - (c2 - acy);
43014           alo = acy - ahi;
43015           c2 = splitter * bcx;
43016           bhi = c2 - (c2 - bcx);
43017           blo = bcx - bhi;
43018           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43019           _i = s0 - t02;
43020           bvirt = s0 - _i;
43021           B3[0] = s0 - (_i + bvirt) + (bvirt - t02);
43022           _j = s1 + _i;
43023           bvirt = _j - s1;
43024           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43025           _i = _0 - t12;
43026           bvirt = _0 - _i;
43027           B3[1] = _0 - (_i + bvirt) + (bvirt - t12);
43028           u3 = _j + _i;
43029           bvirt = u3 - _j;
43030           B3[2] = _j - (u3 - bvirt) + (_i - bvirt);
43031           B3[3] = u3;
43032           let det = estimate(4, B3);
43033           let errbound = ccwerrboundB * detsum;
43034           if (det >= errbound || -det >= errbound) {
43035             return det;
43036           }
43037           bvirt = ax - acx;
43038           acxtail = ax - (acx + bvirt) + (bvirt - cx);
43039           bvirt = bx - bcx;
43040           bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
43041           bvirt = ay - acy;
43042           acytail = ay - (acy + bvirt) + (bvirt - cy);
43043           bvirt = by - bcy;
43044           bcytail = by - (bcy + bvirt) + (bvirt - cy);
43045           if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
43046             return det;
43047           }
43048           errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
43049           det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
43050           if (det >= errbound || -det >= errbound) return det;
43051           s1 = acxtail * bcy;
43052           c2 = splitter * acxtail;
43053           ahi = c2 - (c2 - acxtail);
43054           alo = acxtail - ahi;
43055           c2 = splitter * bcy;
43056           bhi = c2 - (c2 - bcy);
43057           blo = bcy - bhi;
43058           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43059           t12 = acytail * bcx;
43060           c2 = splitter * acytail;
43061           ahi = c2 - (c2 - acytail);
43062           alo = acytail - ahi;
43063           c2 = splitter * bcx;
43064           bhi = c2 - (c2 - bcx);
43065           blo = bcx - bhi;
43066           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43067           _i = s0 - t02;
43068           bvirt = s0 - _i;
43069           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43070           _j = s1 + _i;
43071           bvirt = _j - s1;
43072           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43073           _i = _0 - t12;
43074           bvirt = _0 - _i;
43075           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43076           u3 = _j + _i;
43077           bvirt = u3 - _j;
43078           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43079           u2[3] = u3;
43080           const C1len = sum(4, B3, 4, u2, C1);
43081           s1 = acx * bcytail;
43082           c2 = splitter * acx;
43083           ahi = c2 - (c2 - acx);
43084           alo = acx - ahi;
43085           c2 = splitter * bcytail;
43086           bhi = c2 - (c2 - bcytail);
43087           blo = bcytail - bhi;
43088           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43089           t12 = acy * bcxtail;
43090           c2 = splitter * acy;
43091           ahi = c2 - (c2 - acy);
43092           alo = acy - ahi;
43093           c2 = splitter * bcxtail;
43094           bhi = c2 - (c2 - bcxtail);
43095           blo = bcxtail - bhi;
43096           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43097           _i = s0 - t02;
43098           bvirt = s0 - _i;
43099           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43100           _j = s1 + _i;
43101           bvirt = _j - s1;
43102           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43103           _i = _0 - t12;
43104           bvirt = _0 - _i;
43105           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43106           u3 = _j + _i;
43107           bvirt = u3 - _j;
43108           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43109           u2[3] = u3;
43110           const C2len = sum(C1len, C1, 4, u2, C22);
43111           s1 = acxtail * bcytail;
43112           c2 = splitter * acxtail;
43113           ahi = c2 - (c2 - acxtail);
43114           alo = acxtail - ahi;
43115           c2 = splitter * bcytail;
43116           bhi = c2 - (c2 - bcytail);
43117           blo = bcytail - bhi;
43118           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
43119           t12 = acytail * bcxtail;
43120           c2 = splitter * acytail;
43121           ahi = c2 - (c2 - acytail);
43122           alo = acytail - ahi;
43123           c2 = splitter * bcxtail;
43124           bhi = c2 - (c2 - bcxtail);
43125           blo = bcxtail - bhi;
43126           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
43127           _i = s0 - t02;
43128           bvirt = s0 - _i;
43129           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
43130           _j = s1 + _i;
43131           bvirt = _j - s1;
43132           _0 = s1 - (_j - bvirt) + (_i - bvirt);
43133           _i = _0 - t12;
43134           bvirt = _0 - _i;
43135           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
43136           u3 = _j + _i;
43137           bvirt = u3 - _j;
43138           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
43139           u2[3] = u3;
43140           const Dlen = sum(C2len, C22, 4, u2, D3);
43141           return D3[Dlen - 1];
43142         }
43143         function orient2d(ax, ay, bx, by, cx, cy) {
43144           const detleft = (ay - cy) * (bx - cx);
43145           const detright = (ax - cx) * (by - cy);
43146           const det = detleft - detright;
43147           const detsum = Math.abs(detleft + detright);
43148           if (Math.abs(det) >= ccwerrboundA * detsum) return det;
43149           return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
43150         }
43151         const crossProduct2 = (a4, b3) => a4.x * b3.y - a4.y * b3.x;
43152         const dotProduct2 = (a4, b3) => a4.x * b3.x + a4.y * b3.y;
43153         const compareVectorAngles = (basePt, endPt1, endPt2) => {
43154           const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
43155           if (res > 0) return -1;
43156           if (res < 0) return 1;
43157           return 0;
43158         };
43159         const length2 = (v3) => Math.sqrt(dotProduct2(v3, v3));
43160         const sineOfAngle2 = (pShared, pBase, pAngle) => {
43161           const vBase = {
43162             x: pBase.x - pShared.x,
43163             y: pBase.y - pShared.y
43164           };
43165           const vAngle = {
43166             x: pAngle.x - pShared.x,
43167             y: pAngle.y - pShared.y
43168           };
43169           return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
43170         };
43171         const cosineOfAngle2 = (pShared, pBase, pAngle) => {
43172           const vBase = {
43173             x: pBase.x - pShared.x,
43174             y: pBase.y - pShared.y
43175           };
43176           const vAngle = {
43177             x: pAngle.x - pShared.x,
43178             y: pAngle.y - pShared.y
43179           };
43180           return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
43181         };
43182         const horizontalIntersection2 = (pt2, v3, y2) => {
43183           if (v3.y === 0) return null;
43184           return {
43185             x: pt2.x + v3.x / v3.y * (y2 - pt2.y),
43186             y: y2
43187           };
43188         };
43189         const verticalIntersection2 = (pt2, v3, x2) => {
43190           if (v3.x === 0) return null;
43191           return {
43192             x: x2,
43193             y: pt2.y + v3.y / v3.x * (x2 - pt2.x)
43194           };
43195         };
43196         const intersection$1 = (pt1, v1, pt2, v22) => {
43197           if (v1.x === 0) return verticalIntersection2(pt2, v22, pt1.x);
43198           if (v22.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
43199           if (v1.y === 0) return horizontalIntersection2(pt2, v22, pt1.y);
43200           if (v22.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
43201           const kross = crossProduct2(v1, v22);
43202           if (kross == 0) return null;
43203           const ve3 = {
43204             x: pt2.x - pt1.x,
43205             y: pt2.y - pt1.y
43206           };
43207           const d1 = crossProduct2(ve3, v1) / kross;
43208           const d2 = crossProduct2(ve3, v22) / kross;
43209           const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v22.x;
43210           const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v22.y;
43211           const x3 = (x12 + x2) / 2;
43212           const y3 = (y12 + y2) / 2;
43213           return {
43214             x: x3,
43215             y: y3
43216           };
43217         };
43218         class SweepEvent2 {
43219           // for ordering sweep events in the sweep event queue
43220           static compare(a4, b3) {
43221             const ptCmp = SweepEvent2.comparePoints(a4.point, b3.point);
43222             if (ptCmp !== 0) return ptCmp;
43223             if (a4.point !== b3.point) a4.link(b3);
43224             if (a4.isLeft !== b3.isLeft) return a4.isLeft ? 1 : -1;
43225             return Segment2.compare(a4.segment, b3.segment);
43226           }
43227           // for ordering points in sweep line order
43228           static comparePoints(aPt, bPt) {
43229             if (aPt.x < bPt.x) return -1;
43230             if (aPt.x > bPt.x) return 1;
43231             if (aPt.y < bPt.y) return -1;
43232             if (aPt.y > bPt.y) return 1;
43233             return 0;
43234           }
43235           // Warning: 'point' input will be modified and re-used (for performance)
43236           constructor(point, isLeft) {
43237             if (point.events === void 0) point.events = [this];
43238             else point.events.push(this);
43239             this.point = point;
43240             this.isLeft = isLeft;
43241           }
43242           link(other) {
43243             if (other.point === this.point) {
43244               throw new Error("Tried to link already linked events");
43245             }
43246             const otherEvents = other.point.events;
43247             for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
43248               const evt = otherEvents[i3];
43249               this.point.events.push(evt);
43250               evt.point = this.point;
43251             }
43252             this.checkForConsuming();
43253           }
43254           /* Do a pass over our linked events and check to see if any pair
43255            * of segments match, and should be consumed. */
43256           checkForConsuming() {
43257             const numEvents = this.point.events.length;
43258             for (let i3 = 0; i3 < numEvents; i3++) {
43259               const evt1 = this.point.events[i3];
43260               if (evt1.segment.consumedBy !== void 0) continue;
43261               for (let j3 = i3 + 1; j3 < numEvents; j3++) {
43262                 const evt2 = this.point.events[j3];
43263                 if (evt2.consumedBy !== void 0) continue;
43264                 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
43265                 evt1.segment.consume(evt2.segment);
43266               }
43267             }
43268           }
43269           getAvailableLinkedEvents() {
43270             const events = [];
43271             for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
43272               const evt = this.point.events[i3];
43273               if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
43274                 events.push(evt);
43275               }
43276             }
43277             return events;
43278           }
43279           /**
43280            * Returns a comparator function for sorting linked events that will
43281            * favor the event that will give us the smallest left-side angle.
43282            * All ring construction starts as low as possible heading to the right,
43283            * so by always turning left as sharp as possible we'll get polygons
43284            * without uncessary loops & holes.
43285            *
43286            * The comparator function has a compute cache such that it avoids
43287            * re-computing already-computed values.
43288            */
43289           getLeftmostComparator(baseEvent) {
43290             const cache = /* @__PURE__ */ new Map();
43291             const fillCache = (linkedEvent) => {
43292               const nextEvent = linkedEvent.otherSE;
43293               cache.set(linkedEvent, {
43294                 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
43295                 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
43296               });
43297             };
43298             return (a4, b3) => {
43299               if (!cache.has(a4)) fillCache(a4);
43300               if (!cache.has(b3)) fillCache(b3);
43301               const {
43302                 sine: asine,
43303                 cosine: acosine
43304               } = cache.get(a4);
43305               const {
43306                 sine: bsine,
43307                 cosine: bcosine
43308               } = cache.get(b3);
43309               if (asine >= 0 && bsine >= 0) {
43310                 if (acosine < bcosine) return 1;
43311                 if (acosine > bcosine) return -1;
43312                 return 0;
43313               }
43314               if (asine < 0 && bsine < 0) {
43315                 if (acosine < bcosine) return -1;
43316                 if (acosine > bcosine) return 1;
43317                 return 0;
43318               }
43319               if (bsine < asine) return -1;
43320               if (bsine > asine) return 1;
43321               return 0;
43322             };
43323           }
43324         }
43325         let segmentId2 = 0;
43326         class Segment2 {
43327           /* This compare() function is for ordering segments in the sweep
43328            * line tree, and does so according to the following criteria:
43329            *
43330            * Consider the vertical line that lies an infinestimal step to the
43331            * right of the right-more of the two left endpoints of the input
43332            * segments. Imagine slowly moving a point up from negative infinity
43333            * in the increasing y direction. Which of the two segments will that
43334            * point intersect first? That segment comes 'before' the other one.
43335            *
43336            * If neither segment would be intersected by such a line, (if one
43337            * or more of the segments are vertical) then the line to be considered
43338            * is directly on the right-more of the two left inputs.
43339            */
43340           static compare(a4, b3) {
43341             const alx = a4.leftSE.point.x;
43342             const blx = b3.leftSE.point.x;
43343             const arx = a4.rightSE.point.x;
43344             const brx = b3.rightSE.point.x;
43345             if (brx < alx) return 1;
43346             if (arx < blx) return -1;
43347             const aly = a4.leftSE.point.y;
43348             const bly = b3.leftSE.point.y;
43349             const ary = a4.rightSE.point.y;
43350             const bry = b3.rightSE.point.y;
43351             if (alx < blx) {
43352               if (bly < aly && bly < ary) return 1;
43353               if (bly > aly && bly > ary) return -1;
43354               const aCmpBLeft = a4.comparePoint(b3.leftSE.point);
43355               if (aCmpBLeft < 0) return 1;
43356               if (aCmpBLeft > 0) return -1;
43357               const bCmpARight = b3.comparePoint(a4.rightSE.point);
43358               if (bCmpARight !== 0) return bCmpARight;
43359               return -1;
43360             }
43361             if (alx > blx) {
43362               if (aly < bly && aly < bry) return -1;
43363               if (aly > bly && aly > bry) return 1;
43364               const bCmpALeft = b3.comparePoint(a4.leftSE.point);
43365               if (bCmpALeft !== 0) return bCmpALeft;
43366               const aCmpBRight = a4.comparePoint(b3.rightSE.point);
43367               if (aCmpBRight < 0) return 1;
43368               if (aCmpBRight > 0) return -1;
43369               return 1;
43370             }
43371             if (aly < bly) return -1;
43372             if (aly > bly) return 1;
43373             if (arx < brx) {
43374               const bCmpARight = b3.comparePoint(a4.rightSE.point);
43375               if (bCmpARight !== 0) return bCmpARight;
43376             }
43377             if (arx > brx) {
43378               const aCmpBRight = a4.comparePoint(b3.rightSE.point);
43379               if (aCmpBRight < 0) return 1;
43380               if (aCmpBRight > 0) return -1;
43381             }
43382             if (arx !== brx) {
43383               const ay = ary - aly;
43384               const ax = arx - alx;
43385               const by = bry - bly;
43386               const bx = brx - blx;
43387               if (ay > ax && by < bx) return 1;
43388               if (ay < ax && by > bx) return -1;
43389             }
43390             if (arx > brx) return 1;
43391             if (arx < brx) return -1;
43392             if (ary < bry) return -1;
43393             if (ary > bry) return 1;
43394             if (a4.id < b3.id) return -1;
43395             if (a4.id > b3.id) return 1;
43396             return 0;
43397           }
43398           /* Warning: a reference to ringWindings input will be stored,
43399            *  and possibly will be later modified */
43400           constructor(leftSE, rightSE, rings, windings) {
43401             this.id = ++segmentId2;
43402             this.leftSE = leftSE;
43403             leftSE.segment = this;
43404             leftSE.otherSE = rightSE;
43405             this.rightSE = rightSE;
43406             rightSE.segment = this;
43407             rightSE.otherSE = leftSE;
43408             this.rings = rings;
43409             this.windings = windings;
43410           }
43411           static fromRing(pt1, pt2, ring) {
43412             let leftPt, rightPt, winding;
43413             const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
43414             if (cmpPts < 0) {
43415               leftPt = pt1;
43416               rightPt = pt2;
43417               winding = 1;
43418             } else if (cmpPts > 0) {
43419               leftPt = pt2;
43420               rightPt = pt1;
43421               winding = -1;
43422             } else throw new Error(`Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`);
43423             const leftSE = new SweepEvent2(leftPt, true);
43424             const rightSE = new SweepEvent2(rightPt, false);
43425             return new Segment2(leftSE, rightSE, [ring], [winding]);
43426           }
43427           /* When a segment is split, the rightSE is replaced with a new sweep event */
43428           replaceRightSE(newRightSE) {
43429             this.rightSE = newRightSE;
43430             this.rightSE.segment = this;
43431             this.rightSE.otherSE = this.leftSE;
43432             this.leftSE.otherSE = this.rightSE;
43433           }
43434           bbox() {
43435             const y12 = this.leftSE.point.y;
43436             const y2 = this.rightSE.point.y;
43437             return {
43438               ll: {
43439                 x: this.leftSE.point.x,
43440                 y: y12 < y2 ? y12 : y2
43441               },
43442               ur: {
43443                 x: this.rightSE.point.x,
43444                 y: y12 > y2 ? y12 : y2
43445               }
43446             };
43447           }
43448           /* A vector from the left point to the right */
43449           vector() {
43450             return {
43451               x: this.rightSE.point.x - this.leftSE.point.x,
43452               y: this.rightSE.point.y - this.leftSE.point.y
43453             };
43454           }
43455           isAnEndpoint(pt2) {
43456             return pt2.x === this.leftSE.point.x && pt2.y === this.leftSE.point.y || pt2.x === this.rightSE.point.x && pt2.y === this.rightSE.point.y;
43457           }
43458           /* Compare this segment with a point.
43459            *
43460            * A point P is considered to be colinear to a segment if there
43461            * exists a distance D such that if we travel along the segment
43462            * from one * endpoint towards the other a distance D, we find
43463            * ourselves at point P.
43464            *
43465            * Return value indicates:
43466            *
43467            *   1: point lies above the segment (to the left of vertical)
43468            *   0: point is colinear to segment
43469            *  -1: point lies below the segment (to the right of vertical)
43470            */
43471           comparePoint(point) {
43472             if (this.isAnEndpoint(point)) return 0;
43473             const lPt = this.leftSE.point;
43474             const rPt = this.rightSE.point;
43475             const v3 = this.vector();
43476             if (lPt.x === rPt.x) {
43477               if (point.x === lPt.x) return 0;
43478               return point.x < lPt.x ? 1 : -1;
43479             }
43480             const yDist = (point.y - lPt.y) / v3.y;
43481             const xFromYDist = lPt.x + yDist * v3.x;
43482             if (point.x === xFromYDist) return 0;
43483             const xDist = (point.x - lPt.x) / v3.x;
43484             const yFromXDist = lPt.y + xDist * v3.y;
43485             if (point.y === yFromXDist) return 0;
43486             return point.y < yFromXDist ? -1 : 1;
43487           }
43488           /**
43489            * Given another segment, returns the first non-trivial intersection
43490            * between the two segments (in terms of sweep line ordering), if it exists.
43491            *
43492            * A 'non-trivial' intersection is one that will cause one or both of the
43493            * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
43494            *
43495            *   * endpoint of segA with endpoint of segB --> trivial
43496            *   * endpoint of segA with point along segB --> non-trivial
43497            *   * endpoint of segB with point along segA --> non-trivial
43498            *   * point along segA with point along segB --> non-trivial
43499            *
43500            * If no non-trivial intersection exists, return null
43501            * Else, return null.
43502            */
43503           getIntersection(other) {
43504             const tBbox = this.bbox();
43505             const oBbox = other.bbox();
43506             const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
43507             if (bboxOverlap === null) return null;
43508             const tlp = this.leftSE.point;
43509             const trp = this.rightSE.point;
43510             const olp = other.leftSE.point;
43511             const orp = other.rightSE.point;
43512             const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
43513             const touchesThisLSE = isInBbox2(oBbox, tlp) && other.comparePoint(tlp) === 0;
43514             const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
43515             const touchesThisRSE = isInBbox2(oBbox, trp) && other.comparePoint(trp) === 0;
43516             if (touchesThisLSE && touchesOtherLSE) {
43517               if (touchesThisRSE && !touchesOtherRSE) return trp;
43518               if (!touchesThisRSE && touchesOtherRSE) return orp;
43519               return null;
43520             }
43521             if (touchesThisLSE) {
43522               if (touchesOtherRSE) {
43523                 if (tlp.x === orp.x && tlp.y === orp.y) return null;
43524               }
43525               return tlp;
43526             }
43527             if (touchesOtherLSE) {
43528               if (touchesThisRSE) {
43529                 if (trp.x === olp.x && trp.y === olp.y) return null;
43530               }
43531               return olp;
43532             }
43533             if (touchesThisRSE && touchesOtherRSE) return null;
43534             if (touchesThisRSE) return trp;
43535             if (touchesOtherRSE) return orp;
43536             const pt2 = intersection$1(tlp, this.vector(), olp, other.vector());
43537             if (pt2 === null) return null;
43538             if (!isInBbox2(bboxOverlap, pt2)) return null;
43539             return rounder.round(pt2.x, pt2.y);
43540           }
43541           /**
43542            * Split the given segment into multiple segments on the given points.
43543            *  * Each existing segment will retain its leftSE and a new rightSE will be
43544            *    generated for it.
43545            *  * A new segment will be generated which will adopt the original segment's
43546            *    rightSE, and a new leftSE will be generated for it.
43547            *  * If there are more than two points given to split on, new segments
43548            *    in the middle will be generated with new leftSE and rightSE's.
43549            *  * An array of the newly generated SweepEvents will be returned.
43550            *
43551            * Warning: input array of points is modified
43552            */
43553           split(point) {
43554             const newEvents = [];
43555             const alreadyLinked = point.events !== void 0;
43556             const newLeftSE = new SweepEvent2(point, true);
43557             const newRightSE = new SweepEvent2(point, false);
43558             const oldRightSE = this.rightSE;
43559             this.replaceRightSE(newRightSE);
43560             newEvents.push(newRightSE);
43561             newEvents.push(newLeftSE);
43562             const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
43563             if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
43564               newSeg.swapEvents();
43565             }
43566             if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
43567               this.swapEvents();
43568             }
43569             if (alreadyLinked) {
43570               newLeftSE.checkForConsuming();
43571               newRightSE.checkForConsuming();
43572             }
43573             return newEvents;
43574           }
43575           /* Swap which event is left and right */
43576           swapEvents() {
43577             const tmpEvt = this.rightSE;
43578             this.rightSE = this.leftSE;
43579             this.leftSE = tmpEvt;
43580             this.leftSE.isLeft = true;
43581             this.rightSE.isLeft = false;
43582             for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
43583               this.windings[i3] *= -1;
43584             }
43585           }
43586           /* Consume another segment. We take their rings under our wing
43587            * and mark them as consumed. Use for perfectly overlapping segments */
43588           consume(other) {
43589             let consumer = this;
43590             let consumee = other;
43591             while (consumer.consumedBy) consumer = consumer.consumedBy;
43592             while (consumee.consumedBy) consumee = consumee.consumedBy;
43593             const cmp2 = Segment2.compare(consumer, consumee);
43594             if (cmp2 === 0) return;
43595             if (cmp2 > 0) {
43596               const tmp = consumer;
43597               consumer = consumee;
43598               consumee = tmp;
43599             }
43600             if (consumer.prev === consumee) {
43601               const tmp = consumer;
43602               consumer = consumee;
43603               consumee = tmp;
43604             }
43605             for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
43606               const ring = consumee.rings[i3];
43607               const winding = consumee.windings[i3];
43608               const index2 = consumer.rings.indexOf(ring);
43609               if (index2 === -1) {
43610                 consumer.rings.push(ring);
43611                 consumer.windings.push(winding);
43612               } else consumer.windings[index2] += winding;
43613             }
43614             consumee.rings = null;
43615             consumee.windings = null;
43616             consumee.consumedBy = consumer;
43617             consumee.leftSE.consumedBy = consumer.leftSE;
43618             consumee.rightSE.consumedBy = consumer.rightSE;
43619           }
43620           /* The first segment previous segment chain that is in the result */
43621           prevInResult() {
43622             if (this._prevInResult !== void 0) return this._prevInResult;
43623             if (!this.prev) this._prevInResult = null;
43624             else if (this.prev.isInResult()) this._prevInResult = this.prev;
43625             else this._prevInResult = this.prev.prevInResult();
43626             return this._prevInResult;
43627           }
43628           beforeState() {
43629             if (this._beforeState !== void 0) return this._beforeState;
43630             if (!this.prev) this._beforeState = {
43631               rings: [],
43632               windings: [],
43633               multiPolys: []
43634             };
43635             else {
43636               const seg = this.prev.consumedBy || this.prev;
43637               this._beforeState = seg.afterState();
43638             }
43639             return this._beforeState;
43640           }
43641           afterState() {
43642             if (this._afterState !== void 0) return this._afterState;
43643             const beforeState = this.beforeState();
43644             this._afterState = {
43645               rings: beforeState.rings.slice(0),
43646               windings: beforeState.windings.slice(0),
43647               multiPolys: []
43648             };
43649             const ringsAfter = this._afterState.rings;
43650             const windingsAfter = this._afterState.windings;
43651             const mpsAfter = this._afterState.multiPolys;
43652             for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
43653               const ring = this.rings[i3];
43654               const winding = this.windings[i3];
43655               const index2 = ringsAfter.indexOf(ring);
43656               if (index2 === -1) {
43657                 ringsAfter.push(ring);
43658                 windingsAfter.push(winding);
43659               } else windingsAfter[index2] += winding;
43660             }
43661             const polysAfter = [];
43662             const polysExclude = [];
43663             for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
43664               if (windingsAfter[i3] === 0) continue;
43665               const ring = ringsAfter[i3];
43666               const poly = ring.poly;
43667               if (polysExclude.indexOf(poly) !== -1) continue;
43668               if (ring.isExterior) polysAfter.push(poly);
43669               else {
43670                 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
43671                 const index2 = polysAfter.indexOf(ring.poly);
43672                 if (index2 !== -1) polysAfter.splice(index2, 1);
43673               }
43674             }
43675             for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
43676               const mp = polysAfter[i3].multiPoly;
43677               if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
43678             }
43679             return this._afterState;
43680           }
43681           /* Is this segment part of the final result? */
43682           isInResult() {
43683             if (this.consumedBy) return false;
43684             if (this._isInResult !== void 0) return this._isInResult;
43685             const mpsBefore = this.beforeState().multiPolys;
43686             const mpsAfter = this.afterState().multiPolys;
43687             switch (operation2.type) {
43688               case "union": {
43689                 const noBefores = mpsBefore.length === 0;
43690                 const noAfters = mpsAfter.length === 0;
43691                 this._isInResult = noBefores !== noAfters;
43692                 break;
43693               }
43694               case "intersection": {
43695                 let least;
43696                 let most;
43697                 if (mpsBefore.length < mpsAfter.length) {
43698                   least = mpsBefore.length;
43699                   most = mpsAfter.length;
43700                 } else {
43701                   least = mpsAfter.length;
43702                   most = mpsBefore.length;
43703                 }
43704                 this._isInResult = most === operation2.numMultiPolys && least < most;
43705                 break;
43706               }
43707               case "xor": {
43708                 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
43709                 this._isInResult = diff % 2 === 1;
43710                 break;
43711               }
43712               case "difference": {
43713                 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
43714                 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
43715                 break;
43716               }
43717               default:
43718                 throw new Error(`Unrecognized operation type found ${operation2.type}`);
43719             }
43720             return this._isInResult;
43721           }
43722         }
43723         class RingIn2 {
43724           constructor(geomRing, poly, isExterior) {
43725             if (!Array.isArray(geomRing) || geomRing.length === 0) {
43726               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43727             }
43728             this.poly = poly;
43729             this.isExterior = isExterior;
43730             this.segments = [];
43731             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
43732               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43733             }
43734             const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
43735             this.bbox = {
43736               ll: {
43737                 x: firstPoint.x,
43738                 y: firstPoint.y
43739               },
43740               ur: {
43741                 x: firstPoint.x,
43742                 y: firstPoint.y
43743               }
43744             };
43745             let prevPoint = firstPoint;
43746             for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
43747               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
43748                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43749               }
43750               let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
43751               if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
43752               this.segments.push(Segment2.fromRing(prevPoint, point, this));
43753               if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
43754               if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
43755               if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
43756               if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
43757               prevPoint = point;
43758             }
43759             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
43760               this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
43761             }
43762           }
43763           getSweepEvents() {
43764             const sweepEvents = [];
43765             for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
43766               const segment = this.segments[i3];
43767               sweepEvents.push(segment.leftSE);
43768               sweepEvents.push(segment.rightSE);
43769             }
43770             return sweepEvents;
43771           }
43772         }
43773         class PolyIn2 {
43774           constructor(geomPoly, multiPoly) {
43775             if (!Array.isArray(geomPoly)) {
43776               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43777             }
43778             this.exteriorRing = new RingIn2(geomPoly[0], this, true);
43779             this.bbox = {
43780               ll: {
43781                 x: this.exteriorRing.bbox.ll.x,
43782                 y: this.exteriorRing.bbox.ll.y
43783               },
43784               ur: {
43785                 x: this.exteriorRing.bbox.ur.x,
43786                 y: this.exteriorRing.bbox.ur.y
43787               }
43788             };
43789             this.interiorRings = [];
43790             for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
43791               const ring = new RingIn2(geomPoly[i3], this, false);
43792               if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
43793               if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
43794               if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
43795               if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
43796               this.interiorRings.push(ring);
43797             }
43798             this.multiPoly = multiPoly;
43799           }
43800           getSweepEvents() {
43801             const sweepEvents = this.exteriorRing.getSweepEvents();
43802             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
43803               const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
43804               for (let j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
43805                 sweepEvents.push(ringSweepEvents[j3]);
43806               }
43807             }
43808             return sweepEvents;
43809           }
43810         }
43811         class MultiPolyIn2 {
43812           constructor(geom, isSubject) {
43813             if (!Array.isArray(geom)) {
43814               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
43815             }
43816             try {
43817               if (typeof geom[0][0][0] === "number") geom = [geom];
43818             } catch (ex) {
43819             }
43820             this.polys = [];
43821             this.bbox = {
43822               ll: {
43823                 x: Number.POSITIVE_INFINITY,
43824                 y: Number.POSITIVE_INFINITY
43825               },
43826               ur: {
43827                 x: Number.NEGATIVE_INFINITY,
43828                 y: Number.NEGATIVE_INFINITY
43829               }
43830             };
43831             for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
43832               const poly = new PolyIn2(geom[i3], this);
43833               if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
43834               if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
43835               if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
43836               if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
43837               this.polys.push(poly);
43838             }
43839             this.isSubject = isSubject;
43840           }
43841           getSweepEvents() {
43842             const sweepEvents = [];
43843             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
43844               const polySweepEvents = this.polys[i3].getSweepEvents();
43845               for (let j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
43846                 sweepEvents.push(polySweepEvents[j3]);
43847               }
43848             }
43849             return sweepEvents;
43850           }
43851         }
43852         class RingOut2 {
43853           /* Given the segments from the sweep line pass, compute & return a series
43854            * of closed rings from all the segments marked to be part of the result */
43855           static factory(allSegments) {
43856             const ringsOut = [];
43857             for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
43858               const segment = allSegments[i3];
43859               if (!segment.isInResult() || segment.ringOut) continue;
43860               let prevEvent = null;
43861               let event = segment.leftSE;
43862               let nextEvent = segment.rightSE;
43863               const events = [event];
43864               const startingPoint = event.point;
43865               const intersectionLEs = [];
43866               while (true) {
43867                 prevEvent = event;
43868                 event = nextEvent;
43869                 events.push(event);
43870                 if (event.point === startingPoint) break;
43871                 while (true) {
43872                   const availableLEs = event.getAvailableLinkedEvents();
43873                   if (availableLEs.length === 0) {
43874                     const firstPt = events[0].point;
43875                     const lastPt = events[events.length - 1].point;
43876                     throw new Error(`Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`);
43877                   }
43878                   if (availableLEs.length === 1) {
43879                     nextEvent = availableLEs[0].otherSE;
43880                     break;
43881                   }
43882                   let indexLE = null;
43883                   for (let j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
43884                     if (intersectionLEs[j3].point === event.point) {
43885                       indexLE = j3;
43886                       break;
43887                     }
43888                   }
43889                   if (indexLE !== null) {
43890                     const intersectionLE = intersectionLEs.splice(indexLE)[0];
43891                     const ringEvents = events.splice(intersectionLE.index);
43892                     ringEvents.unshift(ringEvents[0].otherSE);
43893                     ringsOut.push(new RingOut2(ringEvents.reverse()));
43894                     continue;
43895                   }
43896                   intersectionLEs.push({
43897                     index: events.length,
43898                     point: event.point
43899                   });
43900                   const comparator = event.getLeftmostComparator(prevEvent);
43901                   nextEvent = availableLEs.sort(comparator)[0].otherSE;
43902                   break;
43903                 }
43904               }
43905               ringsOut.push(new RingOut2(events));
43906             }
43907             return ringsOut;
43908           }
43909           constructor(events) {
43910             this.events = events;
43911             for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
43912               events[i3].segment.ringOut = this;
43913             }
43914             this.poly = null;
43915           }
43916           getGeom() {
43917             let prevPt = this.events[0].point;
43918             const points = [prevPt];
43919             for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
43920               const pt3 = this.events[i3].point;
43921               const nextPt2 = this.events[i3 + 1].point;
43922               if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
43923               points.push(pt3);
43924               prevPt = pt3;
43925             }
43926             if (points.length === 1) return null;
43927             const pt2 = points[0];
43928             const nextPt = points[1];
43929             if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
43930             points.push(points[0]);
43931             const step = this.isExteriorRing() ? 1 : -1;
43932             const iStart = this.isExteriorRing() ? 0 : points.length - 1;
43933             const iEnd = this.isExteriorRing() ? points.length : -1;
43934             const orderedPoints = [];
43935             for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
43936             return orderedPoints;
43937           }
43938           isExteriorRing() {
43939             if (this._isExteriorRing === void 0) {
43940               const enclosing = this.enclosingRing();
43941               this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
43942             }
43943             return this._isExteriorRing;
43944           }
43945           enclosingRing() {
43946             if (this._enclosingRing === void 0) {
43947               this._enclosingRing = this._calcEnclosingRing();
43948             }
43949             return this._enclosingRing;
43950           }
43951           /* Returns the ring that encloses this one, if any */
43952           _calcEnclosingRing() {
43953             let leftMostEvt = this.events[0];
43954             for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
43955               const evt = this.events[i3];
43956               if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
43957             }
43958             let prevSeg = leftMostEvt.segment.prevInResult();
43959             let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
43960             while (true) {
43961               if (!prevSeg) return null;
43962               if (!prevPrevSeg) return prevSeg.ringOut;
43963               if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
43964                 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
43965                   return prevSeg.ringOut;
43966                 } else return prevSeg.ringOut.enclosingRing();
43967               }
43968               prevSeg = prevPrevSeg.prevInResult();
43969               prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
43970             }
43971           }
43972         }
43973         class PolyOut2 {
43974           constructor(exteriorRing) {
43975             this.exteriorRing = exteriorRing;
43976             exteriorRing.poly = this;
43977             this.interiorRings = [];
43978           }
43979           addInterior(ring) {
43980             this.interiorRings.push(ring);
43981             ring.poly = this;
43982           }
43983           getGeom() {
43984             const geom = [this.exteriorRing.getGeom()];
43985             if (geom[0] === null) return null;
43986             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
43987               const ringGeom = this.interiorRings[i3].getGeom();
43988               if (ringGeom === null) continue;
43989               geom.push(ringGeom);
43990             }
43991             return geom;
43992           }
43993         }
43994         class MultiPolyOut2 {
43995           constructor(rings) {
43996             this.rings = rings;
43997             this.polys = this._composePolys(rings);
43998           }
43999           getGeom() {
44000             const geom = [];
44001             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
44002               const polyGeom = this.polys[i3].getGeom();
44003               if (polyGeom === null) continue;
44004               geom.push(polyGeom);
44005             }
44006             return geom;
44007           }
44008           _composePolys(rings) {
44009             const polys = [];
44010             for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
44011               const ring = rings[i3];
44012               if (ring.poly) continue;
44013               if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
44014               else {
44015                 const enclosingRing = ring.enclosingRing();
44016                 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
44017                 enclosingRing.poly.addInterior(ring);
44018               }
44019             }
44020             return polys;
44021           }
44022         }
44023         class SweepLine2 {
44024           constructor(queue) {
44025             let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
44026             this.queue = queue;
44027             this.tree = new Tree(comparator);
44028             this.segments = [];
44029           }
44030           process(event) {
44031             const segment = event.segment;
44032             const newEvents = [];
44033             if (event.consumedBy) {
44034               if (event.isLeft) this.queue.remove(event.otherSE);
44035               else this.tree.remove(segment);
44036               return newEvents;
44037             }
44038             const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
44039             if (!node) throw new Error(`Unable to find segment #${segment.id} [${segment.leftSE.point.x}, ${segment.leftSE.point.y}] -> [${segment.rightSE.point.x}, ${segment.rightSE.point.y}] in SweepLine tree.`);
44040             let prevNode = node;
44041             let nextNode = node;
44042             let prevSeg = void 0;
44043             let nextSeg = void 0;
44044             while (prevSeg === void 0) {
44045               prevNode = this.tree.prev(prevNode);
44046               if (prevNode === null) prevSeg = null;
44047               else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
44048             }
44049             while (nextSeg === void 0) {
44050               nextNode = this.tree.next(nextNode);
44051               if (nextNode === null) nextSeg = null;
44052               else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
44053             }
44054             if (event.isLeft) {
44055               let prevMySplitter = null;
44056               if (prevSeg) {
44057                 const prevInter = prevSeg.getIntersection(segment);
44058                 if (prevInter !== null) {
44059                   if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
44060                   if (!prevSeg.isAnEndpoint(prevInter)) {
44061                     const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
44062                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44063                       newEvents.push(newEventsFromSplit[i3]);
44064                     }
44065                   }
44066                 }
44067               }
44068               let nextMySplitter = null;
44069               if (nextSeg) {
44070                 const nextInter = nextSeg.getIntersection(segment);
44071                 if (nextInter !== null) {
44072                   if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
44073                   if (!nextSeg.isAnEndpoint(nextInter)) {
44074                     const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
44075                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44076                       newEvents.push(newEventsFromSplit[i3]);
44077                     }
44078                   }
44079                 }
44080               }
44081               if (prevMySplitter !== null || nextMySplitter !== null) {
44082                 let mySplitter = null;
44083                 if (prevMySplitter === null) mySplitter = nextMySplitter;
44084                 else if (nextMySplitter === null) mySplitter = prevMySplitter;
44085                 else {
44086                   const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
44087                   mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
44088                 }
44089                 this.queue.remove(segment.rightSE);
44090                 newEvents.push(segment.rightSE);
44091                 const newEventsFromSplit = segment.split(mySplitter);
44092                 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44093                   newEvents.push(newEventsFromSplit[i3]);
44094                 }
44095               }
44096               if (newEvents.length > 0) {
44097                 this.tree.remove(segment);
44098                 newEvents.push(event);
44099               } else {
44100                 this.segments.push(segment);
44101                 segment.prev = prevSeg;
44102               }
44103             } else {
44104               if (prevSeg && nextSeg) {
44105                 const inter = prevSeg.getIntersection(nextSeg);
44106                 if (inter !== null) {
44107                   if (!prevSeg.isAnEndpoint(inter)) {
44108                     const newEventsFromSplit = this._splitSafely(prevSeg, inter);
44109                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44110                       newEvents.push(newEventsFromSplit[i3]);
44111                     }
44112                   }
44113                   if (!nextSeg.isAnEndpoint(inter)) {
44114                     const newEventsFromSplit = this._splitSafely(nextSeg, inter);
44115                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
44116                       newEvents.push(newEventsFromSplit[i3]);
44117                     }
44118                   }
44119                 }
44120               }
44121               this.tree.remove(segment);
44122             }
44123             return newEvents;
44124           }
44125           /* Safely split a segment that is currently in the datastructures
44126            * IE - a segment other than the one that is currently being processed. */
44127           _splitSafely(seg, pt2) {
44128             this.tree.remove(seg);
44129             const rightSE = seg.rightSE;
44130             this.queue.remove(rightSE);
44131             const newEvents = seg.split(pt2);
44132             newEvents.push(rightSE);
44133             if (seg.consumedBy === void 0) this.tree.add(seg);
44134             return newEvents;
44135           }
44136         }
44137         const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
44138         const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
44139         class Operation2 {
44140           run(type2, geom, moreGeoms) {
44141             operation2.type = type2;
44142             rounder.reset();
44143             const multipolys = [new MultiPolyIn2(geom, true)];
44144             for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
44145               multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
44146             }
44147             operation2.numMultiPolys = multipolys.length;
44148             if (operation2.type === "difference") {
44149               const subject = multipolys[0];
44150               let i3 = 1;
44151               while (i3 < multipolys.length) {
44152                 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
44153                 else multipolys.splice(i3, 1);
44154               }
44155             }
44156             if (operation2.type === "intersection") {
44157               for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
44158                 const mpA = multipolys[i3];
44159                 for (let j3 = i3 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
44160                   if (getBboxOverlap2(mpA.bbox, multipolys[j3].bbox) === null) return [];
44161                 }
44162               }
44163             }
44164             const queue = new Tree(SweepEvent2.compare);
44165             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
44166               const sweepEvents = multipolys[i3].getSweepEvents();
44167               for (let j3 = 0, jMax = sweepEvents.length; j3 < jMax; j3++) {
44168                 queue.insert(sweepEvents[j3]);
44169                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
44170                   throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
44171                 }
44172               }
44173             }
44174             const sweepLine = new SweepLine2(queue);
44175             let prevQueueSize = queue.size;
44176             let node = queue.pop();
44177             while (node) {
44178               const evt = node.key;
44179               if (queue.size === prevQueueSize) {
44180                 const seg = evt.segment;
44181                 throw new Error(`Unable to pop() ${evt.isLeft ? "left" : "right"} SweepEvent [${evt.point.x}, ${evt.point.y}] from segment #${seg.id} [${seg.leftSE.point.x}, ${seg.leftSE.point.y}] -> [${seg.rightSE.point.x}, ${seg.rightSE.point.y}] from queue.`);
44182               }
44183               if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
44184                 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
44185               }
44186               if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
44187                 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
44188               }
44189               const newEvents = sweepLine.process(evt);
44190               for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
44191                 const evt2 = newEvents[i3];
44192                 if (evt2.consumedBy === void 0) queue.insert(evt2);
44193               }
44194               prevQueueSize = queue.size;
44195               node = queue.pop();
44196             }
44197             rounder.reset();
44198             const ringsOut = RingOut2.factory(sweepLine.segments);
44199             const result = new MultiPolyOut2(ringsOut);
44200             return result.getGeom();
44201           }
44202         }
44203         const operation2 = new Operation2();
44204         const union2 = function(geom) {
44205           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
44206             moreGeoms[_key - 1] = arguments[_key];
44207           }
44208           return operation2.run("union", geom, moreGeoms);
44209         };
44210         const intersection2 = function(geom) {
44211           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
44212             moreGeoms[_key2 - 1] = arguments[_key2];
44213           }
44214           return operation2.run("intersection", geom, moreGeoms);
44215         };
44216         const xor = function(geom) {
44217           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
44218             moreGeoms[_key3 - 1] = arguments[_key3];
44219           }
44220           return operation2.run("xor", geom, moreGeoms);
44221         };
44222         const difference2 = function(subjectGeom) {
44223           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
44224             clippingGeoms[_key4 - 1] = arguments[_key4];
44225           }
44226           return operation2.run("difference", subjectGeom, clippingGeoms);
44227         };
44228         var index = {
44229           union: union2,
44230           intersection: intersection2,
44231           xor,
44232           difference: difference2
44233         };
44234         return index;
44235       });
44236     }
44237   });
44238
44239   // modules/services/vector_tile.js
44240   var vector_tile_exports = {};
44241   __export(vector_tile_exports, {
44242     default: () => vector_tile_default
44243   });
44244   function abortRequest6(controller) {
44245     controller.abort();
44246   }
44247   function vtToGeoJSON(data, tile, mergeCache) {
44248     var vectorTile = new VectorTile(new Pbf(data));
44249     var layers = Object.keys(vectorTile.layers);
44250     if (!Array.isArray(layers)) {
44251       layers = [layers];
44252     }
44253     var features = [];
44254     layers.forEach(function(layerID) {
44255       var layer = vectorTile.layers[layerID];
44256       if (layer) {
44257         for (var i3 = 0; i3 < layer.length; i3++) {
44258           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44259           var geometry = feature3.geometry;
44260           if (geometry.type === "Polygon") {
44261             geometry.type = "MultiPolygon";
44262             geometry.coordinates = [geometry.coordinates];
44263           }
44264           var isClipped = false;
44265           if (geometry.type === "MultiPolygon") {
44266             var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
44267             if (!(0, import_fast_deep_equal4.default)(feature3.geometry, featureClip.geometry)) {
44268               isClipped = true;
44269             }
44270             if (!feature3.geometry.coordinates.length) continue;
44271             if (!feature3.geometry.coordinates[0].length) continue;
44272           }
44273           var featurehash = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
44274           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3.properties || {}));
44275           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
44276           feature3.__featurehash__ = featurehash;
44277           feature3.__propertyhash__ = propertyhash;
44278           features.push(feature3);
44279           if (isClipped && geometry.type === "MultiPolygon") {
44280             var merged = mergeCache[propertyhash];
44281             if (merged && merged.length) {
44282               var other = merged[0];
44283               var coords = import_polygon_clipping.default.union(
44284                 feature3.geometry.coordinates,
44285                 other.geometry.coordinates
44286               );
44287               if (!coords || !coords.length) {
44288                 continue;
44289               }
44290               merged.push(feature3);
44291               for (var j3 = 0; j3 < merged.length; j3++) {
44292                 merged[j3].geometry.coordinates = coords;
44293                 merged[j3].__featurehash__ = featurehash;
44294               }
44295             } else {
44296               mergeCache[propertyhash] = [feature3];
44297             }
44298           }
44299         }
44300       }
44301     });
44302     return features;
44303   }
44304   function loadTile3(source, tile) {
44305     if (source.loaded[tile.id] || source.inflight[tile.id]) return;
44306     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(s2, r2) {
44307       var subdomains = r2.split(",");
44308       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
44309     });
44310     var controller = new AbortController();
44311     source.inflight[tile.id] = controller;
44312     fetch(url, { signal: controller.signal }).then(function(response) {
44313       if (!response.ok) {
44314         throw new Error(response.status + " " + response.statusText);
44315       }
44316       source.loaded[tile.id] = [];
44317       delete source.inflight[tile.id];
44318       return response.arrayBuffer();
44319     }).then(function(data) {
44320       if (!data) {
44321         throw new Error("No Data");
44322       }
44323       var z3 = tile.xyz[2];
44324       if (!source.canMerge[z3]) {
44325         source.canMerge[z3] = {};
44326       }
44327       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z3]);
44328       dispatch11.call("loadedData");
44329     }).catch(function() {
44330       source.loaded[tile.id] = [];
44331       delete source.inflight[tile.id];
44332     });
44333   }
44334   var import_fast_deep_equal4, import_fast_json_stable_stringify, import_polygon_clipping, tiler7, dispatch11, _vtCache, vector_tile_default;
44335   var init_vector_tile2 = __esm({
44336     "modules/services/vector_tile.js"() {
44337       "use strict";
44338       init_src4();
44339       import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
44340       init_esm5();
44341       import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
44342       import_polygon_clipping = __toESM(require_polygon_clipping_umd());
44343       init_pbf();
44344       init_vector_tile();
44345       init_util();
44346       tiler7 = utilTiler().tileSize(512).margin(1);
44347       dispatch11 = dispatch_default("loadedData");
44348       vector_tile_default = {
44349         init: function() {
44350           if (!_vtCache) {
44351             this.reset();
44352           }
44353           this.event = utilRebind(this, dispatch11, "on");
44354         },
44355         reset: function() {
44356           for (var sourceID in _vtCache) {
44357             var source = _vtCache[sourceID];
44358             if (source && source.inflight) {
44359               Object.values(source.inflight).forEach(abortRequest6);
44360             }
44361           }
44362           _vtCache = {};
44363         },
44364         addSource: function(sourceID, template) {
44365           _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
44366           return _vtCache[sourceID];
44367         },
44368         data: function(sourceID, projection2) {
44369           var source = _vtCache[sourceID];
44370           if (!source) return [];
44371           var tiles = tiler7.getTiles(projection2);
44372           var seen = {};
44373           var results = [];
44374           for (var i3 = 0; i3 < tiles.length; i3++) {
44375             var features = source.loaded[tiles[i3].id];
44376             if (!features || !features.length) continue;
44377             for (var j3 = 0; j3 < features.length; j3++) {
44378               var feature3 = features[j3];
44379               var hash2 = feature3.__featurehash__;
44380               if (seen[hash2]) continue;
44381               seen[hash2] = true;
44382               results.push(Object.assign({}, feature3));
44383             }
44384           }
44385           return results;
44386         },
44387         loadTiles: function(sourceID, template, projection2) {
44388           var source = _vtCache[sourceID];
44389           if (!source) {
44390             source = this.addSource(sourceID, template);
44391           }
44392           var tiles = tiler7.getTiles(projection2);
44393           Object.keys(source.inflight).forEach(function(k3) {
44394             var wanted = tiles.find(function(tile) {
44395               return k3 === tile.id;
44396             });
44397             if (!wanted) {
44398               abortRequest6(source.inflight[k3]);
44399               delete source.inflight[k3];
44400             }
44401           });
44402           tiles.forEach(function(tile) {
44403             loadTile3(source, tile);
44404           });
44405         },
44406         cache: function() {
44407           return _vtCache;
44408         }
44409       };
44410     }
44411   });
44412
44413   // modules/services/wikidata.js
44414   var wikidata_exports = {};
44415   __export(wikidata_exports, {
44416     default: () => wikidata_default
44417   });
44418   var apibase5, _wikidataCache, wikidata_default;
44419   var init_wikidata = __esm({
44420     "modules/services/wikidata.js"() {
44421       "use strict";
44422       init_src18();
44423       init_util();
44424       init_localizer();
44425       apibase5 = "https://www.wikidata.org/w/api.php?";
44426       _wikidataCache = {};
44427       wikidata_default = {
44428         init: function() {
44429         },
44430         reset: function() {
44431           _wikidataCache = {};
44432         },
44433         // Search for Wikidata items matching the query
44434         itemsForSearchQuery: function(query, callback, language) {
44435           if (!query) {
44436             if (callback) callback("No query", {});
44437             return;
44438           }
44439           var lang = this.languagesToQuery()[0];
44440           var url = apibase5 + utilQsString({
44441             action: "wbsearchentities",
44442             format: "json",
44443             formatversion: 2,
44444             search: query,
44445             type: "item",
44446             // the language to search
44447             language: language || lang,
44448             // the language for the label and description in the result
44449             uselang: lang,
44450             limit: 10,
44451             origin: "*"
44452           });
44453           json_default(url).then((result) => {
44454             if (result && result.error) {
44455               if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
44456                 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
44457                 return;
44458               } else {
44459                 throw new Error(result.error);
44460               }
44461             }
44462             if (callback) callback(null, result.search || {});
44463           }).catch(function(err) {
44464             if (callback) callback(err.message, {});
44465           });
44466         },
44467         // Given a Wikipedia language and article title,
44468         // return an array of corresponding Wikidata entities.
44469         itemsByTitle: function(lang, title, callback) {
44470           if (!title) {
44471             if (callback) callback("No title", {});
44472             return;
44473           }
44474           lang = lang || "en";
44475           var url = apibase5 + utilQsString({
44476             action: "wbgetentities",
44477             format: "json",
44478             formatversion: 2,
44479             sites: lang.replace(/-/g, "_") + "wiki",
44480             titles: title,
44481             languages: "en",
44482             // shrink response by filtering to one language
44483             origin: "*"
44484           });
44485           json_default(url).then(function(result) {
44486             if (result && result.error) {
44487               throw new Error(result.error);
44488             }
44489             if (callback) callback(null, result.entities || {});
44490           }).catch(function(err) {
44491             if (callback) callback(err.message, {});
44492           });
44493         },
44494         languagesToQuery: function() {
44495           return _mainLocalizer.localeCodes().map(function(code) {
44496             return code.toLowerCase();
44497           }).filter(function(code) {
44498             return code !== "en-us";
44499           });
44500         },
44501         entityByQID: function(qid, callback) {
44502           if (!qid) {
44503             callback("No qid", {});
44504             return;
44505           }
44506           if (_wikidataCache[qid]) {
44507             if (callback) callback(null, _wikidataCache[qid]);
44508             return;
44509           }
44510           var langs = this.languagesToQuery();
44511           var url = apibase5 + utilQsString({
44512             action: "wbgetentities",
44513             format: "json",
44514             formatversion: 2,
44515             ids: qid,
44516             props: "labels|descriptions|claims|sitelinks",
44517             sitefilter: langs.map(function(d2) {
44518               return d2 + "wiki";
44519             }).join("|"),
44520             languages: langs.join("|"),
44521             languagefallback: 1,
44522             origin: "*"
44523           });
44524           json_default(url).then(function(result) {
44525             if (result && result.error) {
44526               throw new Error(result.error);
44527             }
44528             if (callback) callback(null, result.entities[qid] || {});
44529           }).catch(function(err) {
44530             if (callback) callback(err.message, {});
44531           });
44532         },
44533         // Pass `params` object of the form:
44534         // {
44535         //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
44536         // }
44537         //
44538         // Get an result object used to display tag documentation
44539         // {
44540         //   title:        'string',
44541         //   description:  'string',
44542         //   editURL:      'string',
44543         //   imageURL:     'string',
44544         //   wiki:         { title: 'string', text: 'string', url: 'string' }
44545         // }
44546         //
44547         getDocs: function(params, callback) {
44548           var langs = this.languagesToQuery();
44549           this.entityByQID(params.qid, function(err, entity) {
44550             if (err || !entity) {
44551               callback(err || "No entity");
44552               return;
44553             }
44554             var i3;
44555             var description;
44556             for (i3 in langs) {
44557               let code = langs[i3];
44558               if (entity.descriptions[code] && entity.descriptions[code].language === code) {
44559                 description = entity.descriptions[code];
44560                 break;
44561               }
44562             }
44563             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
44564             var result = {
44565               title: entity.id,
44566               description: (selection2) => selection2.text(description ? description.value : ""),
44567               descriptionLocaleCode: description ? description.language : "",
44568               editURL: "https://www.wikidata.org/wiki/" + entity.id
44569             };
44570             if (entity.claims) {
44571               var imageroot = "https://commons.wikimedia.org/w/index.php";
44572               var props = ["P154", "P18"];
44573               var prop, image;
44574               for (i3 = 0; i3 < props.length; i3++) {
44575                 prop = entity.claims[props[i3]];
44576                 if (prop && Object.keys(prop).length > 0) {
44577                   image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
44578                   if (image) {
44579                     result.imageURL = imageroot + "?" + utilQsString({
44580                       title: "Special:Redirect/file/" + image,
44581                       width: 400
44582                     });
44583                     break;
44584                   }
44585                 }
44586               }
44587             }
44588             if (entity.sitelinks) {
44589               var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
44590               for (i3 = 0; i3 < langs.length; i3++) {
44591                 var w3 = langs[i3] + "wiki";
44592                 if (entity.sitelinks[w3]) {
44593                   var title = entity.sitelinks[w3].title;
44594                   var tKey = "inspector.wiki_reference";
44595                   if (!englishLocale && langs[i3] === "en") {
44596                     tKey = "inspector.wiki_en_reference";
44597                   }
44598                   result.wiki = {
44599                     title,
44600                     text: tKey,
44601                     url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
44602                   };
44603                   break;
44604                 }
44605               }
44606             }
44607             callback(null, result);
44608           });
44609         }
44610       };
44611     }
44612   });
44613
44614   // modules/services/wikipedia.js
44615   var wikipedia_exports = {};
44616   __export(wikipedia_exports, {
44617     default: () => wikipedia_default
44618   });
44619   var endpoint, wikipedia_default;
44620   var init_wikipedia = __esm({
44621     "modules/services/wikipedia.js"() {
44622       "use strict";
44623       init_src18();
44624       init_util();
44625       endpoint = "https://en.wikipedia.org/w/api.php?";
44626       wikipedia_default = {
44627         init: function() {
44628         },
44629         reset: function() {
44630         },
44631         search: function(lang, query, callback) {
44632           if (!query) {
44633             if (callback) callback("No Query", []);
44634             return;
44635           }
44636           lang = lang || "en";
44637           var url = endpoint.replace("en", lang) + utilQsString({
44638             action: "query",
44639             list: "search",
44640             srlimit: "10",
44641             srinfo: "suggestion",
44642             format: "json",
44643             origin: "*",
44644             srsearch: query
44645           });
44646           json_default(url).then(function(result) {
44647             if (result && result.error) {
44648               throw new Error(result.error);
44649             } else if (!result || !result.query || !result.query.search) {
44650               throw new Error("No Results");
44651             }
44652             if (callback) {
44653               var titles = result.query.search.map(function(d2) {
44654                 return d2.title;
44655               });
44656               callback(null, titles);
44657             }
44658           }).catch(function(err) {
44659             if (callback) callback(err, []);
44660           });
44661         },
44662         suggestions: function(lang, query, callback) {
44663           if (!query) {
44664             if (callback) callback("", []);
44665             return;
44666           }
44667           lang = lang || "en";
44668           var url = endpoint.replace("en", lang) + utilQsString({
44669             action: "opensearch",
44670             namespace: 0,
44671             suggest: "",
44672             format: "json",
44673             origin: "*",
44674             search: query
44675           });
44676           json_default(url).then(function(result) {
44677             if (result && result.error) {
44678               throw new Error(result.error);
44679             } else if (!result || result.length < 2) {
44680               throw new Error("No Results");
44681             }
44682             if (callback) callback(null, result[1] || []);
44683           }).catch(function(err) {
44684             if (callback) callback(err.message, []);
44685           });
44686         },
44687         translations: function(lang, title, callback) {
44688           if (!title) {
44689             if (callback) callback("No Title");
44690             return;
44691           }
44692           var url = endpoint.replace("en", lang) + utilQsString({
44693             action: "query",
44694             prop: "langlinks",
44695             format: "json",
44696             origin: "*",
44697             lllimit: 500,
44698             titles: title
44699           });
44700           json_default(url).then(function(result) {
44701             if (result && result.error) {
44702               throw new Error(result.error);
44703             } else if (!result || !result.query || !result.query.pages) {
44704               throw new Error("No Results");
44705             }
44706             if (callback) {
44707               var list = result.query.pages[Object.keys(result.query.pages)[0]];
44708               var translations = {};
44709               if (list && list.langlinks) {
44710                 list.langlinks.forEach(function(d2) {
44711                   translations[d2.lang] = d2["*"];
44712                 });
44713               }
44714               callback(null, translations);
44715             }
44716           }).catch(function(err) {
44717             if (callback) callback(err.message);
44718           });
44719         }
44720       };
44721     }
44722   });
44723
44724   // modules/services/mapilio.js
44725   var mapilio_exports = {};
44726   __export(mapilio_exports, {
44727     default: () => mapilio_default
44728   });
44729   function partitionViewport5(projection2) {
44730     const z3 = geoScaleToZoom(projection2.scale());
44731     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
44732     const tiler8 = utilTiler().zoomExtent([z22, z22]);
44733     return tiler8.getTiles(projection2).map(function(tile) {
44734       return tile.extent;
44735     });
44736   }
44737   function searchLimited5(limit, projection2, rtree) {
44738     limit = limit || 5;
44739     return partitionViewport5(projection2).reduce(function(result, extent) {
44740       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
44741         return d2.data;
44742       });
44743       return found.length ? result.concat(found) : result;
44744     }, []);
44745   }
44746   function loadTiles4(which, url, maxZoom2, projection2) {
44747     const tiler8 = utilTiler().zoomExtent([minZoom2, maxZoom2]).skipNullIsland(true);
44748     const tiles = tiler8.getTiles(projection2);
44749     tiles.forEach(function(tile) {
44750       loadTile4(which, url, tile);
44751     });
44752   }
44753   function loadTile4(which, url, tile) {
44754     const cache = _cache3.requests;
44755     const tileId = `${tile.id}-${which}`;
44756     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
44757     const controller = new AbortController();
44758     cache.inflight[tileId] = controller;
44759     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
44760     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
44761       if (!response.ok) {
44762         throw new Error(response.status + " " + response.statusText);
44763       }
44764       cache.loaded[tileId] = true;
44765       delete cache.inflight[tileId];
44766       return response.arrayBuffer();
44767     }).then(function(data) {
44768       if (data.byteLength === 0) {
44769         throw new Error("No Data");
44770       }
44771       loadTileDataToCache2(data, tile, which);
44772       if (which === "images") {
44773         dispatch12.call("loadedImages");
44774       } else {
44775         dispatch12.call("loadedLines");
44776       }
44777     }).catch(function(e3) {
44778       if (e3.message === "No Data") {
44779         cache.loaded[tileId] = true;
44780       } else {
44781         console.error(e3);
44782       }
44783     });
44784   }
44785   function loadTileDataToCache2(data, tile) {
44786     const vectorTile = new VectorTile(new Pbf(data));
44787     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
44788       const features = [];
44789       const cache = _cache3.images;
44790       const layer = vectorTile.layers[pointLayer];
44791       for (let i3 = 0; i3 < layer.length; i3++) {
44792         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44793         const loc = feature3.geometry.coordinates;
44794         let resolutionArr = feature3.properties.resolution.split("x");
44795         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
44796         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
44797         let isPano = sourceWidth % sourceHeight === 0;
44798         const d2 = {
44799           service: "photo",
44800           loc,
44801           capture_time: feature3.properties.capture_time,
44802           id: feature3.properties.id,
44803           sequence_id: feature3.properties.sequence_uuid,
44804           heading: feature3.properties.heading,
44805           resolution: feature3.properties.resolution,
44806           isPano
44807         };
44808         cache.forImageId[d2.id] = d2;
44809         features.push({
44810           minX: loc[0],
44811           minY: loc[1],
44812           maxX: loc[0],
44813           maxY: loc[1],
44814           data: d2
44815         });
44816       }
44817       if (cache.rtree) {
44818         cache.rtree.load(features);
44819       }
44820     }
44821     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
44822       const cache = _cache3.sequences;
44823       const layer = vectorTile.layers[lineLayer];
44824       for (let i3 = 0; i3 < layer.length; i3++) {
44825         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
44826         if (cache.lineString[feature3.properties.sequence_uuid]) {
44827           const cacheEntry = cache.lineString[feature3.properties.sequence_uuid];
44828           if (cacheEntry.some((f2) => {
44829             const cachedCoords = f2.geometry.coordinates;
44830             const featureCoords = feature3.geometry.coordinates;
44831             return isEqual_default(cachedCoords, featureCoords);
44832           })) continue;
44833           cacheEntry.push(feature3);
44834         } else {
44835           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
44836         }
44837       }
44838     }
44839   }
44840   function getImageData(imageId, sequenceId) {
44841     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
44842       if (!response.ok) {
44843         throw new Error(response.status + " " + response.statusText);
44844       }
44845       return response.json();
44846     }).then(function(data) {
44847       let index = data.data.findIndex((feature3) => feature3.id === imageId);
44848       const { filename, uploaded_hash } = data.data[index];
44849       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
44850     });
44851   }
44852   var apiUrl2, imageBaseUrl, baseTileUrl2, pointLayer, lineLayer, tileStyle, minZoom2, dispatch12, imgZoom2, pannellumViewerCSS3, pannellumViewerJS3, resolution, _activeImage, _cache3, _loadViewerPromise5, _pannellumViewer3, _sceneOptions2, _currScene2, mapilio_default;
44853   var init_mapilio = __esm({
44854     "modules/services/mapilio.js"() {
44855       "use strict";
44856       init_src4();
44857       init_src5();
44858       init_src12();
44859       init_pbf();
44860       init_rbush();
44861       init_vector_tile();
44862       init_lodash();
44863       init_util();
44864       init_geo2();
44865       init_localizer();
44866       init_services();
44867       apiUrl2 = "https://end.mapilio.com";
44868       imageBaseUrl = "https://cdn.mapilio.com/im";
44869       baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
44870       pointLayer = "map_points";
44871       lineLayer = "map_roads_line";
44872       tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
44873       minZoom2 = 14;
44874       dispatch12 = dispatch_default("loadedImages", "loadedLines");
44875       imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
44876       pannellumViewerCSS3 = "pannellum/pannellum.css";
44877       pannellumViewerJS3 = "pannellum/pannellum.js";
44878       resolution = 1080;
44879       _sceneOptions2 = {
44880         showFullscreenCtrl: false,
44881         autoLoad: true,
44882         yaw: 0,
44883         minHfov: 10,
44884         maxHfov: 90,
44885         hfov: 60
44886       };
44887       _currScene2 = 0;
44888       mapilio_default = {
44889         // Initialize Mapilio
44890         init: function() {
44891           if (!_cache3) {
44892             this.reset();
44893           }
44894           this.event = utilRebind(this, dispatch12, "on");
44895         },
44896         // Reset cache and state
44897         reset: function() {
44898           if (_cache3) {
44899             Object.values(_cache3.requests.inflight).forEach(function(request3) {
44900               request3.abort();
44901             });
44902           }
44903           _cache3 = {
44904             images: { rtree: new RBush(), forImageId: {} },
44905             sequences: { rtree: new RBush(), lineString: {} },
44906             requests: { loaded: {}, inflight: {} }
44907           };
44908         },
44909         // Get visible images
44910         images: function(projection2) {
44911           const limit = 5;
44912           return searchLimited5(limit, projection2, _cache3.images.rtree);
44913         },
44914         cachedImage: function(imageKey) {
44915           return _cache3.images.forImageId[imageKey];
44916         },
44917         // Load images in the visible area
44918         loadImages: function(projection2) {
44919           let url = baseTileUrl2 + pointLayer + tileStyle;
44920           loadTiles4("images", url, 14, projection2);
44921         },
44922         // Load line in the visible area
44923         loadLines: function(projection2) {
44924           let url = baseTileUrl2 + lineLayer + tileStyle;
44925           loadTiles4("line", url, 14, projection2);
44926         },
44927         // Get visible sequences
44928         sequences: function(projection2) {
44929           const viewport = projection2.clipExtent();
44930           const min3 = [viewport[0][0], viewport[1][1]];
44931           const max3 = [viewport[1][0], viewport[0][1]];
44932           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
44933           const sequenceIds = {};
44934           let lineStrings = [];
44935           _cache3.images.rtree.search(bbox2).forEach(function(d2) {
44936             if (d2.data.sequence_id) {
44937               sequenceIds[d2.data.sequence_id] = true;
44938             }
44939           });
44940           Object.keys(sequenceIds).forEach(function(sequenceId) {
44941             if (_cache3.sequences.lineString[sequenceId]) {
44942               lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
44943             }
44944           });
44945           return lineStrings;
44946         },
44947         // Set the currently visible image
44948         setActiveImage: function(image) {
44949           if (image) {
44950             _activeImage = {
44951               id: image.id,
44952               sequence_id: image.sequence_id
44953             };
44954           } else {
44955             _activeImage = null;
44956           }
44957         },
44958         // Update the currently highlighted sequence and selected bubble.
44959         setStyles: function(context, hovered) {
44960           const hoveredImageId = hovered && hovered.id;
44961           const hoveredSequenceId = hovered && hovered.sequence_id;
44962           const selectedSequenceId = _activeImage && _activeImage.sequence_id;
44963           const selectedImageId = _activeImage && _activeImage.id;
44964           const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
44965           const sequences = context.container().selectAll(".layer-mapilio .sequence");
44966           markers.classed("highlighted", function(d2) {
44967             return d2.id === hoveredImageId;
44968           }).classed("hovered", function(d2) {
44969             return d2.id === hoveredImageId;
44970           }).classed("currentView", function(d2) {
44971             return d2.id === selectedImageId;
44972           });
44973           sequences.classed("highlighted", function(d2) {
44974             return d2.properties.sequence_uuid === hoveredSequenceId;
44975           }).classed("currentView", function(d2) {
44976             return d2.properties.sequence_uuid === selectedSequenceId;
44977           });
44978           return this;
44979         },
44980         updateUrlImage: function(imageKey) {
44981           const hash2 = utilStringQs(window.location.hash);
44982           if (imageKey) {
44983             hash2.photo = "mapilio/" + imageKey;
44984           } else {
44985             delete hash2.photo;
44986           }
44987           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
44988         },
44989         initViewer: function() {
44990           if (!window.pannellum) return;
44991           if (_pannellumViewer3) return;
44992           _currScene2 += 1;
44993           const sceneID = _currScene2.toString();
44994           const options = {
44995             "default": { firstScene: sceneID },
44996             scenes: {}
44997           };
44998           options.scenes[sceneID] = _sceneOptions2;
44999           _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options);
45000         },
45001         selectImage: function(context, id2) {
45002           let that = this;
45003           let d2 = this.cachedImage(id2);
45004           this.setActiveImage(d2);
45005           this.updateUrlImage(d2.id);
45006           let viewer = context.container().select(".photoviewer");
45007           if (!viewer.empty()) viewer.datum(d2);
45008           this.setStyles(context, null);
45009           if (!d2) return this;
45010           let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
45011           let attribution = wrap2.selectAll(".photo-attribution").text("");
45012           if (d2.capture_time) {
45013             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
45014             attribution.append("span").text("|");
45015           }
45016           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", `https://mapilio.com/app?lat=${d2.loc[1]}&lng=${d2.loc[0]}&zoom=17&pId=${d2.id}`).text("mapilio.com");
45017           wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
45018           wrap2.selectAll("img").remove();
45019           wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
45020           wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
45021           getImageData(d2.id, d2.sequence_id).then(function() {
45022             if (d2.isPano) {
45023               if (!_pannellumViewer3) {
45024                 that.initViewer();
45025               } else {
45026                 _currScene2 += 1;
45027                 let sceneID = _currScene2.toString();
45028                 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
45029                 if (_currScene2 > 2) {
45030                   sceneID = (_currScene2 - 1).toString();
45031                   _pannellumViewer3.removeScene(sceneID);
45032                 }
45033               }
45034             } else {
45035               that.initOnlyPhoto(context);
45036             }
45037           });
45038           function localeDateString2(s2) {
45039             if (!s2) return null;
45040             var options = { day: "numeric", month: "short", year: "numeric" };
45041             var d4 = new Date(s2);
45042             if (isNaN(d4.getTime())) return null;
45043             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
45044           }
45045           return this;
45046         },
45047         initOnlyPhoto: function(context) {
45048           if (_pannellumViewer3) {
45049             _pannellumViewer3.destroy();
45050             _pannellumViewer3 = null;
45051           }
45052           let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
45053           let imgWrap = wrap2.select("img");
45054           if (!imgWrap.empty()) {
45055             imgWrap.attr("src", _sceneOptions2.panorama);
45056           } else {
45057             wrap2.append("img").attr("src", _sceneOptions2.panorama);
45058           }
45059         },
45060         ensureViewerLoaded: function(context) {
45061           let that = this;
45062           let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
45063           if (!imgWrap.empty()) {
45064             imgWrap.remove();
45065           }
45066           if (_loadViewerPromise5) return _loadViewerPromise5;
45067           let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
45068           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
45069           wrapEnter.append("div").attr("class", "photo-attribution fillD");
45070           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
45071           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
45072           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
45073           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
45074           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom2.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
45075           context.ui().photoviewer.on("resize.mapilio", () => {
45076             if (_pannellumViewer3) {
45077               _pannellumViewer3.resize();
45078             }
45079           });
45080           _loadViewerPromise5 = new Promise((resolve, reject) => {
45081             let loadedCount = 0;
45082             function loaded() {
45083               loadedCount += 1;
45084               if (loadedCount === 2) resolve();
45085             }
45086             const head = select_default2("head");
45087             head.selectAll("#ideditor-mapilio-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapilio-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
45088               reject();
45089             });
45090             head.selectAll("#ideditor-mapilio-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapilio-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
45091               reject();
45092             });
45093           }).catch(function() {
45094             _loadViewerPromise5 = null;
45095           });
45096           function step(stepBy) {
45097             return function() {
45098               if (!_activeImage) return;
45099               const imageId = _activeImage.id;
45100               const nextIndex = imageId + stepBy;
45101               if (!nextIndex) return;
45102               const nextImage = _cache3.images.forImageId[nextIndex];
45103               context.map().centerEase(nextImage.loc);
45104               that.selectImage(context, nextImage.id);
45105             };
45106           }
45107           function zoomPan2(d3_event) {
45108             var t2 = d3_event.transform;
45109             context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
45110           }
45111           return _loadViewerPromise5;
45112         },
45113         showViewer: function(context) {
45114           const wrap2 = context.container().select(".photoviewer");
45115           const isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
45116           if (isHidden) {
45117             for (const service of Object.values(services)) {
45118               if (service === this) continue;
45119               if (typeof service.hideViewer === "function") {
45120                 service.hideViewer(context);
45121               }
45122             }
45123             wrap2.classed("hide", false).selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
45124           }
45125           return this;
45126         },
45127         /**
45128          * hideViewer()
45129          */
45130         hideViewer: function(context) {
45131           let viewer = context.container().select(".photoviewer");
45132           if (!viewer.empty()) viewer.datum(null);
45133           this.updateUrlImage(null);
45134           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
45135           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
45136           this.setActiveImage();
45137           return this.setStyles(context, null);
45138         },
45139         // Return the current cache
45140         cache: function() {
45141           return _cache3;
45142         }
45143       };
45144     }
45145   });
45146
45147   // modules/services/panoramax.js
45148   var panoramax_exports = {};
45149   __export(panoramax_exports, {
45150     default: () => panoramax_default
45151   });
45152   function partitionViewport6(projection2) {
45153     const z3 = geoScaleToZoom(projection2.scale());
45154     const z22 = Math.ceil(z3 * 2) / 2 + 2.5;
45155     const tiler8 = utilTiler().zoomExtent([z22, z22]);
45156     return tiler8.getTiles(projection2).map(function(tile) {
45157       return tile.extent;
45158     });
45159   }
45160   function searchLimited6(limit, projection2, rtree) {
45161     limit = limit || 5;
45162     return partitionViewport6(projection2).reduce(function(result, extent) {
45163       let found = rtree.search(extent.bbox());
45164       const spacing = Math.max(1, Math.floor(found.length / limit));
45165       found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a4, b3) => {
45166         if (a4.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
45167         if (b3.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
45168         return 0;
45169       }).slice(0, limit).map((d2) => d2.data);
45170       return found.length ? result.concat(found) : result;
45171     }, []);
45172   }
45173   function loadTiles5(which, url, maxZoom2, projection2, zoom) {
45174     const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
45175     const tiles = tiler8.getTiles(projection2);
45176     tiles.forEach(function(tile) {
45177       loadTile5(which, url, tile, zoom);
45178     });
45179   }
45180   function loadTile5(which, url, tile, zoom) {
45181     const cache = _cache4.requests;
45182     const tileId = `${tile.id}-${which}`;
45183     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
45184     const controller = new AbortController();
45185     cache.inflight[tileId] = controller;
45186     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
45187     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
45188       if (!response.ok) {
45189         throw new Error(response.status + " " + response.statusText);
45190       }
45191       cache.loaded[tileId] = true;
45192       delete cache.inflight[tileId];
45193       return response.arrayBuffer();
45194     }).then(function(data) {
45195       if (data.byteLength === 0) {
45196         throw new Error("No Data");
45197       }
45198       loadTileDataToCache3(data, tile, zoom);
45199       if (which === "images") {
45200         dispatch13.call("loadedImages");
45201       } else {
45202         dispatch13.call("loadedLines");
45203       }
45204     }).catch(function(e3) {
45205       if (e3.message === "No Data") {
45206         cache.loaded[tileId] = true;
45207       } else {
45208         console.error(e3);
45209       }
45210     });
45211   }
45212   function loadTileDataToCache3(data, tile, zoom) {
45213     const vectorTile = new VectorTile(new Pbf(data));
45214     let features, cache, layer, i3, feature3, loc, d2;
45215     if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
45216       features = [];
45217       cache = _cache4.images;
45218       layer = vectorTile.layers[pictureLayer];
45219       for (i3 = 0; i3 < layer.length; i3++) {
45220         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
45221         loc = feature3.geometry.coordinates;
45222         d2 = {
45223           service: "photo",
45224           loc,
45225           capture_time: feature3.properties.ts,
45226           capture_time_parsed: new Date(feature3.properties.ts),
45227           id: feature3.properties.id,
45228           account_id: feature3.properties.account_id,
45229           sequence_id: feature3.properties.first_sequence,
45230           heading: parseInt(feature3.properties.heading, 10),
45231           image_path: "",
45232           isPano: feature3.properties.type === "equirectangular",
45233           model: feature3.properties.model
45234         };
45235         cache.forImageId[d2.id] = d2;
45236         features.push({
45237           minX: loc[0],
45238           minY: loc[1],
45239           maxX: loc[0],
45240           maxY: loc[1],
45241           data: d2
45242         });
45243       }
45244       if (cache.rtree) {
45245         cache.rtree.load(features);
45246       }
45247     }
45248     if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
45249       cache = _cache4.sequences;
45250       if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
45251       layer = vectorTile.layers[sequenceLayer];
45252       for (i3 = 0; i3 < layer.length; i3++) {
45253         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
45254         if (cache.lineString[feature3.properties.id]) {
45255           cache.lineString[feature3.properties.id].push(feature3);
45256         } else {
45257           cache.lineString[feature3.properties.id] = [feature3];
45258         }
45259       }
45260     }
45261   }
45262   async function getUsername(userId) {
45263     const cache = _cache4.users;
45264     if (cache[userId]) return cache[userId].name;
45265     const requestUrl = usernameURL.replace("{userId}", userId);
45266     const response = await fetch(requestUrl, { method: "GET" });
45267     if (!response.ok) {
45268       throw new Error(response.status + " " + response.statusText);
45269     }
45270     const data = await response.json();
45271     cache[userId] = data;
45272     return data.name;
45273   }
45274   var apiUrl3, tileUrl2, imageDataUrl, sequenceDataUrl, userIdUrl, usernameURL, viewerUrl, highDefinition, standardDefinition, pictureLayer, sequenceLayer, minZoom3, imageMinZoom, lineMinZoom, dispatch13, _cache4, _loadViewerPromise6, _definition, _isHD, _planeFrame2, _pannellumFrame2, _currentFrame2, _currentScene, _activeImage2, _isViewerOpen2, panoramax_default;
45275   var init_panoramax = __esm({
45276     "modules/services/panoramax.js"() {
45277       "use strict";
45278       init_src4();
45279       init_pbf();
45280       init_rbush();
45281       init_vector_tile();
45282       init_util();
45283       init_geo2();
45284       init_localizer();
45285       init_pannellum_photo();
45286       init_plane_photo();
45287       init_services();
45288       apiUrl3 = "https://api.panoramax.xyz/";
45289       tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
45290       imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
45291       sequenceDataUrl = apiUrl3 + "api/collections/{collectionId}/items?limit=1000";
45292       userIdUrl = apiUrl3 + "api/users/search?q={username}";
45293       usernameURL = apiUrl3 + "api/users/{userId}";
45294       viewerUrl = apiUrl3;
45295       highDefinition = "hd";
45296       standardDefinition = "sd";
45297       pictureLayer = "pictures";
45298       sequenceLayer = "sequences";
45299       minZoom3 = 10;
45300       imageMinZoom = 15;
45301       lineMinZoom = 10;
45302       dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
45303       _definition = standardDefinition;
45304       _isHD = false;
45305       _currentScene = {
45306         currentImage: null,
45307         nextImage: null,
45308         prevImage: null
45309       };
45310       _isViewerOpen2 = false;
45311       panoramax_default = {
45312         init: function() {
45313           if (!_cache4) {
45314             this.reset();
45315           }
45316           this.event = utilRebind(this, dispatch13, "on");
45317         },
45318         reset: function() {
45319           if (_cache4) {
45320             Object.values(_cache4.requests.inflight).forEach(function(request3) {
45321               request3.abort();
45322             });
45323           }
45324           _cache4 = {
45325             images: { rtree: new RBush(), forImageId: {} },
45326             sequences: { rtree: new RBush(), lineString: {}, items: {} },
45327             users: {},
45328             mockSequences: { rtree: new RBush(), lineString: {} },
45329             requests: { loaded: {}, inflight: {} }
45330           };
45331         },
45332         /**
45333          * Get visible images from cache
45334          * @param {*} projection Current Projection
45335          * @returns images data for the current projection
45336          */
45337         images: function(projection2) {
45338           const limit = 5;
45339           return searchLimited6(limit, projection2, _cache4.images.rtree);
45340         },
45341         /**
45342          * Get a specific image from cache
45343          * @param {*} imageKey the image id
45344          * @returns
45345          */
45346         cachedImage: function(imageKey) {
45347           return _cache4.images.forImageId[imageKey];
45348         },
45349         /**
45350          * Fetches images data for the visible area
45351          * @param {*} projection Current Projection
45352          */
45353         loadImages: function(projection2) {
45354           loadTiles5("images", tileUrl2, imageMinZoom, projection2);
45355         },
45356         /**
45357          * Fetches sequences data for the visible area
45358          * @param {*} projection Current Projection
45359          */
45360         loadLines: function(projection2, zoom) {
45361           loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
45362         },
45363         /**
45364          * Fetches all possible userIDs from Panoramax
45365          * @param {string} usernames one or multiple usernames
45366          * @returns userIDs
45367          */
45368         getUserIds: async function(usernames) {
45369           const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
45370           const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
45371           if (responses.some((response) => !response.ok)) {
45372             const response = responses.find((response2) => !response2.ok);
45373             throw new Error(response.status + " " + response.statusText);
45374           }
45375           const data = await Promise.all(responses.map((response) => response.json()));
45376           return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
45377         },
45378         /**
45379          * Get visible sequences from cache
45380          * @param {*} projection Current Projection
45381          * @param {number} zoom Current zoom (if zoom < `lineMinZoom` less accurate lines will be drawn)
45382          * @returns sequences data for the current projection
45383          */
45384         sequences: function(projection2, zoom) {
45385           const viewport = projection2.clipExtent();
45386           const min3 = [viewport[0][0], viewport[1][1]];
45387           const max3 = [viewport[1][0], viewport[0][1]];
45388           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
45389           const sequenceIds = {};
45390           let lineStrings = [];
45391           if (zoom >= imageMinZoom) {
45392             _cache4.images.rtree.search(bbox2).forEach(function(d2) {
45393               if (d2.data.sequence_id) {
45394                 sequenceIds[d2.data.sequence_id] = true;
45395               }
45396             });
45397             Object.keys(sequenceIds).forEach(function(sequenceId) {
45398               if (_cache4.sequences.lineString[sequenceId]) {
45399                 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
45400               }
45401             });
45402             return lineStrings;
45403           }
45404           if (zoom >= lineMinZoom) {
45405             Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
45406               lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
45407             });
45408           }
45409           return lineStrings;
45410         },
45411         /**
45412          * Updates the data for the currently visible image
45413          * @param {*} image Image data
45414          */
45415         setActiveImage: function(image) {
45416           if (image && image.id && image.sequence_id) {
45417             _activeImage2 = {
45418               id: image.id,
45419               sequence_id: image.sequence_id,
45420               loc: image.loc
45421             };
45422           } else {
45423             _activeImage2 = null;
45424           }
45425         },
45426         getActiveImage: function() {
45427           return _activeImage2;
45428         },
45429         /**
45430          * Update the currently highlighted sequence and selected bubble
45431          * @param {*} context Current HTML context
45432          * @param {*} [hovered] The hovered bubble image
45433          */
45434         setStyles: function(context, hovered) {
45435           const hoveredImageId = hovered && hovered.id;
45436           const hoveredSequenceId = hovered && hovered.sequence_id;
45437           const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
45438           const selectedImageId = _activeImage2 && _activeImage2.id;
45439           const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
45440           const sequences = context.container().selectAll(".layer-panoramax .sequence");
45441           markers.classed("highlighted", function(d2) {
45442             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
45443           }).classed("hovered", function(d2) {
45444             return d2.id === hoveredImageId;
45445           }).classed("currentView", function(d2) {
45446             return d2.id === selectedImageId;
45447           });
45448           sequences.classed("highlighted", function(d2) {
45449             return d2.properties.id === hoveredSequenceId;
45450           }).classed("currentView", function(d2) {
45451             return d2.properties.id === selectedSequenceId;
45452           });
45453           context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
45454           function viewfieldPath() {
45455             let d2 = this.parentNode.__data__;
45456             if (d2.isPano && d2.id !== selectedImageId) {
45457               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
45458             } else {
45459               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
45460             }
45461           }
45462           return this;
45463         },
45464         // Get viewer status
45465         isViewerOpen: function() {
45466           return _isViewerOpen2;
45467         },
45468         /**
45469          * Updates the URL to save the current shown image
45470          * @param {*} imageKey
45471          */
45472         updateUrlImage: function(imageKey) {
45473           const hash2 = utilStringQs(window.location.hash);
45474           if (imageKey) {
45475             hash2.photo = "panoramax/" + imageKey;
45476           } else {
45477             delete hash2.photo;
45478           }
45479           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
45480         },
45481         /**
45482          * Loads the selected image in the frame
45483          * @param {*} context Current HTML context
45484          * @param {*} id of the selected image
45485          * @returns
45486          */
45487         selectImage: function(context, id2) {
45488           let that = this;
45489           let d2 = that.cachedImage(id2);
45490           that.setActiveImage(d2);
45491           that.updateUrlImage(d2.id);
45492           const viewerLink = `${viewerUrl}#pic=${d2.id}&focus=pic`;
45493           let viewer = context.container().select(".photoviewer");
45494           if (!viewer.empty()) viewer.datum(d2);
45495           this.setStyles(context, null);
45496           if (!d2) return this;
45497           let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
45498           let attribution = wrap2.selectAll(".photo-attribution").text("");
45499           let line1 = attribution.append("div").attr("class", "attribution-row");
45500           const hdDomId = utilUniqueDomId("panoramax-hd");
45501           let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
45502           label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
45503             d3_event.stopPropagation();
45504             _isHD = !_isHD;
45505             _definition = _isHD ? highDefinition : standardDefinition;
45506             that.selectImage(context, d2.id).showViewer(context);
45507           });
45508           label.append("span").call(_t.append("panoramax.hd"));
45509           if (d2.capture_time) {
45510             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
45511             attribution.append("span").text("|");
45512           }
45513           attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
45514           attribution.append("span").text("|");
45515           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
45516           this.getImageData(d2.sequence_id, d2.id).then(function(data) {
45517             _currentScene = {
45518               currentImage: null,
45519               nextImage: null,
45520               prevImage: null
45521             };
45522             _currentScene.currentImage = data.assets[_definition];
45523             const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
45524             const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
45525             if (nextIndex !== -1) {
45526               _currentScene.nextImage = data.links[nextIndex];
45527             }
45528             if (prevIndex !== -1) {
45529               _currentScene.prevImage = data.links[prevIndex];
45530             }
45531             d2.image_path = _currentScene.currentImage.href;
45532             wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
45533             wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
45534             _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
45535             _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
45536           });
45537           function localeDateString2(s2) {
45538             if (!s2) return null;
45539             var options = { day: "numeric", month: "short", year: "numeric" };
45540             var d4 = new Date(s2);
45541             if (isNaN(d4.getTime())) return null;
45542             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options);
45543           }
45544           if (d2.account_id) {
45545             attribution.append("span").text("|");
45546             let line2 = attribution.append("span").attr("class", "attribution-row");
45547             getUsername(d2.account_id).then(function(username) {
45548               line2.append("span").attr("class", "captured_by").text("@" + username);
45549             });
45550           }
45551           return this;
45552         },
45553         photoFrame: function() {
45554           return _currentFrame2;
45555         },
45556         /**
45557          * Fetches the data for a specific image
45558          * @param {*} collectionId
45559          * @param {*} imageId
45560          * @returns The fetched image data
45561          */
45562         getImageData: async function(collectionId, imageId) {
45563           const cache = _cache4.sequences.items;
45564           if (cache[collectionId]) {
45565             const cached = cache[collectionId].find((d2) => d2.id === imageId);
45566             if (cached) return cached;
45567           } else {
45568             const response = await fetch(
45569               sequenceDataUrl.replace("{collectionId}", collectionId),
45570               { method: "GET" }
45571             );
45572             if (!response.ok) {
45573               throw new Error(response.status + " " + response.statusText);
45574             }
45575             const data = (await response.json()).features;
45576             cache[collectionId] = data;
45577           }
45578           const result = cache[collectionId].find((d2) => d2.id === imageId);
45579           if (result) return result;
45580           const itemResponse = await fetch(
45581             imageDataUrl.replace("{collectionId}", collectionId).replace("{itemId}", imageId),
45582             { method: "GET" }
45583           );
45584           if (!itemResponse.ok) {
45585             throw new Error(itemResponse.status + " " + itemResponse.statusText);
45586           }
45587           const itemData = await itemResponse.json();
45588           cache[collectionId].push(itemData);
45589           return itemData;
45590         },
45591         ensureViewerLoaded: function(context) {
45592           let that = this;
45593           let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
45594           if (!imgWrap.empty()) {
45595             imgWrap.remove();
45596           }
45597           if (_loadViewerPromise6) return _loadViewerPromise6;
45598           let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
45599           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
45600           wrapEnter.append("div").attr("class", "photo-attribution fillD");
45601           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
45602           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
45603           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
45604           _loadViewerPromise6 = Promise.all([
45605             pannellum_photo_default.init(context, wrapEnter),
45606             plane_photo_default.init(context, wrapEnter)
45607           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
45608             _pannellumFrame2 = pannellumPhotoFrame;
45609             _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
45610             _planeFrame2 = planePhotoFrame;
45611             _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
45612           });
45613           function step(stepBy) {
45614             return function() {
45615               if (!_currentScene.currentImage) return;
45616               let nextId;
45617               if (stepBy === 1) nextId = _currentScene.nextImage.id;
45618               else nextId = _currentScene.prevImage.id;
45619               if (!nextId) return;
45620               const nextImage = _cache4.images.forImageId[nextId];
45621               if (nextImage) {
45622                 context.map().centerEase(nextImage.loc);
45623                 that.selectImage(context, nextImage.id);
45624               }
45625             };
45626           }
45627           return _loadViewerPromise6;
45628         },
45629         /**
45630          * Shows the current viewer if hidden
45631          * @param {*} context
45632          */
45633         showViewer: function(context) {
45634           const wrap2 = context.container().select(".photoviewer");
45635           const isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
45636           if (isHidden) {
45637             for (const service of Object.values(services)) {
45638               if (service === this) continue;
45639               if (typeof service.hideViewer === "function") {
45640                 service.hideViewer(context);
45641               }
45642             }
45643             wrap2.classed("hide", false).selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
45644           }
45645           _isViewerOpen2 = true;
45646           return this;
45647         },
45648         /**
45649          * Hides the current viewer if shown, resets the active image and sequence
45650          * @param {*} context
45651          */
45652         hideViewer: function(context) {
45653           let viewer = context.container().select(".photoviewer");
45654           if (!viewer.empty()) viewer.datum(null);
45655           this.updateUrlImage(null);
45656           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
45657           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
45658           this.setActiveImage(null);
45659           _isViewerOpen2 = false;
45660           return this.setStyles(context, null);
45661         },
45662         cache: function() {
45663           return _cache4;
45664         }
45665       };
45666     }
45667   });
45668
45669   // modules/services/index.js
45670   var services_exports = {};
45671   __export(services_exports, {
45672     serviceKartaview: () => kartaview_default,
45673     serviceKeepRight: () => keepRight_default,
45674     serviceMapRules: () => maprules_default,
45675     serviceMapilio: () => mapilio_default,
45676     serviceMapillary: () => mapillary_default,
45677     serviceNominatim: () => nominatim_default,
45678     serviceNsi: () => nsi_default,
45679     serviceOsm: () => osm_default,
45680     serviceOsmWikibase: () => osm_wikibase_default,
45681     serviceOsmose: () => osmose_default,
45682     servicePanoramax: () => panoramax_default,
45683     serviceStreetside: () => streetside_default,
45684     serviceTaginfo: () => taginfo_default,
45685     serviceVectorTile: () => vector_tile_default,
45686     serviceVegbilder: () => vegbilder_default,
45687     serviceWikidata: () => wikidata_default,
45688     serviceWikipedia: () => wikipedia_default,
45689     services: () => services
45690   });
45691   var services;
45692   var init_services = __esm({
45693     "modules/services/index.js"() {
45694       "use strict";
45695       init_keepRight();
45696       init_osmose();
45697       init_mapillary();
45698       init_maprules();
45699       init_nominatim();
45700       init_nsi();
45701       init_kartaview();
45702       init_vegbilder();
45703       init_osm2();
45704       init_osm_wikibase();
45705       init_streetside();
45706       init_taginfo();
45707       init_vector_tile2();
45708       init_wikidata();
45709       init_wikipedia();
45710       init_mapilio();
45711       init_panoramax();
45712       services = {
45713         geocoder: nominatim_default,
45714         keepRight: keepRight_default,
45715         osmose: osmose_default,
45716         mapillary: mapillary_default,
45717         nsi: nsi_default,
45718         kartaview: kartaview_default,
45719         vegbilder: vegbilder_default,
45720         osm: osm_default,
45721         osmWikibase: osm_wikibase_default,
45722         maprules: maprules_default,
45723         streetside: streetside_default,
45724         taginfo: taginfo_default,
45725         vectorTile: vector_tile_default,
45726         wikidata: wikidata_default,
45727         wikipedia: wikipedia_default,
45728         mapilio: mapilio_default,
45729         panoramax: panoramax_default
45730       };
45731     }
45732   });
45733
45734   // modules/validations/almost_junction.js
45735   var almost_junction_exports = {};
45736   __export(almost_junction_exports, {
45737     validationAlmostJunction: () => validationAlmostJunction
45738   });
45739   function validationAlmostJunction(context) {
45740     const type2 = "almost_junction";
45741     const EXTEND_TH_METERS = 5;
45742     const WELD_TH_METERS = 0.75;
45743     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
45744     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
45745     function isHighway(entity) {
45746       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
45747     }
45748     function isTaggedAsNotContinuing(node) {
45749       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
45750     }
45751     const validation = function checkAlmostJunction(entity, graph) {
45752       if (!isHighway(entity)) return [];
45753       if (entity.isDegenerate()) return [];
45754       const tree = context.history().tree();
45755       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
45756       let issues = [];
45757       extendableNodeInfos.forEach((extendableNodeInfo) => {
45758         issues.push(new validationIssue({
45759           type: type2,
45760           subtype: "highway-highway",
45761           severity: "warning",
45762           message: function(context2) {
45763             const entity1 = context2.hasEntity(this.entityIds[0]);
45764             if (this.entityIds[0] === this.entityIds[2]) {
45765               return entity1 ? _t.append("issues.almost_junction.self.message", {
45766                 feature: utilDisplayLabel(entity1, context2.graph())
45767               }) : "";
45768             } else {
45769               const entity2 = context2.hasEntity(this.entityIds[2]);
45770               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
45771                 feature: utilDisplayLabel(entity1, context2.graph()),
45772                 feature2: utilDisplayLabel(entity2, context2.graph())
45773               }) : "";
45774             }
45775           },
45776           reference: showReference,
45777           entityIds: [
45778             entity.id,
45779             extendableNodeInfo.node.id,
45780             extendableNodeInfo.wid
45781           ],
45782           loc: extendableNodeInfo.node.loc,
45783           hash: JSON.stringify(extendableNodeInfo.node.loc),
45784           data: {
45785             midId: extendableNodeInfo.mid.id,
45786             edge: extendableNodeInfo.edge,
45787             cross_loc: extendableNodeInfo.cross_loc
45788           },
45789           dynamicFixes: makeFixes
45790         }));
45791       });
45792       return issues;
45793       function makeFixes(context2) {
45794         let fixes = [new validationIssueFix({
45795           icon: "iD-icon-abutment",
45796           title: _t.append("issues.fix.connect_features.title"),
45797           onClick: function(context3) {
45798             const annotation = _t("issues.fix.connect_almost_junction.annotation");
45799             const [, endNodeId, crossWayId] = this.issue.entityIds;
45800             const midNode = context3.entity(this.issue.data.midId);
45801             const endNode = context3.entity(endNodeId);
45802             const crossWay = context3.entity(crossWayId);
45803             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
45804             if (nearEndNodes.length > 0) {
45805               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
45806               if (collinear) {
45807                 context3.perform(
45808                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
45809                   annotation
45810                 );
45811                 return;
45812               }
45813             }
45814             const targetEdge = this.issue.data.edge;
45815             const crossLoc = this.issue.data.cross_loc;
45816             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
45817             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
45818             if (closestNodeInfo.distance < WELD_TH_METERS) {
45819               context3.perform(
45820                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
45821                 annotation
45822               );
45823             } else {
45824               context3.perform(
45825                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
45826                 annotation
45827               );
45828             }
45829           }
45830         })];
45831         const node = context2.hasEntity(this.entityIds[1]);
45832         if (node && !node.hasInterestingTags()) {
45833           fixes.push(new validationIssueFix({
45834             icon: "maki-barrier",
45835             title: _t.append("issues.fix.tag_as_disconnected.title"),
45836             onClick: function(context3) {
45837               const nodeID = this.issue.entityIds[1];
45838               const tags = Object.assign({}, context3.entity(nodeID).tags);
45839               tags.noexit = "yes";
45840               context3.perform(
45841                 actionChangeTags(nodeID, tags),
45842                 _t("issues.fix.tag_as_disconnected.annotation")
45843               );
45844             }
45845           }));
45846         }
45847         return fixes;
45848       }
45849       function showReference(selection2) {
45850         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
45851       }
45852       function isExtendableCandidate(node, way) {
45853         const osm = services.osm;
45854         if (osm && !osm.isDataLoaded(node.loc)) {
45855           return false;
45856         }
45857         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
45858           return false;
45859         }
45860         let occurrences = 0;
45861         for (const index in way.nodes) {
45862           if (way.nodes[index] === node.id) {
45863             occurrences += 1;
45864             if (occurrences > 1) {
45865               return false;
45866             }
45867           }
45868         }
45869         return true;
45870       }
45871       function findConnectableEndNodesByExtension(way) {
45872         let results = [];
45873         if (way.isClosed()) return results;
45874         let testNodes;
45875         const indices = [0, way.nodes.length - 1];
45876         indices.forEach((nodeIndex) => {
45877           const nodeID = way.nodes[nodeIndex];
45878           const node = graph.entity(nodeID);
45879           if (!isExtendableCandidate(node, way)) return;
45880           const connectionInfo = canConnectByExtend(way, nodeIndex);
45881           if (!connectionInfo) return;
45882           testNodes = graph.childNodes(way).slice();
45883           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
45884           if (geoHasSelfIntersections(testNodes, nodeID)) return;
45885           results.push(connectionInfo);
45886         });
45887         return results;
45888       }
45889       function findNearbyEndNodes(node, way) {
45890         return [
45891           way.nodes[0],
45892           way.nodes[way.nodes.length - 1]
45893         ].map((d2) => graph.entity(d2)).filter((d2) => {
45894           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
45895         });
45896       }
45897       function findSmallJoinAngle(midNode, tipNode, endNodes) {
45898         let joinTo;
45899         let minAngle = Infinity;
45900         endNodes.forEach((endNode) => {
45901           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
45902           const a22 = geoAngle(midNode, endNode, context.projection) + Math.PI;
45903           const diff = Math.max(a1, a22) - Math.min(a1, a22);
45904           if (diff < minAngle) {
45905             joinTo = endNode;
45906             minAngle = diff;
45907           }
45908         });
45909         if (minAngle <= SIG_ANGLE_TH) return joinTo;
45910         return null;
45911       }
45912       function hasTag(tags, key) {
45913         return tags[key] !== void 0 && tags[key] !== "no";
45914       }
45915       function canConnectWays(way, way2) {
45916         if (way.id === way2.id) return true;
45917         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
45918         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
45919         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
45920         if (layer1 !== layer2) return false;
45921         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
45922         if (level1 !== level2) return false;
45923         return true;
45924       }
45925       function canConnectByExtend(way, endNodeIdx) {
45926         const tipNid = way.nodes[endNodeIdx];
45927         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
45928         const tipNode = graph.entity(tipNid);
45929         const midNode = graph.entity(midNid);
45930         const lon = tipNode.loc[0];
45931         const lat = tipNode.loc[1];
45932         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
45933         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
45934         const queryExtent = geoExtent([
45935           [lon - lon_range, lat - lat_range],
45936           [lon + lon_range, lat + lat_range]
45937         ]);
45938         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
45939         const t2 = EXTEND_TH_METERS / edgeLen + 1;
45940         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
45941         const segmentInfos = tree.waySegments(queryExtent, graph);
45942         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
45943           let segmentInfo = segmentInfos[i3];
45944           let way2 = graph.entity(segmentInfo.wayId);
45945           if (!isHighway(way2)) continue;
45946           if (!canConnectWays(way, way2)) continue;
45947           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
45948           if (nAid === tipNid || nBid === tipNid) continue;
45949           let nA = graph.entity(nAid), nB = graph.entity(nBid);
45950           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
45951           if (crossLoc) {
45952             return {
45953               mid: midNode,
45954               node: tipNode,
45955               wid: way2.id,
45956               edge: [nA.id, nB.id],
45957               cross_loc: crossLoc
45958             };
45959           }
45960         }
45961         return null;
45962       }
45963     };
45964     validation.type = type2;
45965     return validation;
45966   }
45967   var init_almost_junction = __esm({
45968     "modules/validations/almost_junction.js"() {
45969       "use strict";
45970       init_geo2();
45971       init_add_midpoint();
45972       init_change_tags();
45973       init_merge_nodes();
45974       init_localizer();
45975       init_utilDisplayLabel();
45976       init_tags();
45977       init_validation();
45978       init_services();
45979     }
45980   });
45981
45982   // modules/validations/close_nodes.js
45983   var close_nodes_exports = {};
45984   __export(close_nodes_exports, {
45985     validationCloseNodes: () => validationCloseNodes
45986   });
45987   function validationCloseNodes(context) {
45988     var type2 = "close_nodes";
45989     var pointThresholdMeters = 0.2;
45990     var validation = function(entity, graph) {
45991       if (entity.type === "node") {
45992         return getIssuesForNode(entity);
45993       } else if (entity.type === "way") {
45994         return getIssuesForWay(entity);
45995       }
45996       return [];
45997       function getIssuesForNode(node) {
45998         var parentWays = graph.parentWays(node);
45999         if (parentWays.length) {
46000           return getIssuesForVertex(node, parentWays);
46001         } else {
46002           return getIssuesForDetachedPoint(node);
46003         }
46004       }
46005       function wayTypeFor(way) {
46006         if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
46007         if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
46008         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
46009         if (osmPathHighwayTagValues[way.tags.highway]) return "path";
46010         var parentRelations = graph.parentRelations(way);
46011         for (var i3 in parentRelations) {
46012           var relation = parentRelations[i3];
46013           if (relation.tags.type === "boundary") return "boundary";
46014           if (relation.isMultipolygon()) {
46015             if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
46016             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
46017           }
46018         }
46019         return "other";
46020       }
46021       function shouldCheckWay(way) {
46022         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
46023         var bbox2 = way.extent(graph).bbox();
46024         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
46025         if (hypotenuseMeters < 1.5) return false;
46026         return true;
46027       }
46028       function getIssuesForWay(way) {
46029         if (!shouldCheckWay(way)) return [];
46030         var issues = [], nodes = graph.childNodes(way);
46031         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
46032           var node1 = nodes[i3];
46033           var node2 = nodes[i3 + 1];
46034           var issue = getWayIssueIfAny(node1, node2, way);
46035           if (issue) issues.push(issue);
46036         }
46037         return issues;
46038       }
46039       function getIssuesForVertex(node, parentWays) {
46040         var issues = [];
46041         function checkForCloseness(node1, node2, way) {
46042           var issue = getWayIssueIfAny(node1, node2, way);
46043           if (issue) issues.push(issue);
46044         }
46045         for (var i3 = 0; i3 < parentWays.length; i3++) {
46046           var parentWay = parentWays[i3];
46047           if (!shouldCheckWay(parentWay)) continue;
46048           var lastIndex = parentWay.nodes.length - 1;
46049           for (var j3 = 0; j3 < parentWay.nodes.length; j3++) {
46050             if (j3 !== 0) {
46051               if (parentWay.nodes[j3 - 1] === node.id) {
46052                 checkForCloseness(node, graph.entity(parentWay.nodes[j3]), parentWay);
46053               }
46054             }
46055             if (j3 !== lastIndex) {
46056               if (parentWay.nodes[j3 + 1] === node.id) {
46057                 checkForCloseness(graph.entity(parentWay.nodes[j3]), node, parentWay);
46058               }
46059             }
46060           }
46061         }
46062         return issues;
46063       }
46064       function thresholdMetersForWay(way) {
46065         if (!shouldCheckWay(way)) return 0;
46066         var wayType = wayTypeFor(way);
46067         if (wayType === "boundary") return 0;
46068         if (wayType === "indoor") return 0.01;
46069         if (wayType === "building") return 0.05;
46070         if (wayType === "path") return 0.1;
46071         return 0.2;
46072       }
46073       function getIssuesForDetachedPoint(node) {
46074         var issues = [];
46075         var lon = node.loc[0];
46076         var lat = node.loc[1];
46077         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
46078         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
46079         var queryExtent = geoExtent([
46080           [lon - lon_range, lat - lat_range],
46081           [lon + lon_range, lat + lat_range]
46082         ]);
46083         var intersected = context.history().tree().intersects(queryExtent, graph);
46084         for (var j3 = 0; j3 < intersected.length; j3++) {
46085           var nearby = intersected[j3];
46086           if (nearby.id === node.id) continue;
46087           if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
46088           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
46089             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
46090             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
46091             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
46092             var zAxisDifferentiates = false;
46093             for (var key in zAxisKeys) {
46094               var nodeValue = node.tags[key] || "0";
46095               var nearbyValue = nearby.tags[key] || "0";
46096               if (nodeValue !== nearbyValue) {
46097                 zAxisDifferentiates = true;
46098                 break;
46099               }
46100             }
46101             if (zAxisDifferentiates) continue;
46102             issues.push(new validationIssue({
46103               type: type2,
46104               subtype: "detached",
46105               severity: "warning",
46106               message: function(context2) {
46107                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
46108                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
46109                   feature: utilDisplayLabel(entity2, context2.graph()),
46110                   feature2: utilDisplayLabel(entity22, context2.graph())
46111                 }) : "";
46112               },
46113               reference: showReference,
46114               entityIds: [node.id, nearby.id],
46115               dynamicFixes: function() {
46116                 return [
46117                   new validationIssueFix({
46118                     icon: "iD-operation-disconnect",
46119                     title: _t.append("issues.fix.move_points_apart.title")
46120                   }),
46121                   new validationIssueFix({
46122                     icon: "iD-icon-layers",
46123                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
46124                   })
46125                 ];
46126               }
46127             }));
46128           }
46129         }
46130         return issues;
46131         function showReference(selection2) {
46132           var referenceText = _t("issues.close_nodes.detached.reference");
46133           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
46134         }
46135       }
46136       function getWayIssueIfAny(node1, node2, way) {
46137         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
46138           return null;
46139         }
46140         if (node1.loc !== node2.loc) {
46141           var parentWays1 = graph.parentWays(node1);
46142           var parentWays2 = new Set(graph.parentWays(node2));
46143           var sharedWays = parentWays1.filter(function(parentWay) {
46144             return parentWays2.has(parentWay);
46145           });
46146           var thresholds = sharedWays.map(function(parentWay) {
46147             return thresholdMetersForWay(parentWay);
46148           });
46149           var threshold = Math.min(...thresholds);
46150           var distance = geoSphericalDistance(node1.loc, node2.loc);
46151           if (distance > threshold) return null;
46152         }
46153         return new validationIssue({
46154           type: type2,
46155           subtype: "vertices",
46156           severity: "warning",
46157           message: function(context2) {
46158             var entity2 = context2.hasEntity(this.entityIds[0]);
46159             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
46160           },
46161           reference: showReference,
46162           entityIds: [way.id, node1.id, node2.id],
46163           loc: node1.loc,
46164           dynamicFixes: function() {
46165             return [
46166               new validationIssueFix({
46167                 icon: "iD-icon-plus",
46168                 title: _t.append("issues.fix.merge_points.title"),
46169                 onClick: function(context2) {
46170                   var entityIds = this.issue.entityIds;
46171                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
46172                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
46173                 }
46174               }),
46175               new validationIssueFix({
46176                 icon: "iD-operation-disconnect",
46177                 title: _t.append("issues.fix.move_points_apart.title")
46178               })
46179             ];
46180           }
46181         });
46182         function showReference(selection2) {
46183           var referenceText = _t("issues.close_nodes.reference");
46184           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
46185         }
46186       }
46187     };
46188     validation.type = type2;
46189     return validation;
46190   }
46191   var init_close_nodes = __esm({
46192     "modules/validations/close_nodes.js"() {
46193       "use strict";
46194       init_merge_nodes();
46195       init_utilDisplayLabel();
46196       init_localizer();
46197       init_validation();
46198       init_tags();
46199       init_geo();
46200       init_extent();
46201     }
46202   });
46203
46204   // modules/validations/crossing_ways.js
46205   var crossing_ways_exports = {};
46206   __export(crossing_ways_exports, {
46207     validationCrossingWays: () => validationCrossingWays
46208   });
46209   function validationCrossingWays(context) {
46210     var type2 = "crossing_ways";
46211     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
46212       if (getFeatureType(way, graph) === null) {
46213         var parentRels = graph.parentRelations(way);
46214         for (var i3 = 0; i3 < parentRels.length; i3++) {
46215           var rel = parentRels[i3];
46216           if (getFeatureType(rel, graph) !== null) {
46217             return rel;
46218           }
46219         }
46220       }
46221       return way;
46222     }
46223     function hasTag(tags, key) {
46224       return tags[key] !== void 0 && tags[key] !== "no";
46225     }
46226     function taggedAsIndoor(tags) {
46227       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
46228     }
46229     function allowsBridge(featureType) {
46230       return featureType === "highway" || featureType === "railway" || featureType === "waterway" || featureType === "aeroway";
46231     }
46232     function allowsTunnel(featureType) {
46233       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
46234     }
46235     var ignoredBuildings = {
46236       demolished: true,
46237       dismantled: true,
46238       proposed: true,
46239       razed: true
46240     };
46241     function getFeatureType(entity, graph) {
46242       var geometry = entity.geometry(graph);
46243       if (geometry !== "line" && geometry !== "area") return null;
46244       var tags = entity.tags;
46245       if (tags.aeroway in osmRoutableAerowayTags) return "aeroway";
46246       if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
46247       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
46248       if (geometry !== "line") return null;
46249       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
46250       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
46251       return null;
46252     }
46253     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
46254       var level1 = tags1.level || "0";
46255       var level2 = tags2.level || "0";
46256       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
46257         return true;
46258       }
46259       var layer1 = tags1.layer || "0";
46260       var layer2 = tags2.layer || "0";
46261       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
46262         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
46263         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
46264         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
46265       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
46266       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
46267       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
46268         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
46269         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
46270         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
46271       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
46272       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
46273       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
46274       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
46275       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
46276         if (layer1 !== layer2) return true;
46277       }
46278       return false;
46279     }
46280     var highwaysDisallowingFords = {
46281       motorway: true,
46282       motorway_link: true,
46283       trunk: true,
46284       trunk_link: true,
46285       primary: true,
46286       primary_link: true,
46287       secondary: true,
46288       secondary_link: true
46289     };
46290     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
46291       var featureType1 = getFeatureType(entity1, graph);
46292       var featureType2 = getFeatureType(entity2, graph);
46293       var geometry1 = entity1.geometry(graph);
46294       var geometry2 = entity2.geometry(graph);
46295       var bothLines = geometry1 === "line" && geometry2 === "line";
46296       const featureTypes = [featureType1, featureType2].sort().join("-");
46297       if (featureTypes === "aeroway-aeroway") return {};
46298       if (featureTypes === "aeroway-highway") {
46299         const isServiceRoad = entity1.tags.highway === "service" || entity2.tags.highway === "service";
46300         const isPath = entity1.tags.highway in osmPathHighwayTagValues || entity2.tags.highway in osmPathHighwayTagValues;
46301         return isServiceRoad || isPath ? {} : { aeroway: "aircraft_crossing" };
46302       }
46303       if (featureTypes === "aeroway-railway") {
46304         return { aeroway: "aircraft_crossing", railway: "level_crossing" };
46305       }
46306       if (featureTypes === "aeroway-waterway") return null;
46307       if (featureType1 === featureType2) {
46308         if (featureType1 === "highway") {
46309           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
46310           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
46311           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
46312             if (!bothLines) return {};
46313             var roadFeature = entity1IsPath ? entity2 : entity1;
46314             var pathFeature = entity1IsPath ? entity1 : entity2;
46315             if (roadFeature.tags.highway === "track") {
46316               return {};
46317             }
46318             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
46319               return {};
46320             }
46321             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
46322               var tags = { highway: "crossing", crossing: pathFeature.tags.crossing };
46323               if ("crossing:markings" in pathFeature.tags) {
46324                 tags["crossing:markings"] = pathFeature.tags["crossing:markings"];
46325               }
46326               return tags;
46327             }
46328             return { highway: "crossing" };
46329           }
46330           return {};
46331         }
46332         if (featureType1 === "waterway") return {};
46333         if (featureType1 === "railway") return {};
46334       } else {
46335         if (featureTypes.indexOf("highway") !== -1) {
46336           if (featureTypes.indexOf("railway") !== -1) {
46337             if (!bothLines) return {};
46338             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
46339             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
46340               if (isTram) return { railway: "tram_crossing" };
46341               return { railway: "crossing" };
46342             } else {
46343               if (isTram) return { railway: "tram_level_crossing" };
46344               return { railway: "level_crossing" };
46345             }
46346           }
46347           if (featureTypes.indexOf("waterway") !== -1) {
46348             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
46349             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
46350             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
46351               return null;
46352             }
46353             return bothLines ? { ford: "yes" } : {};
46354           }
46355         }
46356       }
46357       return null;
46358     }
46359     function findCrossingsByWay(way1, graph, tree) {
46360       var edgeCrossInfos = [];
46361       if (way1.type !== "way") return edgeCrossInfos;
46362       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
46363       var way1FeatureType = getFeatureType(taggedFeature1, graph);
46364       if (way1FeatureType === null) return edgeCrossInfos;
46365       var checkedSingleCrossingWays = {};
46366       var i3, j3;
46367       var extent;
46368       var n1, n22, nA, nB, nAId, nBId;
46369       var segment1, segment2;
46370       var oneOnly;
46371       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
46372       var way1Nodes = graph.childNodes(way1);
46373       var comparedWays = {};
46374       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
46375         n1 = way1Nodes[i3];
46376         n22 = way1Nodes[i3 + 1];
46377         extent = geoExtent([
46378           [
46379             Math.min(n1.loc[0], n22.loc[0]),
46380             Math.min(n1.loc[1], n22.loc[1])
46381           ],
46382           [
46383             Math.max(n1.loc[0], n22.loc[0]),
46384             Math.max(n1.loc[1], n22.loc[1])
46385           ]
46386         ]);
46387         segmentInfos = tree.waySegments(extent, graph);
46388         for (j3 = 0; j3 < segmentInfos.length; j3++) {
46389           segment2Info = segmentInfos[j3];
46390           if (segment2Info.wayId === way1.id) continue;
46391           if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
46392           comparedWays[segment2Info.wayId] = true;
46393           way2 = graph.hasEntity(segment2Info.wayId);
46394           if (!way2) continue;
46395           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
46396           way2FeatureType = getFeatureType(taggedFeature2, graph);
46397           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
46398             continue;
46399           }
46400           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
46401           nAId = segment2Info.nodes[0];
46402           nBId = segment2Info.nodes[1];
46403           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
46404             continue;
46405           }
46406           nA = graph.hasEntity(nAId);
46407           if (!nA) continue;
46408           nB = graph.hasEntity(nBId);
46409           if (!nB) continue;
46410           segment1 = [n1.loc, n22.loc];
46411           segment2 = [nA.loc, nB.loc];
46412           var point = geoLineIntersection(segment1, segment2);
46413           if (point) {
46414             edgeCrossInfos.push({
46415               wayInfos: [
46416                 {
46417                   way: way1,
46418                   featureType: way1FeatureType,
46419                   edge: [n1.id, n22.id]
46420                 },
46421                 {
46422                   way: way2,
46423                   featureType: way2FeatureType,
46424                   edge: [nA.id, nB.id]
46425                 }
46426               ],
46427               crossPoint: point
46428             });
46429             if (oneOnly) {
46430               checkedSingleCrossingWays[way2.id] = true;
46431               break;
46432             }
46433           }
46434         }
46435       }
46436       return edgeCrossInfos;
46437     }
46438     function waysToCheck(entity, graph) {
46439       var featureType = getFeatureType(entity, graph);
46440       if (!featureType) return [];
46441       if (entity.type === "way") {
46442         return [entity];
46443       } else if (entity.type === "relation") {
46444         return entity.members.reduce(function(array2, member) {
46445           if (member.type === "way" && // only look at geometry ways
46446           (!member.role || member.role === "outer" || member.role === "inner")) {
46447             var entity2 = graph.hasEntity(member.id);
46448             if (entity2 && array2.indexOf(entity2) === -1) {
46449               array2.push(entity2);
46450             }
46451           }
46452           return array2;
46453         }, []);
46454       }
46455       return [];
46456     }
46457     var validation = function checkCrossingWays(entity, graph) {
46458       var tree = context.history().tree();
46459       var ways = waysToCheck(entity, graph);
46460       var issues = [];
46461       var wayIndex, crossingIndex, crossings;
46462       for (wayIndex in ways) {
46463         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
46464         for (crossingIndex in crossings) {
46465           issues.push(createIssue(crossings[crossingIndex], graph));
46466         }
46467       }
46468       return issues;
46469     };
46470     function createIssue(crossing, graph) {
46471       crossing.wayInfos.sort(function(way1Info, way2Info) {
46472         var type1 = way1Info.featureType;
46473         var type22 = way2Info.featureType;
46474         if (type1 === type22) {
46475           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
46476         } else if (type1 === "waterway") {
46477           return true;
46478         } else if (type22 === "waterway") {
46479           return false;
46480         }
46481         return type1 < type22;
46482       });
46483       var entities = crossing.wayInfos.map(function(wayInfo) {
46484         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
46485       });
46486       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
46487       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
46488       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
46489       var featureType1 = crossing.wayInfos[0].featureType;
46490       var featureType2 = crossing.wayInfos[1].featureType;
46491       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
46492       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
46493       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
46494       var subtype = [featureType1, featureType2].sort().join("-");
46495       var crossingTypeID = subtype;
46496       if (isCrossingIndoors) {
46497         crossingTypeID = "indoor-indoor";
46498       } else if (isCrossingTunnels) {
46499         crossingTypeID = "tunnel-tunnel";
46500       } else if (isCrossingBridges) {
46501         crossingTypeID = "bridge-bridge";
46502       }
46503       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
46504         crossingTypeID += "_connectable";
46505       }
46506       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
46507       return new validationIssue({
46508         type: type2,
46509         subtype,
46510         severity: "warning",
46511         message: function(context2) {
46512           var graph2 = context2.graph();
46513           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
46514           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
46515             feature: utilDisplayLabel(entity1, graph2, featureType1 === "building"),
46516             feature2: utilDisplayLabel(entity2, graph2, featureType2 === "building")
46517           }) : "";
46518         },
46519         reference: showReference,
46520         entityIds: entities.map(function(entity) {
46521           return entity.id;
46522         }),
46523         data: {
46524           edges,
46525           featureTypes,
46526           connectionTags
46527         },
46528         hash: uniqueID,
46529         loc: crossing.crossPoint,
46530         dynamicFixes: function(context2) {
46531           var mode = context2.mode();
46532           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
46533           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
46534           var selectedFeatureType = this.data.featureTypes[selectedIndex];
46535           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
46536           var fixes = [];
46537           if (connectionTags) {
46538             fixes.push(makeConnectWaysFix(this.data.connectionTags));
46539             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
46540             if (lessLikelyConnectionTags && !isEqual_default(connectionTags, lessLikelyConnectionTags)) {
46541               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
46542             }
46543           }
46544           if (isCrossingIndoors) {
46545             fixes.push(new validationIssueFix({
46546               icon: "iD-icon-layers",
46547               title: _t.append("issues.fix.use_different_levels.title")
46548             }));
46549           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
46550             fixes.push(makeChangeLayerFix("higher"));
46551             fixes.push(makeChangeLayerFix("lower"));
46552           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
46553             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
46554               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
46555             }
46556             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
46557             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
46558               if (selectedFeatureType === "waterway") {
46559                 fixes.push(makeAddBridgeOrTunnelFix("add_a_culvert", "temaki-waste", "tunnel"));
46560               } else {
46561                 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
46562               }
46563             }
46564           }
46565           fixes.push(new validationIssueFix({
46566             icon: "iD-operation-move",
46567             title: _t.append("issues.fix.reposition_features.title")
46568           }));
46569           return fixes;
46570         }
46571       });
46572       function showReference(selection2) {
46573         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
46574       }
46575     }
46576     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
46577       return new validationIssueFix({
46578         icon: iconName,
46579         title: _t.append("issues.fix." + fixTitleID + ".title"),
46580         onClick: function(context2) {
46581           var mode = context2.mode();
46582           if (!mode || mode.id !== "select") return;
46583           var selectedIDs = mode.selectedIDs();
46584           if (selectedIDs.length !== 1) return;
46585           var selectedWayID = selectedIDs[0];
46586           if (!context2.hasEntity(selectedWayID)) return;
46587           var resultWayIDs = [selectedWayID];
46588           var edge, crossedEdge, crossedWayID;
46589           if (this.issue.entityIds[0] === selectedWayID) {
46590             edge = this.issue.data.edges[0];
46591             crossedEdge = this.issue.data.edges[1];
46592             crossedWayID = this.issue.entityIds[1];
46593           } else {
46594             edge = this.issue.data.edges[1];
46595             crossedEdge = this.issue.data.edges[0];
46596             crossedWayID = this.issue.entityIds[0];
46597           }
46598           var crossingLoc = this.issue.loc;
46599           var projection2 = context2.projection;
46600           var action = function actionAddStructure(graph) {
46601             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
46602             var crossedWay = graph.hasEntity(crossedWayID);
46603             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
46604             if (!structLengthMeters) {
46605               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
46606             }
46607             if (structLengthMeters) {
46608               if (getFeatureType(crossedWay, graph) === "railway") {
46609                 structLengthMeters *= 2;
46610               }
46611             } else {
46612               structLengthMeters = 8;
46613             }
46614             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
46615             var a22 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
46616             var crossingAngle = Math.max(a1, a22) - Math.min(a1, a22);
46617             if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
46618             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
46619             structLengthMeters += 4;
46620             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
46621             function geomToProj(geoPoint) {
46622               return [
46623                 geoLonToMeters(geoPoint[0], geoPoint[1]),
46624                 geoLatToMeters(geoPoint[1])
46625               ];
46626             }
46627             function projToGeom(projPoint) {
46628               var lat = geoMetersToLat(projPoint[1]);
46629               return [
46630                 geoMetersToLon(projPoint[0], lat),
46631                 lat
46632               ];
46633             }
46634             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
46635             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
46636             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
46637             var projectedCrossingLoc = geomToProj(crossingLoc);
46638             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
46639             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
46640               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
46641               return projToGeom([
46642                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
46643                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
46644               ]);
46645             }
46646             var endpointLocGetter1 = function(lengthMeters) {
46647               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
46648             };
46649             var endpointLocGetter2 = function(lengthMeters) {
46650               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
46651             };
46652             var minEdgeLengthMeters = 0.55;
46653             function determineEndpoint(edge2, endNode, locGetter) {
46654               var newNode;
46655               var idealLengthMeters = structLengthMeters / 2;
46656               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
46657               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
46658                 var idealNodeLoc = locGetter(idealLengthMeters);
46659                 newNode = osmNode();
46660                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
46661               } else {
46662                 var edgeCount = 0;
46663                 endNode.parentIntersectionWays(graph).forEach(function(way) {
46664                   way.nodes.forEach(function(nodeID) {
46665                     if (nodeID === endNode.id) {
46666                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
46667                         edgeCount += 1;
46668                       } else {
46669                         edgeCount += 2;
46670                       }
46671                     }
46672                   });
46673                 });
46674                 if (edgeCount >= 3) {
46675                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
46676                   if (insetLength > minEdgeLengthMeters) {
46677                     var insetNodeLoc = locGetter(insetLength);
46678                     newNode = osmNode();
46679                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
46680                   }
46681                 }
46682               }
46683               if (!newNode) newNode = endNode;
46684               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
46685               graph = splitAction(graph);
46686               if (splitAction.getCreatedWayIDs().length) {
46687                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
46688               }
46689               return newNode;
46690             }
46691             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
46692             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
46693             var structureWay = resultWayIDs.map(function(id2) {
46694               return graph.entity(id2);
46695             }).find(function(way) {
46696               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
46697             });
46698             var tags = Object.assign({}, structureWay.tags);
46699             if (bridgeOrTunnel === "bridge") {
46700               tags.bridge = "yes";
46701               tags.layer = "1";
46702             } else {
46703               var tunnelValue = "yes";
46704               if (getFeatureType(structureWay, graph) === "waterway") {
46705                 tunnelValue = "culvert";
46706               }
46707               tags.tunnel = tunnelValue;
46708               tags.layer = "-1";
46709             }
46710             graph = actionChangeTags(structureWay.id, tags)(graph);
46711             return graph;
46712           };
46713           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
46714           context2.enter(modeSelect(context2, resultWayIDs));
46715         }
46716       });
46717     }
46718     function makeConnectWaysFix(connectionTags) {
46719       var fixTitleID = "connect_features";
46720       var fixIcon = "iD-icon-crossing";
46721       if (connectionTags.highway === "crossing") {
46722         fixTitleID = "connect_using_crossing";
46723         fixIcon = "temaki-pedestrian";
46724       }
46725       if (connectionTags.ford) {
46726         fixTitleID = "connect_using_ford";
46727         fixIcon = "roentgen-ford";
46728       }
46729       const fix = new validationIssueFix({
46730         icon: fixIcon,
46731         title: _t.append("issues.fix." + fixTitleID + ".title"),
46732         onClick: function(context2) {
46733           var loc = this.issue.loc;
46734           var edges = this.issue.data.edges;
46735           context2.perform(
46736             function actionConnectCrossingWays(graph) {
46737               var node = osmNode({ loc, tags: connectionTags });
46738               graph = graph.replace(node);
46739               var nodesToMerge = [node.id];
46740               var mergeThresholdInMeters = 0.75;
46741               edges.forEach(function(edge) {
46742                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
46743                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
46744                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
46745                   nodesToMerge.push(nearby.node.id);
46746                 } else {
46747                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
46748                 }
46749               });
46750               if (nodesToMerge.length > 1) {
46751                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
46752               }
46753               return graph;
46754             },
46755             _t("issues.fix.connect_crossing_features.annotation")
46756           );
46757         }
46758       });
46759       fix._connectionTags = connectionTags;
46760       return fix;
46761     }
46762     function makeChangeLayerFix(higherOrLower) {
46763       return new validationIssueFix({
46764         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
46765         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
46766         onClick: function(context2) {
46767           var mode = context2.mode();
46768           if (!mode || mode.id !== "select") return;
46769           var selectedIDs = mode.selectedIDs();
46770           if (selectedIDs.length !== 1) return;
46771           var selectedID = selectedIDs[0];
46772           if (!this.issue.entityIds.some(function(entityId) {
46773             return entityId === selectedID;
46774           })) return;
46775           var entity = context2.hasEntity(selectedID);
46776           if (!entity) return;
46777           var tags = Object.assign({}, entity.tags);
46778           var layer = tags.layer && Number(tags.layer);
46779           if (layer && !isNaN(layer)) {
46780             if (higherOrLower === "higher") {
46781               layer += 1;
46782             } else {
46783               layer -= 1;
46784             }
46785           } else {
46786             if (higherOrLower === "higher") {
46787               layer = 1;
46788             } else {
46789               layer = -1;
46790             }
46791           }
46792           tags.layer = layer.toString();
46793           context2.perform(
46794             actionChangeTags(entity.id, tags),
46795             _t("operations.change_tags.annotation")
46796           );
46797         }
46798       });
46799     }
46800     validation.type = type2;
46801     return validation;
46802   }
46803   var init_crossing_ways = __esm({
46804     "modules/validations/crossing_ways.js"() {
46805       "use strict";
46806       init_lodash();
46807       init_add_midpoint();
46808       init_change_tags();
46809       init_merge_nodes();
46810       init_split();
46811       init_select5();
46812       init_geo2();
46813       init_node2();
46814       init_tags();
46815       init_localizer();
46816       init_utilDisplayLabel();
46817       init_validation();
46818     }
46819   });
46820
46821   // modules/behavior/draw_way.js
46822   var draw_way_exports = {};
46823   __export(draw_way_exports, {
46824     behaviorDrawWay: () => behaviorDrawWay
46825   });
46826   function behaviorDrawWay(context, wayID, mode, startGraph) {
46827     const keybinding = utilKeybinding("drawWay");
46828     var dispatch14 = dispatch_default("rejectedSelfIntersection");
46829     var behavior = behaviorDraw(context);
46830     var _nodeIndex;
46831     var _origWay;
46832     var _wayGeometry;
46833     var _headNodeID;
46834     var _annotation;
46835     var _pointerHasMoved = false;
46836     var _drawNode;
46837     var _didResolveTempEdit = false;
46838     function createDrawNode(loc) {
46839       _drawNode = osmNode({ loc });
46840       context.pauseChangeDispatch();
46841       context.replace(function actionAddDrawNode(graph) {
46842         var way = graph.entity(wayID);
46843         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
46844       }, _annotation);
46845       context.resumeChangeDispatch();
46846       setActiveElements();
46847     }
46848     function removeDrawNode() {
46849       context.pauseChangeDispatch();
46850       context.replace(
46851         function actionDeleteDrawNode(graph) {
46852           var way = graph.entity(wayID);
46853           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
46854         },
46855         _annotation
46856       );
46857       _drawNode = void 0;
46858       context.resumeChangeDispatch();
46859     }
46860     function keydown(d3_event) {
46861       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
46862         if (context.surface().classed("nope")) {
46863           context.surface().classed("nope-suppressed", true);
46864         }
46865         context.surface().classed("nope", false).classed("nope-disabled", true);
46866       }
46867     }
46868     function keyup(d3_event) {
46869       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
46870         if (context.surface().classed("nope-suppressed")) {
46871           context.surface().classed("nope", true);
46872         }
46873         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
46874       }
46875     }
46876     function allowsVertex(d2) {
46877       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
46878     }
46879     function move(d3_event, datum2) {
46880       var loc = context.map().mouseCoordinates();
46881       if (!_drawNode) createDrawNode(loc);
46882       context.surface().classed("nope-disabled", d3_event.altKey);
46883       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
46884       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
46885       if (targetLoc) {
46886         loc = targetLoc;
46887       } else if (targetNodes) {
46888         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
46889         if (choice) {
46890           loc = choice.loc;
46891         }
46892       }
46893       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
46894       _drawNode = context.entity(_drawNode.id);
46895       checkGeometry(
46896         true
46897         /* includeDrawNode */
46898       );
46899     }
46900     function checkGeometry(includeDrawNode) {
46901       var nopeDisabled = context.surface().classed("nope-disabled");
46902       var isInvalid = isInvalidGeometry(includeDrawNode);
46903       if (nopeDisabled) {
46904         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
46905       } else {
46906         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
46907       }
46908     }
46909     function isInvalidGeometry(includeDrawNode) {
46910       var testNode = _drawNode;
46911       var parentWay = context.graph().entity(wayID);
46912       var nodes = context.graph().childNodes(parentWay).slice();
46913       if (includeDrawNode) {
46914         if (parentWay.isClosed()) {
46915           nodes.pop();
46916         }
46917       } else {
46918         if (parentWay.isClosed()) {
46919           if (nodes.length < 3) return false;
46920           if (_drawNode) nodes.splice(-2, 1);
46921           testNode = nodes[nodes.length - 2];
46922         } else {
46923           return false;
46924         }
46925       }
46926       return testNode && geoHasSelfIntersections(nodes, testNode.id);
46927     }
46928     function undone() {
46929       _didResolveTempEdit = true;
46930       context.pauseChangeDispatch();
46931       var nextMode;
46932       if (context.graph() === startGraph) {
46933         nextMode = modeSelect(context, [wayID]);
46934       } else {
46935         context.pop(1);
46936         nextMode = mode;
46937       }
46938       context.perform(actionNoop());
46939       context.pop(1);
46940       context.resumeChangeDispatch();
46941       context.enter(nextMode);
46942     }
46943     function setActiveElements() {
46944       if (!_drawNode) return;
46945       context.surface().selectAll("." + _drawNode.id).classed("active", true);
46946     }
46947     function resetToStartGraph() {
46948       while (context.graph() !== startGraph) {
46949         context.pop();
46950       }
46951     }
46952     var drawWay = function(surface) {
46953       _drawNode = void 0;
46954       _didResolveTempEdit = false;
46955       _origWay = context.entity(wayID);
46956       if (typeof _nodeIndex === "number") {
46957         _headNodeID = _origWay.nodes[_nodeIndex];
46958       } else if (_origWay.isClosed()) {
46959         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
46960       } else {
46961         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
46962       }
46963       _wayGeometry = _origWay.geometry(context.graph());
46964       _annotation = _t(
46965         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
46966       );
46967       _pointerHasMoved = false;
46968       context.pauseChangeDispatch();
46969       context.perform(actionNoop(), _annotation);
46970       context.resumeChangeDispatch();
46971       behavior.hover().initialNodeID(_headNodeID);
46972       behavior.on("move", function() {
46973         _pointerHasMoved = true;
46974         move.apply(this, arguments);
46975       }).on("down", function() {
46976         move.apply(this, arguments);
46977       }).on("downcancel", function() {
46978         if (_drawNode) removeDrawNode();
46979       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
46980       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
46981       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
46982       setActiveElements();
46983       surface.call(behavior);
46984       context.history().on("undone.draw", undone);
46985     };
46986     drawWay.off = function(surface) {
46987       if (!_didResolveTempEdit) {
46988         context.pauseChangeDispatch();
46989         resetToStartGraph();
46990         context.resumeChangeDispatch();
46991       }
46992       _drawNode = void 0;
46993       _nodeIndex = void 0;
46994       context.map().on("drawn.draw", null);
46995       surface.call(behavior.off).selectAll(".active").classed("active", false);
46996       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
46997       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
46998       context.history().on("undone.draw", null);
46999     };
47000     function attemptAdd(d2, loc, doAdd) {
47001       if (_drawNode) {
47002         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
47003         _drawNode = context.entity(_drawNode.id);
47004       } else {
47005         createDrawNode(loc);
47006       }
47007       checkGeometry(
47008         true
47009         /* includeDrawNode */
47010       );
47011       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
47012         if (!_pointerHasMoved) {
47013           removeDrawNode();
47014         }
47015         dispatch14.call("rejectedSelfIntersection", this);
47016         return;
47017       }
47018       context.pauseChangeDispatch();
47019       doAdd();
47020       _didResolveTempEdit = true;
47021       context.resumeChangeDispatch();
47022       context.enter(mode);
47023     }
47024     drawWay.add = function(loc, d2) {
47025       attemptAdd(d2, loc, function() {
47026       });
47027     };
47028     drawWay.addWay = function(loc, edge, d2) {
47029       attemptAdd(d2, loc, function() {
47030         context.replace(
47031           actionAddMidpoint({ loc, edge }, _drawNode),
47032           _annotation
47033         );
47034       });
47035     };
47036     drawWay.addNode = function(node, d2) {
47037       if (node.id === _headNodeID || // or the first node when drawing an area
47038       _origWay.isClosed() && node.id === _origWay.first()) {
47039         drawWay.finish();
47040         return;
47041       }
47042       attemptAdd(d2, node.loc, function() {
47043         context.replace(
47044           function actionReplaceDrawNode(graph) {
47045             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
47046             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
47047           },
47048           _annotation
47049         );
47050       });
47051     };
47052     function getFeatureType(ways) {
47053       if (ways.every((way) => way.isClosed())) return "area";
47054       if (ways.every((way) => !way.isClosed())) return "line";
47055       return "generic";
47056     }
47057     function followMode() {
47058       if (_didResolveTempEdit) return;
47059       try {
47060         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
47061         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
47062         const historyGraph = context.history().graph();
47063         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
47064           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
47065           return;
47066         }
47067         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w3) => w3.id !== wayID);
47068         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w3) => w3.id !== wayID);
47069         const featureType = getFeatureType(lastNodesParents);
47070         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
47071           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
47072           return;
47073         }
47074         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
47075           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
47076           return;
47077         }
47078         const way = lastNodesParents[0];
47079         const indexOfLast = way.nodes.indexOf(lastNodeId);
47080         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
47081         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
47082         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
47083         if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
47084         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
47085         drawWay.addNode(nextNode, {
47086           geometry: { type: "Point", coordinates: nextNode.loc },
47087           id: nextNode.id,
47088           properties: { target: true, entity: nextNode }
47089         });
47090       } catch {
47091         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
47092       }
47093     }
47094     keybinding.on(_t("operations.follow.key"), followMode);
47095     select_default2(document).call(keybinding);
47096     drawWay.finish = function() {
47097       checkGeometry(
47098         false
47099         /* includeDrawNode */
47100       );
47101       if (context.surface().classed("nope")) {
47102         dispatch14.call("rejectedSelfIntersection", this);
47103         return;
47104       }
47105       context.pauseChangeDispatch();
47106       context.pop(1);
47107       _didResolveTempEdit = true;
47108       context.resumeChangeDispatch();
47109       var way = context.hasEntity(wayID);
47110       if (!way || way.isDegenerate()) {
47111         drawWay.cancel();
47112         return;
47113       }
47114       window.setTimeout(function() {
47115         context.map().dblclickZoomEnable(true);
47116       }, 1e3);
47117       var isNewFeature = !mode.isContinuing;
47118       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
47119     };
47120     drawWay.cancel = function() {
47121       context.pauseChangeDispatch();
47122       resetToStartGraph();
47123       context.resumeChangeDispatch();
47124       window.setTimeout(function() {
47125         context.map().dblclickZoomEnable(true);
47126       }, 1e3);
47127       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
47128       context.enter(modeBrowse(context));
47129     };
47130     drawWay.nodeIndex = function(val) {
47131       if (!arguments.length) return _nodeIndex;
47132       _nodeIndex = val;
47133       return drawWay;
47134     };
47135     drawWay.activeID = function() {
47136       if (!arguments.length) return _drawNode && _drawNode.id;
47137       return drawWay;
47138     };
47139     return utilRebind(drawWay, dispatch14, "on");
47140   }
47141   var init_draw_way = __esm({
47142     "modules/behavior/draw_way.js"() {
47143       "use strict";
47144       init_src4();
47145       init_src5();
47146       init_presets();
47147       init_localizer();
47148       init_add_midpoint();
47149       init_move_node();
47150       init_noop2();
47151       init_draw();
47152       init_geo2();
47153       init_browse();
47154       init_select5();
47155       init_node2();
47156       init_rebind();
47157       init_util();
47158     }
47159   });
47160
47161   // modules/modes/draw_line.js
47162   var draw_line_exports = {};
47163   __export(draw_line_exports, {
47164     modeDrawLine: () => modeDrawLine
47165   });
47166   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
47167     var mode = {
47168       button,
47169       id: "draw-line"
47170     };
47171     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
47172       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
47173     });
47174     mode.wayID = wayID;
47175     mode.isContinuing = continuing;
47176     mode.enter = function() {
47177       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
47178       context.install(behavior);
47179     };
47180     mode.exit = function() {
47181       context.uninstall(behavior);
47182     };
47183     mode.selectedIDs = function() {
47184       return [wayID];
47185     };
47186     mode.activeID = function() {
47187       return behavior && behavior.activeID() || [];
47188     };
47189     return mode;
47190   }
47191   var init_draw_line = __esm({
47192     "modules/modes/draw_line.js"() {
47193       "use strict";
47194       init_localizer();
47195       init_draw_way();
47196     }
47197   });
47198
47199   // modules/ui/cmd.js
47200   var cmd_exports = {};
47201   __export(cmd_exports, {
47202     uiCmd: () => uiCmd
47203   });
47204   var uiCmd;
47205   var init_cmd = __esm({
47206     "modules/ui/cmd.js"() {
47207       "use strict";
47208       init_localizer();
47209       init_detect();
47210       uiCmd = function(code) {
47211         var detected = utilDetect();
47212         if (detected.os === "mac") {
47213           return code;
47214         }
47215         if (detected.os === "win") {
47216           if (code === "\u2318\u21E7Z") return "Ctrl+Y";
47217         }
47218         var result = "", replacements = {
47219           "\u2318": "Ctrl",
47220           "\u21E7": "Shift",
47221           "\u2325": "Alt",
47222           "\u232B": "Backspace",
47223           "\u2326": "Delete"
47224         };
47225         for (var i3 = 0; i3 < code.length; i3++) {
47226           if (code[i3] in replacements) {
47227             result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
47228           } else {
47229             result += code[i3];
47230           }
47231         }
47232         return result;
47233       };
47234       uiCmd.display = function(code) {
47235         if (code.length !== 1) return code;
47236         var detected = utilDetect();
47237         var mac = detected.os === "mac";
47238         var replacements = {
47239           "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
47240           "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
47241           "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
47242           "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
47243           "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
47244           "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
47245           "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
47246           "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
47247           "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
47248           "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
47249           "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
47250           "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
47251           "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
47252         };
47253         return replacements[code] || code;
47254       };
47255     }
47256   });
47257
47258   // modules/operations/delete.js
47259   var delete_exports = {};
47260   __export(delete_exports, {
47261     operationDelete: () => operationDelete
47262   });
47263   function operationDelete(context, selectedIDs) {
47264     var multi = selectedIDs.length === 1 ? "single" : "multiple";
47265     var action = actionDeleteMultiple(selectedIDs);
47266     var nodes = utilGetAllNodes(selectedIDs, context.graph());
47267     var coords = nodes.map(function(n3) {
47268       return n3.loc;
47269     });
47270     var extent = utilTotalExtent(selectedIDs, context.graph());
47271     var operation2 = function() {
47272       var nextSelectedID;
47273       var nextSelectedLoc;
47274       if (selectedIDs.length === 1) {
47275         var id2 = selectedIDs[0];
47276         var entity = context.entity(id2);
47277         var geometry = entity.geometry(context.graph());
47278         var parents = context.graph().parentWays(entity);
47279         var parent2 = parents[0];
47280         if (geometry === "vertex") {
47281           var nodes2 = parent2.nodes;
47282           var i3 = nodes2.indexOf(id2);
47283           if (i3 === 0) {
47284             i3++;
47285           } else if (i3 === nodes2.length - 1) {
47286             i3--;
47287           } else {
47288             var a4 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
47289             var b3 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
47290             i3 = a4 < b3 ? i3 - 1 : i3 + 1;
47291           }
47292           nextSelectedID = nodes2[i3];
47293           nextSelectedLoc = context.entity(nextSelectedID).loc;
47294         }
47295       }
47296       context.perform(action, operation2.annotation());
47297       context.validator().validate();
47298       if (nextSelectedID && nextSelectedLoc) {
47299         if (context.hasEntity(nextSelectedID)) {
47300           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
47301         } else {
47302           context.map().centerEase(nextSelectedLoc);
47303           context.enter(modeBrowse(context));
47304         }
47305       } else {
47306         context.enter(modeBrowse(context));
47307       }
47308     };
47309     operation2.available = function() {
47310       return true;
47311     };
47312     operation2.disabled = function() {
47313       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
47314         return "too_large";
47315       } else if (someMissing()) {
47316         return "not_downloaded";
47317       } else if (selectedIDs.some(context.hasHiddenConnections)) {
47318         return "connected_to_hidden";
47319       } else if (selectedIDs.some(protectedMember)) {
47320         return "part_of_relation";
47321       } else if (selectedIDs.some(incompleteRelation)) {
47322         return "incomplete_relation";
47323       } else if (selectedIDs.some(hasWikidataTag)) {
47324         return "has_wikidata_tag";
47325       }
47326       return false;
47327       function someMissing() {
47328         if (context.inIntro()) return false;
47329         var osm = context.connection();
47330         if (osm) {
47331           var missing = coords.filter(function(loc) {
47332             return !osm.isDataLoaded(loc);
47333           });
47334           if (missing.length) {
47335             missing.forEach(function(loc) {
47336               context.loadTileAtLoc(loc);
47337             });
47338             return true;
47339           }
47340         }
47341         return false;
47342       }
47343       function hasWikidataTag(id2) {
47344         var entity = context.entity(id2);
47345         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
47346       }
47347       function incompleteRelation(id2) {
47348         var entity = context.entity(id2);
47349         return entity.type === "relation" && !entity.isComplete(context.graph());
47350       }
47351       function protectedMember(id2) {
47352         var entity = context.entity(id2);
47353         if (entity.type !== "way") return false;
47354         var parents = context.graph().parentRelations(entity);
47355         for (var i3 = 0; i3 < parents.length; i3++) {
47356           var parent2 = parents[i3];
47357           var type2 = parent2.tags.type;
47358           var role = parent2.memberById(id2).role || "outer";
47359           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
47360             return true;
47361           }
47362         }
47363         return false;
47364       }
47365     };
47366     operation2.tooltip = function() {
47367       var disable = operation2.disabled();
47368       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
47369     };
47370     operation2.annotation = function() {
47371       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
47372     };
47373     operation2.id = "delete";
47374     operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
47375     operation2.title = _t.append("operations.delete.title");
47376     operation2.behavior = behaviorOperation(context).which(operation2);
47377     return operation2;
47378   }
47379   var init_delete = __esm({
47380     "modules/operations/delete.js"() {
47381       "use strict";
47382       init_localizer();
47383       init_delete_multiple();
47384       init_operation();
47385       init_geo2();
47386       init_browse();
47387       init_select5();
47388       init_cmd();
47389       init_util();
47390     }
47391   });
47392
47393   // modules/validations/disconnected_way.js
47394   var disconnected_way_exports = {};
47395   __export(disconnected_way_exports, {
47396     validationDisconnectedWay: () => validationDisconnectedWay
47397   });
47398   function validationDisconnectedWay() {
47399     var type2 = "disconnected_way";
47400     function isTaggedAsHighway(entity) {
47401       return osmRoutableHighwayTagValues[entity.tags.highway];
47402     }
47403     var validation = function checkDisconnectedWay(entity, graph) {
47404       var routingIslandWays = routingIslandForEntity(entity);
47405       if (!routingIslandWays) return [];
47406       return [new validationIssue({
47407         type: type2,
47408         subtype: "highway",
47409         severity: "warning",
47410         message: function(context) {
47411           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
47412           var label = entity2 && utilDisplayLabel(entity2, context.graph());
47413           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
47414         },
47415         reference: showReference,
47416         entityIds: Array.from(routingIslandWays).map(function(way) {
47417           return way.id;
47418         }),
47419         dynamicFixes: makeFixes
47420       })];
47421       function makeFixes(context) {
47422         var fixes = [];
47423         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
47424         if (singleEntity) {
47425           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
47426             var textDirection = _mainLocalizer.textDirection();
47427             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
47428             if (startFix) fixes.push(startFix);
47429             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
47430             if (endFix) fixes.push(endFix);
47431           }
47432           if (!fixes.length) {
47433             fixes.push(new validationIssueFix({
47434               title: _t.append("issues.fix.connect_feature.title")
47435             }));
47436           }
47437           fixes.push(new validationIssueFix({
47438             icon: "iD-operation-delete",
47439             title: _t.append("issues.fix.delete_feature.title"),
47440             entityIds: [singleEntity.id],
47441             onClick: function(context2) {
47442               var id2 = this.issue.entityIds[0];
47443               var operation2 = operationDelete(context2, [id2]);
47444               if (!operation2.disabled()) {
47445                 operation2();
47446               }
47447             }
47448           }));
47449         } else {
47450           fixes.push(new validationIssueFix({
47451             title: _t.append("issues.fix.connect_features.title")
47452           }));
47453         }
47454         return fixes;
47455       }
47456       function showReference(selection2) {
47457         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
47458       }
47459       function routingIslandForEntity(entity2) {
47460         var routingIsland = /* @__PURE__ */ new Set();
47461         var waysToCheck = [];
47462         function queueParentWays(node) {
47463           graph.parentWays(node).forEach(function(parentWay) {
47464             if (!routingIsland.has(parentWay) && // only check each feature once
47465             isRoutableWay(parentWay, false)) {
47466               routingIsland.add(parentWay);
47467               waysToCheck.push(parentWay);
47468             }
47469           });
47470         }
47471         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
47472           routingIsland.add(entity2);
47473           waysToCheck.push(entity2);
47474         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
47475           routingIsland.add(entity2);
47476           queueParentWays(entity2);
47477         } else {
47478           return null;
47479         }
47480         while (waysToCheck.length) {
47481           var wayToCheck = waysToCheck.pop();
47482           var childNodes = graph.childNodes(wayToCheck);
47483           for (var i3 in childNodes) {
47484             var vertex = childNodes[i3];
47485             if (isConnectedVertex(vertex)) {
47486               return null;
47487             }
47488             if (isRoutableNode(vertex)) {
47489               routingIsland.add(vertex);
47490             }
47491             queueParentWays(vertex);
47492           }
47493         }
47494         return routingIsland;
47495       }
47496       function isConnectedVertex(vertex) {
47497         var osm = services.osm;
47498         if (osm && !osm.isDataLoaded(vertex.loc)) return true;
47499         if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
47500         if (vertex.tags.amenity === "parking_entrance") return true;
47501         return false;
47502       }
47503       function isRoutableNode(node) {
47504         if (node.tags.highway === "elevator") return true;
47505         return false;
47506       }
47507       function isRoutableWay(way, ignoreInnerWays) {
47508         if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
47509         return graph.parentRelations(way).some(function(parentRelation) {
47510           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
47511           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
47512           return false;
47513         });
47514       }
47515       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
47516         var vertex = graph.hasEntity(vertexID);
47517         if (!vertex || vertex.tags.noexit === "yes") return null;
47518         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
47519         return new validationIssueFix({
47520           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
47521           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
47522           entityIds: [vertexID],
47523           onClick: function(context) {
47524             var wayId = this.issue.entityIds[0];
47525             var way = context.hasEntity(wayId);
47526             var vertexId = this.entityIds[0];
47527             var vertex2 = context.hasEntity(vertexId);
47528             if (!way || !vertex2) return;
47529             var map2 = context.map();
47530             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
47531               map2.zoomToEase(vertex2);
47532             }
47533             context.enter(
47534               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
47535             );
47536           }
47537         });
47538       }
47539     };
47540     validation.type = type2;
47541     return validation;
47542   }
47543   var init_disconnected_way = __esm({
47544     "modules/validations/disconnected_way.js"() {
47545       "use strict";
47546       init_localizer();
47547       init_draw_line();
47548       init_delete();
47549       init_utilDisplayLabel();
47550       init_tags();
47551       init_validation();
47552       init_services();
47553     }
47554   });
47555
47556   // modules/validations/invalid_format.js
47557   var invalid_format_exports = {};
47558   __export(invalid_format_exports, {
47559     validationFormatting: () => validationFormatting
47560   });
47561   function validationFormatting() {
47562     var type2 = "invalid_format";
47563     var validation = function(entity) {
47564       var issues = [];
47565       function isValidEmail(email) {
47566         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
47567         return !email || valid_email.test(email);
47568       }
47569       function showReferenceEmail(selection2) {
47570         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
47571       }
47572       if (entity.tags.email) {
47573         var emails = entity.tags.email.split(";").map(function(s2) {
47574           return s2.trim();
47575         }).filter(function(x2) {
47576           return !isValidEmail(x2);
47577         });
47578         if (emails.length) {
47579           issues.push(new validationIssue({
47580             type: type2,
47581             subtype: "email",
47582             severity: "warning",
47583             message: function(context) {
47584               var entity2 = context.hasEntity(this.entityIds[0]);
47585               return entity2 ? _t.append(
47586                 "issues.invalid_format.email.message" + this.data,
47587                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
47588               ) : "";
47589             },
47590             reference: showReferenceEmail,
47591             entityIds: [entity.id],
47592             hash: emails.join(),
47593             data: emails.length > 1 ? "_multi" : ""
47594           }));
47595         }
47596       }
47597       return issues;
47598     };
47599     validation.type = type2;
47600     return validation;
47601   }
47602   var init_invalid_format = __esm({
47603     "modules/validations/invalid_format.js"() {
47604       "use strict";
47605       init_localizer();
47606       init_utilDisplayLabel();
47607       init_validation();
47608     }
47609   });
47610
47611   // modules/validations/help_request.js
47612   var help_request_exports = {};
47613   __export(help_request_exports, {
47614     validationHelpRequest: () => validationHelpRequest
47615   });
47616   function validationHelpRequest(context) {
47617     var type2 = "help_request";
47618     var validation = function checkFixmeTag(entity) {
47619       if (!entity.tags.fixme) return [];
47620       if (entity.version === void 0) return [];
47621       if (entity.v !== void 0) {
47622         var baseEntity = context.history().base().hasEntity(entity.id);
47623         if (!baseEntity || !baseEntity.tags.fixme) return [];
47624       }
47625       return [new validationIssue({
47626         type: type2,
47627         subtype: "fixme_tag",
47628         severity: "warning",
47629         message: function(context2) {
47630           var entity2 = context2.hasEntity(this.entityIds[0]);
47631           return entity2 ? _t.append("issues.fixme_tag.message", {
47632             feature: utilDisplayLabel(
47633               entity2,
47634               context2.graph(),
47635               true
47636               /* verbose */
47637             )
47638           }) : "";
47639         },
47640         dynamicFixes: function() {
47641           return [
47642             new validationIssueFix({
47643               title: _t.append("issues.fix.address_the_concern.title")
47644             })
47645           ];
47646         },
47647         reference: showReference,
47648         entityIds: [entity.id]
47649       })];
47650       function showReference(selection2) {
47651         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
47652       }
47653     };
47654     validation.type = type2;
47655     return validation;
47656   }
47657   var init_help_request = __esm({
47658     "modules/validations/help_request.js"() {
47659       "use strict";
47660       init_localizer();
47661       init_utilDisplayLabel();
47662       init_validation();
47663     }
47664   });
47665
47666   // modules/validations/impossible_oneway.js
47667   var impossible_oneway_exports = {};
47668   __export(impossible_oneway_exports, {
47669     validationImpossibleOneway: () => validationImpossibleOneway
47670   });
47671   function validationImpossibleOneway() {
47672     const type2 = "impossible_oneway";
47673     const validation = function checkImpossibleOneway(entity, graph) {
47674       if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
47675       if (entity.isClosed()) return [];
47676       if (!typeForWay(entity)) return [];
47677       if (!entity.isOneWay()) return [];
47678       return [
47679         ...issuesForNode(entity, entity.first()),
47680         ...issuesForNode(entity, entity.last())
47681       ];
47682       function typeForWay(way) {
47683         if (way.geometry(graph) !== "line") return null;
47684         if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
47685         if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
47686         return null;
47687       }
47688       function nodeOccursMoreThanOnce(way, nodeID) {
47689         let occurrences = 0;
47690         for (const index in way.nodes) {
47691           if (way.nodes[index] === nodeID) {
47692             occurrences++;
47693             if (occurrences > 1) return true;
47694           }
47695         }
47696         return false;
47697       }
47698       function isConnectedViaOtherTypes(way, node) {
47699         var wayType = typeForWay(way);
47700         if (wayType === "highway") {
47701           if (node.tags.entrance && node.tags.entrance !== "no") return true;
47702           if (node.tags.amenity === "parking_entrance") return true;
47703         } else if (wayType === "waterway") {
47704           if (node.id === way.first()) {
47705             if (node.tags.natural === "spring") return true;
47706           } else {
47707             if (node.tags.manhole === "drain") return true;
47708           }
47709         }
47710         return graph.parentWays(node).some(function(parentWay) {
47711           if (parentWay.id === way.id) return false;
47712           if (wayType === "highway") {
47713             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
47714             if (parentWay.tags.route === "ferry") return true;
47715             return graph.parentRelations(parentWay).some(function(parentRelation) {
47716               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
47717               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
47718             });
47719           } else if (wayType === "waterway") {
47720             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
47721           }
47722           return false;
47723         });
47724       }
47725       function issuesForNode(way, nodeID) {
47726         const isFirst = nodeID === way.first() ^ way.isOneWayBackwards();
47727         const wayType = typeForWay(way);
47728         if (nodeOccursMoreThanOnce(way, nodeID)) return [];
47729         const osm = services.osm;
47730         if (!osm) return [];
47731         const node = graph.hasEntity(nodeID);
47732         if (!node || !osm.isDataLoaded(node.loc)) return [];
47733         if (isConnectedViaOtherTypes(way, node)) return [];
47734         const attachedWaysOfSameType = graph.parentWays(node).filter((parentWay) => {
47735           if (parentWay.id === way.id) return false;
47736           return typeForWay(parentWay) === wayType;
47737         });
47738         if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
47739         const attachedOneways = attachedWaysOfSameType.filter((attachedWay) => attachedWay.isOneWay());
47740         if (attachedOneways.length < attachedWaysOfSameType.length) return [];
47741         if (attachedOneways.length) {
47742           const connectedEndpointsOkay = attachedOneways.some((attachedOneway) => {
47743             const isAttachedBackwards = attachedOneway.isOneWayBackwards();
47744             if ((isFirst ^ isAttachedBackwards ? attachedOneway.first() : attachedOneway.last()) !== nodeID) {
47745               return true;
47746             }
47747             if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
47748             return false;
47749           });
47750           if (connectedEndpointsOkay) return [];
47751         }
47752         const placement = isFirst ? "start" : "end";
47753         let messageID = wayType + ".";
47754         let referenceID = wayType + ".";
47755         if (wayType === "waterway") {
47756           messageID += "connected." + placement;
47757           referenceID += "connected";
47758         } else {
47759           messageID += placement;
47760           referenceID += placement;
47761         }
47762         return [new validationIssue({
47763           type: type2,
47764           subtype: wayType,
47765           severity: "warning",
47766           message: function(context) {
47767             var entity2 = context.hasEntity(this.entityIds[0]);
47768             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
47769               feature: utilDisplayLabel(entity2, context.graph())
47770             }) : "";
47771           },
47772           reference: getReference(referenceID),
47773           entityIds: [way.id, node.id],
47774           dynamicFixes: function() {
47775             var fixes = [];
47776             if (attachedOneways.length) {
47777               fixes.push(new validationIssueFix({
47778                 icon: "iD-operation-reverse",
47779                 title: _t.append("issues.fix.reverse_feature.title"),
47780                 entityIds: [way.id],
47781                 onClick: function(context) {
47782                   var id2 = this.issue.entityIds[0];
47783                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
47784                 }
47785               }));
47786             }
47787             if (node.tags.noexit !== "yes") {
47788               var textDirection = _mainLocalizer.textDirection();
47789               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
47790               fixes.push(new validationIssueFix({
47791                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
47792                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
47793                 onClick: function(context) {
47794                   var entityID = this.issue.entityIds[0];
47795                   var vertexID = this.issue.entityIds[1];
47796                   var way2 = context.entity(entityID);
47797                   var vertex = context.entity(vertexID);
47798                   continueDrawing(way2, vertex, context);
47799                 }
47800               }));
47801             }
47802             return fixes;
47803           },
47804           loc: node.loc
47805         })];
47806         function getReference(referenceID2) {
47807           return function showReference(selection2) {
47808             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
47809           };
47810         }
47811       }
47812     };
47813     function continueDrawing(way, vertex, context) {
47814       var map2 = context.map();
47815       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
47816         map2.zoomToEase(vertex);
47817       }
47818       context.enter(
47819         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
47820       );
47821     }
47822     validation.type = type2;
47823     return validation;
47824   }
47825   var init_impossible_oneway = __esm({
47826     "modules/validations/impossible_oneway.js"() {
47827       "use strict";
47828       init_localizer();
47829       init_draw_line();
47830       init_reverse();
47831       init_utilDisplayLabel();
47832       init_tags();
47833       init_validation();
47834       init_services();
47835     }
47836   });
47837
47838   // modules/validations/incompatible_source.js
47839   var incompatible_source_exports = {};
47840   __export(incompatible_source_exports, {
47841     validationIncompatibleSource: () => validationIncompatibleSource
47842   });
47843   function validationIncompatibleSource() {
47844     const type2 = "incompatible_source";
47845     const incompatibleRules = [
47846       {
47847         id: "amap",
47848         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
47849       },
47850       {
47851         id: "baidu",
47852         regex: /(baidu|mapbar|百度)/i
47853       },
47854       {
47855         id: "google",
47856         regex: /google/i,
47857         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
47858       }
47859     ];
47860     const validation = function checkIncompatibleSource(entity) {
47861       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
47862       if (!entitySources) return [];
47863       const entityID = entity.id;
47864       return entitySources.map((source) => {
47865         const matchRule = incompatibleRules.find((rule) => {
47866           if (!rule.regex.test(source)) return false;
47867           if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
47868           return true;
47869         });
47870         if (!matchRule) return null;
47871         return new validationIssue({
47872           type: type2,
47873           severity: "warning",
47874           message: (context) => {
47875             const entity2 = context.hasEntity(entityID);
47876             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
47877               feature: utilDisplayLabel(
47878                 entity2,
47879                 context.graph(),
47880                 true
47881                 /* verbose */
47882               ),
47883               value: source
47884             }) : "";
47885           },
47886           reference: getReference(matchRule.id),
47887           entityIds: [entityID],
47888           hash: source,
47889           dynamicFixes: () => {
47890             return [
47891               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
47892             ];
47893           }
47894         });
47895       }).filter(Boolean);
47896       function getReference(id2) {
47897         return function showReference(selection2) {
47898           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
47899         };
47900       }
47901     };
47902     validation.type = type2;
47903     return validation;
47904   }
47905   var init_incompatible_source = __esm({
47906     "modules/validations/incompatible_source.js"() {
47907       "use strict";
47908       init_localizer();
47909       init_utilDisplayLabel();
47910       init_validation();
47911     }
47912   });
47913
47914   // modules/validations/maprules.js
47915   var maprules_exports2 = {};
47916   __export(maprules_exports2, {
47917     validationMaprules: () => validationMaprules
47918   });
47919   function validationMaprules() {
47920     var type2 = "maprules";
47921     var validation = function checkMaprules(entity, graph) {
47922       if (!services.maprules) return [];
47923       var rules = services.maprules.validationRules();
47924       var issues = [];
47925       for (var i3 = 0; i3 < rules.length; i3++) {
47926         var rule = rules[i3];
47927         rule.findIssues(entity, graph, issues);
47928       }
47929       return issues;
47930     };
47931     validation.type = type2;
47932     return validation;
47933   }
47934   var init_maprules2 = __esm({
47935     "modules/validations/maprules.js"() {
47936       "use strict";
47937       init_services();
47938     }
47939   });
47940
47941   // modules/validations/mismatched_geometry.js
47942   var mismatched_geometry_exports = {};
47943   __export(mismatched_geometry_exports, {
47944     validationMismatchedGeometry: () => validationMismatchedGeometry
47945   });
47946   function validationMismatchedGeometry() {
47947     var type2 = "mismatched_geometry";
47948     function tagSuggestingLineIsArea(entity) {
47949       if (entity.type !== "way" || entity.isClosed()) return null;
47950       var tagSuggestingArea = entity.tagSuggestingArea();
47951       if (!tagSuggestingArea) {
47952         return null;
47953       }
47954       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
47955       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
47956       if (asLine && asArea && (0, import_fast_deep_equal5.default)(asLine.tags, asArea.tags)) {
47957         return null;
47958       }
47959       if (asLine.isFallback() && asArea.isFallback() && !(0, import_fast_deep_equal5.default)(tagSuggestingArea, { area: "yes" })) {
47960         return null;
47961       }
47962       return tagSuggestingArea;
47963     }
47964     function makeConnectEndpointsFixOnClick(way, graph) {
47965       if (way.nodes.length < 3) return null;
47966       var nodes = graph.childNodes(way), testNodes;
47967       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
47968       if (firstToLastDistanceMeters < 0.75) {
47969         testNodes = nodes.slice();
47970         testNodes.pop();
47971         testNodes.push(testNodes[0]);
47972         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
47973           return function(context) {
47974             var way2 = context.entity(this.issue.entityIds[0]);
47975             context.perform(
47976               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
47977               _t("issues.fix.connect_endpoints.annotation")
47978             );
47979           };
47980         }
47981       }
47982       testNodes = nodes.slice();
47983       testNodes.push(testNodes[0]);
47984       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
47985         return function(context) {
47986           var wayId = this.issue.entityIds[0];
47987           var way2 = context.entity(wayId);
47988           var nodeId = way2.nodes[0];
47989           var index = way2.nodes.length;
47990           context.perform(
47991             actionAddVertex(wayId, nodeId, index),
47992             _t("issues.fix.connect_endpoints.annotation")
47993           );
47994         };
47995       }
47996     }
47997     function lineTaggedAsAreaIssue(entity) {
47998       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
47999       if (!tagSuggestingArea) return null;
48000       var validAsLine = false;
48001       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
48002       if (presetAsLine) {
48003         validAsLine = true;
48004         var key = Object.keys(tagSuggestingArea)[0];
48005         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
48006           validAsLine = false;
48007         }
48008         if (Object.keys(presetAsLine.tags).length === 0) {
48009           validAsLine = false;
48010         }
48011       }
48012       return new validationIssue({
48013         type: type2,
48014         subtype: "area_as_line",
48015         severity: "warning",
48016         message: function(context) {
48017           var entity2 = context.hasEntity(this.entityIds[0]);
48018           return entity2 ? _t.append("issues.tag_suggests_area.message", {
48019             feature: utilDisplayLabel(
48020               entity2,
48021               "area",
48022               true
48023               /* verbose */
48024             ),
48025             tag: utilTagText({ tags: tagSuggestingArea })
48026           }) : "";
48027         },
48028         reference: showReference,
48029         entityIds: [entity.id],
48030         hash: JSON.stringify(tagSuggestingArea),
48031         dynamicFixes: function(context) {
48032           var fixes = [];
48033           var entity2 = context.entity(this.entityIds[0]);
48034           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
48035           if (!validAsLine) {
48036             fixes.push(new validationIssueFix({
48037               title: _t.append("issues.fix.connect_endpoints.title"),
48038               onClick: connectEndsOnClick
48039             }));
48040           }
48041           fixes.push(new validationIssueFix({
48042             icon: "iD-operation-delete",
48043             title: _t.append("issues.fix.remove_tag.title"),
48044             onClick: function(context2) {
48045               var entityId = this.issue.entityIds[0];
48046               var entity3 = context2.entity(entityId);
48047               var tags = Object.assign({}, entity3.tags);
48048               for (var key2 in tagSuggestingArea) {
48049                 delete tags[key2];
48050               }
48051               context2.perform(
48052                 actionChangeTags(entityId, tags),
48053                 _t("issues.fix.remove_tag.annotation")
48054               );
48055             }
48056           }));
48057           return fixes;
48058         }
48059       });
48060       function showReference(selection2) {
48061         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
48062       }
48063     }
48064     function vertexPointIssue(entity, graph) {
48065       if (entity.type !== "node") return null;
48066       if (Object.keys(entity.tags).length === 0) return null;
48067       if (entity.isOnAddressLine(graph)) return null;
48068       var geometry = entity.geometry(graph);
48069       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
48070       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
48071         return new validationIssue({
48072           type: type2,
48073           subtype: "vertex_as_point",
48074           severity: "warning",
48075           message: function(context) {
48076             var entity2 = context.hasEntity(this.entityIds[0]);
48077             return entity2 ? _t.append("issues.vertex_as_point.message", {
48078               feature: utilDisplayLabel(
48079                 entity2,
48080                 "vertex",
48081                 true
48082                 /* verbose */
48083               )
48084             }) : "";
48085           },
48086           reference: function showReference(selection2) {
48087             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
48088           },
48089           entityIds: [entity.id]
48090         });
48091       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
48092         return new validationIssue({
48093           type: type2,
48094           subtype: "point_as_vertex",
48095           severity: "warning",
48096           message: function(context) {
48097             var entity2 = context.hasEntity(this.entityIds[0]);
48098             return entity2 ? _t.append("issues.point_as_vertex.message", {
48099               feature: utilDisplayLabel(
48100                 entity2,
48101                 "point",
48102                 true
48103                 /* verbose */
48104               )
48105             }) : "";
48106           },
48107           reference: function showReference(selection2) {
48108             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
48109           },
48110           entityIds: [entity.id],
48111           dynamicFixes: extractPointDynamicFixes
48112         });
48113       }
48114       return null;
48115     }
48116     function otherMismatchIssue(entity, graph) {
48117       if (!entity.hasInterestingTags()) return null;
48118       if (entity.type !== "node" && entity.type !== "way") return null;
48119       if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
48120       var sourceGeom = entity.geometry(graph);
48121       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
48122       if (sourceGeom === "area") targetGeoms.unshift("line");
48123       var asSource = _mainPresetIndex.match(entity, graph);
48124       var targetGeom = targetGeoms.find((nodeGeom) => {
48125         const asTarget = _mainPresetIndex.matchTags(
48126           entity.tags,
48127           nodeGeom,
48128           entity.extent(graph).center()
48129         );
48130         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
48131         (0, import_fast_deep_equal5.default)(asSource.tags, asTarget.tags)) return false;
48132         if (asTarget.isFallback()) return false;
48133         var primaryKey = Object.keys(asTarget.tags)[0];
48134         if (primaryKey === "building") return false;
48135         if (asTarget.tags[primaryKey] === "*") return false;
48136         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
48137       });
48138       if (!targetGeom) return null;
48139       var subtype = targetGeom + "_as_" + sourceGeom;
48140       if (targetGeom === "vertex") targetGeom = "point";
48141       if (sourceGeom === "vertex") sourceGeom = "point";
48142       var referenceId = targetGeom + "_as_" + sourceGeom;
48143       var dynamicFixes;
48144       if (targetGeom === "point") {
48145         dynamicFixes = extractPointDynamicFixes;
48146       } else if (sourceGeom === "area" && targetGeom === "line") {
48147         dynamicFixes = lineToAreaDynamicFixes;
48148       }
48149       return new validationIssue({
48150         type: type2,
48151         subtype,
48152         severity: "warning",
48153         message: function(context) {
48154           var entity2 = context.hasEntity(this.entityIds[0]);
48155           return entity2 ? _t.append("issues." + referenceId + ".message", {
48156             feature: utilDisplayLabel(
48157               entity2,
48158               targetGeom,
48159               true
48160               /* verbose */
48161             )
48162           }) : "";
48163         },
48164         reference: function showReference(selection2) {
48165           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
48166         },
48167         entityIds: [entity.id],
48168         dynamicFixes
48169       });
48170     }
48171     function lineToAreaDynamicFixes(context) {
48172       var convertOnClick;
48173       var entityId = this.entityIds[0];
48174       var entity = context.entity(entityId);
48175       var tags = Object.assign({}, entity.tags);
48176       delete tags.area;
48177       if (!osmTagSuggestingArea(tags)) {
48178         convertOnClick = function(context2) {
48179           var entityId2 = this.issue.entityIds[0];
48180           var entity2 = context2.entity(entityId2);
48181           var tags2 = Object.assign({}, entity2.tags);
48182           if (tags2.area) {
48183             delete tags2.area;
48184           }
48185           context2.perform(
48186             actionChangeTags(entityId2, tags2),
48187             _t("issues.fix.convert_to_line.annotation")
48188           );
48189         };
48190       }
48191       return [
48192         new validationIssueFix({
48193           icon: "iD-icon-line",
48194           title: _t.append("issues.fix.convert_to_line.title"),
48195           onClick: convertOnClick
48196         })
48197       ];
48198     }
48199     function extractPointDynamicFixes(context) {
48200       var entityId = this.entityIds[0];
48201       var extractOnClick = null;
48202       if (!context.hasHiddenConnections(entityId)) {
48203         extractOnClick = function(context2) {
48204           var entityId2 = this.issue.entityIds[0];
48205           var action = actionExtract(entityId2, context2.projection);
48206           context2.perform(
48207             action,
48208             _t("operations.extract.annotation", { n: 1 })
48209           );
48210           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
48211         };
48212       }
48213       return [
48214         new validationIssueFix({
48215           icon: "iD-operation-extract",
48216           title: _t.append("issues.fix.extract_point.title"),
48217           onClick: extractOnClick
48218         })
48219       ];
48220     }
48221     function unclosedMultipolygonPartIssues(entity, graph) {
48222       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
48223       !entity.isComplete(graph)) return [];
48224       var sequences = osmJoinWays(entity.members, graph);
48225       var issues = [];
48226       for (var i3 in sequences) {
48227         var sequence = sequences[i3];
48228         if (!sequence.nodes) continue;
48229         var firstNode = sequence.nodes[0];
48230         var lastNode = sequence.nodes[sequence.nodes.length - 1];
48231         if (firstNode === lastNode) continue;
48232         var issue = new validationIssue({
48233           type: type2,
48234           subtype: "unclosed_multipolygon_part",
48235           severity: "warning",
48236           message: function(context) {
48237             var entity2 = context.hasEntity(this.entityIds[0]);
48238             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
48239               feature: utilDisplayLabel(
48240                 entity2,
48241                 context.graph(),
48242                 true
48243                 /* verbose */
48244               )
48245             }) : "";
48246           },
48247           reference: showReference,
48248           loc: sequence.nodes[0].loc,
48249           entityIds: [entity.id],
48250           hash: sequence.map(function(way) {
48251             return way.id;
48252           }).join()
48253         });
48254         issues.push(issue);
48255       }
48256       return issues;
48257       function showReference(selection2) {
48258         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
48259       }
48260     }
48261     var validation = function checkMismatchedGeometry(entity, graph) {
48262       var vertexPoint = vertexPointIssue(entity, graph);
48263       if (vertexPoint) return [vertexPoint];
48264       var lineAsArea = lineTaggedAsAreaIssue(entity);
48265       if (lineAsArea) return [lineAsArea];
48266       var mismatch = otherMismatchIssue(entity, graph);
48267       if (mismatch) return [mismatch];
48268       return unclosedMultipolygonPartIssues(entity, graph);
48269     };
48270     validation.type = type2;
48271     return validation;
48272   }
48273   var import_fast_deep_equal5;
48274   var init_mismatched_geometry = __esm({
48275     "modules/validations/mismatched_geometry.js"() {
48276       "use strict";
48277       import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
48278       init_add_vertex();
48279       init_change_tags();
48280       init_merge_nodes();
48281       init_extract();
48282       init_select5();
48283       init_multipolygon();
48284       init_tags();
48285       init_presets();
48286       init_geo2();
48287       init_localizer();
48288       init_util();
48289       init_utilDisplayLabel();
48290       init_validation();
48291     }
48292   });
48293
48294   // modules/validations/missing_role.js
48295   var missing_role_exports = {};
48296   __export(missing_role_exports, {
48297     validationMissingRole: () => validationMissingRole
48298   });
48299   function validationMissingRole() {
48300     var type2 = "missing_role";
48301     var validation = function checkMissingRole(entity, graph) {
48302       var issues = [];
48303       if (entity.type === "way") {
48304         graph.parentRelations(entity).forEach(function(relation) {
48305           if (!relation.isMultipolygon()) return;
48306           var member = relation.memberById(entity.id);
48307           if (member && isMissingRole(member)) {
48308             issues.push(makeIssue(entity, relation, member));
48309           }
48310         });
48311       } else if (entity.type === "relation" && entity.isMultipolygon()) {
48312         entity.indexedMembers().forEach(function(member) {
48313           var way = graph.hasEntity(member.id);
48314           if (way && isMissingRole(member)) {
48315             issues.push(makeIssue(way, entity, member));
48316           }
48317         });
48318       }
48319       return issues;
48320     };
48321     function isMissingRole(member) {
48322       return !member.role || !member.role.trim().length;
48323     }
48324     function makeIssue(way, relation, member) {
48325       return new validationIssue({
48326         type: type2,
48327         severity: "warning",
48328         message: function(context) {
48329           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
48330           return member2 && relation2 ? _t.append("issues.missing_role.message", {
48331             member: utilDisplayLabel(member2, context.graph()),
48332             relation: utilDisplayLabel(relation2, context.graph())
48333           }) : "";
48334         },
48335         reference: showReference,
48336         entityIds: [relation.id, way.id],
48337         data: {
48338           member
48339         },
48340         hash: member.index.toString(),
48341         dynamicFixes: function() {
48342           return [
48343             makeAddRoleFix("inner"),
48344             makeAddRoleFix("outer"),
48345             new validationIssueFix({
48346               icon: "iD-operation-delete",
48347               title: _t.append("issues.fix.remove_from_relation.title"),
48348               onClick: function(context) {
48349                 context.perform(
48350                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
48351                   _t("operations.delete_member.annotation", {
48352                     n: 1
48353                   })
48354                 );
48355               }
48356             })
48357           ];
48358         }
48359       });
48360       function showReference(selection2) {
48361         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
48362       }
48363     }
48364     function makeAddRoleFix(role) {
48365       return new validationIssueFix({
48366         title: _t.append("issues.fix.set_as_" + role + ".title"),
48367         onClick: function(context) {
48368           var oldMember = this.issue.data.member;
48369           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
48370           context.perform(
48371             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
48372             _t("operations.change_role.annotation", {
48373               n: 1
48374             })
48375           );
48376         }
48377       });
48378     }
48379     validation.type = type2;
48380     return validation;
48381   }
48382   var init_missing_role = __esm({
48383     "modules/validations/missing_role.js"() {
48384       "use strict";
48385       init_change_member();
48386       init_delete_member();
48387       init_localizer();
48388       init_utilDisplayLabel();
48389       init_validation();
48390     }
48391   });
48392
48393   // modules/validations/missing_tag.js
48394   var missing_tag_exports = {};
48395   __export(missing_tag_exports, {
48396     validationMissingTag: () => validationMissingTag
48397   });
48398   function validationMissingTag(context) {
48399     var type2 = "missing_tag";
48400     function hasDescriptiveTags(entity) {
48401       var onlyAttributeKeys = ["description", "name", "note", "start_date", "oneway"];
48402       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k3) {
48403         if (k3 === "area" || !osmIsInterestingTag(k3)) return false;
48404         return !onlyAttributeKeys.some(function(attributeKey) {
48405           return k3 === attributeKey || k3.indexOf(attributeKey + ":") === 0;
48406         });
48407       });
48408       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
48409         return false;
48410       }
48411       return entityDescriptiveKeys.length > 0;
48412     }
48413     function isUnknownRoad(entity) {
48414       return entity.type === "way" && entity.tags.highway === "road";
48415     }
48416     function isUntypedRelation(entity) {
48417       return entity.type === "relation" && !entity.tags.type;
48418     }
48419     var validation = function checkMissingTag(entity, graph) {
48420       var subtype;
48421       var osm = context.connection();
48422       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
48423       if (!isUnloadedNode && // allow untagged nodes that are part of ways
48424       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
48425       !entity.hasParentRelations(graph)) {
48426         if (Object.keys(entity.tags).length === 0) {
48427           subtype = "any";
48428         } else if (!hasDescriptiveTags(entity)) {
48429           subtype = "descriptive";
48430         } else if (isUntypedRelation(entity)) {
48431           subtype = "relation_type";
48432         }
48433       }
48434       if (!subtype && isUnknownRoad(entity)) {
48435         subtype = "highway_classification";
48436       }
48437       if (!subtype) return [];
48438       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
48439       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
48440       var canDelete = entity.version === void 0 || entity.v !== void 0;
48441       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
48442       return [new validationIssue({
48443         type: type2,
48444         subtype,
48445         severity,
48446         message: function(context2) {
48447           var entity2 = context2.hasEntity(this.entityIds[0]);
48448           return entity2 ? _t.append("issues." + messageID + ".message", {
48449             feature: utilDisplayLabel(entity2, context2.graph())
48450           }) : "";
48451         },
48452         reference: showReference,
48453         entityIds: [entity.id],
48454         dynamicFixes: function(context2) {
48455           var fixes = [];
48456           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
48457           fixes.push(new validationIssueFix({
48458             icon: "iD-icon-search",
48459             title: _t.append("issues.fix." + selectFixType + ".title"),
48460             onClick: function(context3) {
48461               context3.ui().sidebar.showPresetList();
48462             }
48463           }));
48464           var deleteOnClick;
48465           var id2 = this.entityIds[0];
48466           var operation2 = operationDelete(context2, [id2]);
48467           var disabledReasonID = operation2.disabled();
48468           if (!disabledReasonID) {
48469             deleteOnClick = function(context3) {
48470               var id3 = this.issue.entityIds[0];
48471               var operation3 = operationDelete(context3, [id3]);
48472               if (!operation3.disabled()) {
48473                 operation3();
48474               }
48475             };
48476           }
48477           fixes.push(
48478             new validationIssueFix({
48479               icon: "iD-operation-delete",
48480               title: _t.append("issues.fix.delete_feature.title"),
48481               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
48482               onClick: deleteOnClick
48483             })
48484           );
48485           return fixes;
48486         }
48487       })];
48488       function showReference(selection2) {
48489         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
48490       }
48491     };
48492     validation.type = type2;
48493     return validation;
48494   }
48495   var init_missing_tag = __esm({
48496     "modules/validations/missing_tag.js"() {
48497       "use strict";
48498       init_delete();
48499       init_tags();
48500       init_localizer();
48501       init_utilDisplayLabel();
48502       init_validation();
48503     }
48504   });
48505
48506   // modules/validations/mutually_exclusive_tags.js
48507   var mutually_exclusive_tags_exports = {};
48508   __export(mutually_exclusive_tags_exports, {
48509     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags
48510   });
48511   function validationMutuallyExclusiveTags() {
48512     const type2 = "mutually_exclusive_tags";
48513     const tagKeyPairs = osmMutuallyExclusiveTagPairs;
48514     const validation = function checkMutuallyExclusiveTags(entity) {
48515       let pairsFounds = tagKeyPairs.filter((pair3) => {
48516         return pair3[0] in entity.tags && pair3[1] in entity.tags;
48517       }).filter((pair3) => {
48518         return !(pair3[0].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[0]] === "no" || pair3[1].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[1]] === "no");
48519       });
48520       Object.keys(entity.tags).forEach((key) => {
48521         let negative_key = "not:" + key;
48522         if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
48523           pairsFounds.push([negative_key, key, "same_value"]);
48524         }
48525         if (key.match(/^name:[a-z]+/)) {
48526           negative_key = "not:name";
48527           if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
48528             pairsFounds.push([negative_key, key, "same_value"]);
48529           }
48530         }
48531       });
48532       let issues = pairsFounds.map((pair3) => {
48533         const subtype = pair3[2] || "default";
48534         return new validationIssue({
48535           type: type2,
48536           subtype,
48537           severity: "warning",
48538           message: function(context) {
48539             let entity2 = context.hasEntity(this.entityIds[0]);
48540             return entity2 ? _t.append(`issues.${type2}.${subtype}.message`, {
48541               feature: utilDisplayLabel(entity2, context.graph()),
48542               tag1: pair3[0],
48543               tag2: pair3[1]
48544             }) : "";
48545           },
48546           reference: (selection2) => showReference(selection2, pair3, subtype),
48547           entityIds: [entity.id],
48548           dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
48549         });
48550       });
48551       function createIssueFix(tagToRemove) {
48552         return new validationIssueFix({
48553           icon: "iD-operation-delete",
48554           title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
48555           onClick: function(context) {
48556             const entityId = this.issue.entityIds[0];
48557             const entity2 = context.entity(entityId);
48558             let tags = Object.assign({}, entity2.tags);
48559             delete tags[tagToRemove];
48560             context.perform(
48561               actionChangeTags(entityId, tags),
48562               _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
48563             );
48564           }
48565         });
48566       }
48567       function showReference(selection2, pair3, subtype) {
48568         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.${type2}.${subtype}.reference`, { tag1: pair3[0], tag2: pair3[1] }));
48569       }
48570       return issues;
48571     };
48572     validation.type = type2;
48573     return validation;
48574   }
48575   var init_mutually_exclusive_tags = __esm({
48576     "modules/validations/mutually_exclusive_tags.js"() {
48577       "use strict";
48578       init_change_tags();
48579       init_localizer();
48580       init_utilDisplayLabel();
48581       init_validation();
48582       init_tags();
48583     }
48584   });
48585
48586   // modules/operations/split.js
48587   var split_exports2 = {};
48588   __export(split_exports2, {
48589     operationSplit: () => operationSplit
48590   });
48591   function operationSplit(context, selectedIDs) {
48592     var _vertexIds = selectedIDs.filter(function(id2) {
48593       return context.graph().geometry(id2) === "vertex";
48594     });
48595     var _selectedWayIds = selectedIDs.filter(function(id2) {
48596       var entity = context.graph().hasEntity(id2);
48597       return entity && entity.type === "way";
48598     });
48599     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
48600     var _action = actionSplit(_vertexIds);
48601     var _ways = [];
48602     var _geometry = "feature";
48603     var _waysAmount = "single";
48604     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
48605     if (_isAvailable) {
48606       if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
48607       _ways = _action.ways(context.graph());
48608       var geometries = {};
48609       _ways.forEach(function(way) {
48610         geometries[way.geometry(context.graph())] = true;
48611       });
48612       if (Object.keys(geometries).length === 1) {
48613         _geometry = Object.keys(geometries)[0];
48614       }
48615       _waysAmount = _ways.length === 1 ? "single" : "multiple";
48616     }
48617     var operation2 = function() {
48618       var difference2 = context.perform(_action, operation2.annotation());
48619       var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
48620         return context.entity(id2).type === "way";
48621       }));
48622       context.enter(modeSelect(context, idsToSelect));
48623     };
48624     operation2.relatedEntityIds = function() {
48625       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
48626     };
48627     operation2.available = function() {
48628       return _isAvailable;
48629     };
48630     operation2.disabled = function() {
48631       var reason = _action.disabled(context.graph());
48632       if (reason) {
48633         return reason;
48634       } else if (selectedIDs.some(context.hasHiddenConnections)) {
48635         return "connected_to_hidden";
48636       }
48637       return false;
48638     };
48639     operation2.tooltip = function() {
48640       var disable = operation2.disabled();
48641       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
48642     };
48643     operation2.annotation = function() {
48644       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
48645     };
48646     operation2.icon = function() {
48647       if (_waysAmount === "multiple") {
48648         return "#iD-operation-split-multiple";
48649       } else {
48650         return "#iD-operation-split";
48651       }
48652     };
48653     operation2.id = "split";
48654     operation2.keys = [_t("operations.split.key")];
48655     operation2.title = _t.append("operations.split.title");
48656     operation2.behavior = behaviorOperation(context).which(operation2);
48657     return operation2;
48658   }
48659   var init_split2 = __esm({
48660     "modules/operations/split.js"() {
48661       "use strict";
48662       init_localizer();
48663       init_split();
48664       init_operation();
48665       init_select5();
48666     }
48667   });
48668
48669   // modules/validations/osm_api_limits.js
48670   var osm_api_limits_exports = {};
48671   __export(osm_api_limits_exports, {
48672     validationOsmApiLimits: () => validationOsmApiLimits
48673   });
48674   function validationOsmApiLimits(context) {
48675     const type2 = "osm_api_limits";
48676     const validation = function checkOsmApiLimits(entity) {
48677       const issues = [];
48678       const osm = context.connection();
48679       if (!osm) return issues;
48680       const maxWayNodes = osm.maxWayNodes();
48681       if (entity.type === "way") {
48682         if (entity.nodes.length > maxWayNodes) {
48683           issues.push(new validationIssue({
48684             type: type2,
48685             subtype: "exceededMaxWayNodes",
48686             severity: "error",
48687             message: function() {
48688               return _t.html("issues.osm_api_limits.max_way_nodes.message");
48689             },
48690             reference: function(selection2) {
48691               selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(_t.html("issues.osm_api_limits.max_way_nodes.reference", { maxWayNodes }));
48692             },
48693             entityIds: [entity.id],
48694             dynamicFixes: splitWayIntoSmallChunks
48695           }));
48696         }
48697       }
48698       return issues;
48699     };
48700     function splitWayIntoSmallChunks() {
48701       const fix = new validationIssueFix({
48702         icon: "iD-operation-split",
48703         title: _t.html("issues.fix.split_way.title"),
48704         entityIds: this.entityIds,
48705         onClick: function(context2) {
48706           const maxWayNodes = context2.connection().maxWayNodes();
48707           const g3 = context2.graph();
48708           const entityId = this.entityIds[0];
48709           const entity = context2.graph().entities[entityId];
48710           const numberOfParts = Math.ceil(entity.nodes.length / maxWayNodes);
48711           let splitVertices;
48712           if (numberOfParts === 2) {
48713             const splitIntersections = entity.nodes.map((nid) => g3.entity(nid)).filter((n3) => g3.parentWays(n3).length > 1).map((n3) => n3.id).filter((nid) => {
48714               const splitIndex = entity.nodes.indexOf(nid);
48715               return splitIndex < maxWayNodes && entity.nodes.length - splitIndex < maxWayNodes;
48716             });
48717             if (splitIntersections.length > 0) {
48718               splitVertices = [
48719                 splitIntersections[Math.floor(splitIntersections.length / 2)]
48720               ];
48721             }
48722           }
48723           if (splitVertices === void 0) {
48724             splitVertices = [...Array(numberOfParts - 1)].map((_3, i3) => entity.nodes[Math.floor(entity.nodes.length * (i3 + 1) / numberOfParts)]);
48725           }
48726           if (entity.isClosed()) {
48727             splitVertices.push(entity.nodes[0]);
48728           }
48729           const operation2 = operationSplit(context2, splitVertices.concat(entityId));
48730           if (!operation2.disabled()) {
48731             operation2();
48732           }
48733         }
48734       });
48735       return [fix];
48736     }
48737     validation.type = type2;
48738     return validation;
48739   }
48740   var init_osm_api_limits = __esm({
48741     "modules/validations/osm_api_limits.js"() {
48742       "use strict";
48743       init_localizer();
48744       init_validation();
48745       init_split2();
48746     }
48747   });
48748
48749   // modules/osm/deprecated.js
48750   var deprecated_exports = {};
48751   __export(deprecated_exports, {
48752     deprecatedTagValuesByKey: () => deprecatedTagValuesByKey,
48753     getDeprecatedTags: () => getDeprecatedTags
48754   });
48755   function getDeprecatedTags(tags, dataDeprecated) {
48756     if (Object.keys(tags).length === 0) return [];
48757     var deprecated = [];
48758     dataDeprecated.forEach((d2) => {
48759       var oldKeys = Object.keys(d2.old);
48760       if (d2.replace) {
48761         var hasExistingValues = Object.keys(d2.replace).some((replaceKey) => {
48762           if (!tags[replaceKey] || d2.old[replaceKey]) return false;
48763           var replaceValue = d2.replace[replaceKey];
48764           if (replaceValue === "*") return false;
48765           if (replaceValue === tags[replaceKey]) return false;
48766           return true;
48767         });
48768         if (hasExistingValues) return;
48769       }
48770       var matchesDeprecatedTags = oldKeys.every((oldKey) => {
48771         if (!tags[oldKey]) return false;
48772         if (d2.old[oldKey] === "*") return true;
48773         if (d2.old[oldKey] === tags[oldKey]) return true;
48774         var vals = tags[oldKey].split(";").filter(Boolean);
48775         if (vals.length === 0) {
48776           return false;
48777         } else if (vals.length > 1) {
48778           return vals.indexOf(d2.old[oldKey]) !== -1;
48779         } else {
48780           if (tags[oldKey] === d2.old[oldKey]) {
48781             if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
48782               var replaceKeys = Object.keys(d2.replace);
48783               return !replaceKeys.every((replaceKey) => {
48784                 return tags[replaceKey] === d2.replace[replaceKey];
48785               });
48786             } else {
48787               return true;
48788             }
48789           }
48790         }
48791         return false;
48792       });
48793       if (matchesDeprecatedTags) {
48794         deprecated.push(d2);
48795       }
48796     });
48797     return deprecated;
48798   }
48799   function deprecatedTagValuesByKey(dataDeprecated) {
48800     if (!_deprecatedTagValuesByKey) {
48801       _deprecatedTagValuesByKey = {};
48802       dataDeprecated.forEach((d2) => {
48803         var oldKeys = Object.keys(d2.old);
48804         if (oldKeys.length === 1) {
48805           var oldKey = oldKeys[0];
48806           var oldValue = d2.old[oldKey];
48807           if (oldValue !== "*") {
48808             if (!_deprecatedTagValuesByKey[oldKey]) {
48809               _deprecatedTagValuesByKey[oldKey] = [oldValue];
48810             } else {
48811               _deprecatedTagValuesByKey[oldKey].push(oldValue);
48812             }
48813           }
48814         }
48815       });
48816     }
48817     return _deprecatedTagValuesByKey;
48818   }
48819   var _deprecatedTagValuesByKey;
48820   var init_deprecated = __esm({
48821     "modules/osm/deprecated.js"() {
48822       "use strict";
48823     }
48824   });
48825
48826   // modules/validations/outdated_tags.js
48827   var outdated_tags_exports = {};
48828   __export(outdated_tags_exports, {
48829     validationOutdatedTags: () => validationOutdatedTags
48830   });
48831   function validationOutdatedTags() {
48832     const type2 = "outdated_tags";
48833     let _waitingForDeprecated = true;
48834     let _dataDeprecated;
48835     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
48836     }).finally(() => _waitingForDeprecated = false);
48837     function oldTagIssues(entity, graph) {
48838       if (!entity.hasInterestingTags()) return [];
48839       let preset = _mainPresetIndex.match(entity, graph);
48840       if (!preset) return [];
48841       const oldTags = Object.assign({}, entity.tags);
48842       if (preset.replacement) {
48843         const newPreset = _mainPresetIndex.item(preset.replacement);
48844         graph = actionChangePreset(
48845           entity.id,
48846           preset,
48847           newPreset,
48848           true
48849           /* skip field defaults */
48850         )(graph);
48851         entity = graph.entity(entity.id);
48852         preset = newPreset;
48853       }
48854       const nsi = services.nsi;
48855       let waitingForNsi = false;
48856       let nsiResult;
48857       if (nsi) {
48858         waitingForNsi = nsi.status() === "loading";
48859         if (!waitingForNsi) {
48860           const loc = entity.extent(graph).center();
48861           nsiResult = nsi.upgradeTags(oldTags, loc);
48862         }
48863       }
48864       const nsiDiff = nsiResult ? utilTagDiff(oldTags, nsiResult.newTags) : [];
48865       let deprecatedTags;
48866       if (_dataDeprecated) {
48867         deprecatedTags = getDeprecatedTags(entity.tags, _dataDeprecated);
48868         if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
48869           deprecatedTags.push({
48870             old: { traffic_calming: "island" },
48871             replace: { "area:highway": "traffic_island" }
48872           });
48873         }
48874         if (deprecatedTags.length) {
48875           deprecatedTags.forEach((tag) => {
48876             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
48877           });
48878           entity = graph.entity(entity.id);
48879         }
48880       }
48881       let newTags = Object.assign({}, entity.tags);
48882       if (preset.tags !== preset.addTags) {
48883         Object.keys(preset.addTags).filter((k3) => {
48884           return !(nsiResult == null ? void 0 : nsiResult.newTags[k3]);
48885         }).forEach((k3) => {
48886           if (!newTags[k3]) {
48887             if (preset.addTags[k3] === "*") {
48888               newTags[k3] = "yes";
48889             } else if (preset.addTags[k3]) {
48890               newTags[k3] = preset.addTags[k3];
48891             }
48892           }
48893         });
48894       }
48895       const deprecationDiff = utilTagDiff(oldTags, newTags);
48896       const deprecationDiffContext = Object.keys(oldTags).filter((key) => deprecatedTags == null ? void 0 : deprecatedTags.some((deprecated) => {
48897         var _a4;
48898         return ((_a4 = deprecated.replace) == null ? void 0 : _a4[key]) !== void 0;
48899       })).filter((key) => newTags[key] === oldTags[key]).map((key) => ({
48900         type: "~",
48901         key,
48902         oldVal: oldTags[key],
48903         newVal: newTags[key],
48904         display: "&nbsp; " + key + "=" + oldTags[key]
48905       }));
48906       let issues = [];
48907       issues.provisional = _waitingForDeprecated || waitingForNsi;
48908       if (deprecationDiff.length) {
48909         const isOnlyAddingTags = !deprecationDiff.some((d2) => d2.type === "-");
48910         const prefix = isOnlyAddingTags ? "incomplete." : "";
48911         issues.push(new validationIssue({
48912           type: type2,
48913           subtype: isOnlyAddingTags ? "incomplete_tags" : "deprecated_tags",
48914           severity: "warning",
48915           message: (context) => {
48916             const currEntity = context.hasEntity(entity.id);
48917             if (!currEntity) return "";
48918             const feature3 = utilDisplayLabel(
48919               currEntity,
48920               context.graph(),
48921               /* verbose */
48922               true
48923             );
48924             return _t.append(`issues.outdated_tags.${prefix}message`, { feature: feature3 });
48925           },
48926           reference: (selection2) => showReference(
48927             selection2,
48928             _t.append(`issues.outdated_tags.${prefix}reference`),
48929             [...deprecationDiff, ...deprecationDiffContext]
48930           ),
48931           entityIds: [entity.id],
48932           hash: utilHashcode(JSON.stringify(deprecationDiff)),
48933           dynamicFixes: () => {
48934             let fixes = [
48935               new validationIssueFix({
48936                 title: _t.append("issues.fix.upgrade_tags.title"),
48937                 onClick: (context) => {
48938                   context.perform((graph2) => doUpgrade(graph2, deprecationDiff), _t("issues.fix.upgrade_tags.annotation"));
48939                 }
48940               })
48941             ];
48942             return fixes;
48943           }
48944         }));
48945       }
48946       if (nsiDiff.length) {
48947         const isOnlyAddingTags = nsiDiff.every((d2) => d2.type === "+");
48948         issues.push(new validationIssue({
48949           type: type2,
48950           subtype: "noncanonical_brand",
48951           severity: "warning",
48952           message: (context) => {
48953             const currEntity = context.hasEntity(entity.id);
48954             if (!currEntity) return "";
48955             const feature3 = utilDisplayLabel(
48956               currEntity,
48957               context.graph(),
48958               /* verbose */
48959               true
48960             );
48961             return isOnlyAddingTags ? _t.append("issues.outdated_tags.noncanonical_brand.message_incomplete", { feature: feature3 }) : _t.append("issues.outdated_tags.noncanonical_brand.message", { feature: feature3 });
48962           },
48963           reference: (selection2) => showReference(
48964             selection2,
48965             _t.append("issues.outdated_tags.noncanonical_brand.reference"),
48966             nsiDiff
48967           ),
48968           entityIds: [entity.id],
48969           hash: utilHashcode(JSON.stringify(nsiDiff)),
48970           dynamicFixes: () => {
48971             let fixes = [
48972               new validationIssueFix({
48973                 title: _t.append("issues.fix.upgrade_tags.title"),
48974                 onClick: (context) => {
48975                   context.perform((graph2) => doUpgrade(graph2, nsiDiff), _t("issues.fix.upgrade_tags.annotation"));
48976                 }
48977               }),
48978               new validationIssueFix({
48979                 title: _t.append("issues.fix.tag_as_not.title", { name: nsiResult.matched.displayName }),
48980                 onClick: (context) => {
48981                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
48982                 }
48983               })
48984             ];
48985             return fixes;
48986           }
48987         }));
48988       }
48989       return issues;
48990       function doUpgrade(graph2, diff) {
48991         const currEntity = graph2.hasEntity(entity.id);
48992         if (!currEntity) return graph2;
48993         let newTags2 = Object.assign({}, currEntity.tags);
48994         diff.forEach((diff2) => {
48995           if (diff2.type === "-") {
48996             delete newTags2[diff2.key];
48997           } else if (diff2.type === "+") {
48998             newTags2[diff2.key] = diff2.newVal;
48999           }
49000         });
49001         return actionChangeTags(currEntity.id, newTags2)(graph2);
49002       }
49003       function addNotTag(graph2) {
49004         const currEntity = graph2.hasEntity(entity.id);
49005         if (!currEntity) return graph2;
49006         const item = nsiResult && nsiResult.matched;
49007         if (!item) return graph2;
49008         let newTags2 = Object.assign({}, currEntity.tags);
49009         const wd = item.mainTag;
49010         const notwd = `not:${wd}`;
49011         const qid = item.tags[wd];
49012         newTags2[notwd] = qid;
49013         if (newTags2[wd] === qid) {
49014           const wp = item.mainTag.replace("wikidata", "wikipedia");
49015           delete newTags2[wd];
49016           delete newTags2[wp];
49017         }
49018         return actionChangeTags(currEntity.id, newTags2)(graph2);
49019       }
49020       function showReference(selection2, reference, tagDiff) {
49021         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
49022         enter.append("div").attr("class", "issue-reference").call(reference);
49023         enter.append("strong").call(_t.append("issues.suggested"));
49024         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
49025           const klass = "tagDiff-cell";
49026           switch (d2.type) {
49027             case "+":
49028               return `${klass} tagDiff-cell-add`;
49029             case "-":
49030               return `${klass} tagDiff-cell-remove`;
49031             default:
49032               return `${klass} tagDiff-cell-unchanged`;
49033           }
49034         }).html((d2) => d2.display);
49035       }
49036     }
49037     let validation = oldTagIssues;
49038     validation.type = type2;
49039     return validation;
49040   }
49041   var init_outdated_tags = __esm({
49042     "modules/validations/outdated_tags.js"() {
49043       "use strict";
49044       init_localizer();
49045       init_change_preset();
49046       init_change_tags();
49047       init_upgrade_tags();
49048       init_core();
49049       init_presets();
49050       init_services();
49051       init_util();
49052       init_utilDisplayLabel();
49053       init_validation();
49054       init_deprecated();
49055     }
49056   });
49057
49058   // modules/validations/private_data.js
49059   var private_data_exports = {};
49060   __export(private_data_exports, {
49061     validationPrivateData: () => validationPrivateData
49062   });
49063   function validationPrivateData() {
49064     var type2 = "private_data";
49065     var privateBuildingValues = {
49066       detached: true,
49067       farm: true,
49068       house: true,
49069       houseboat: true,
49070       residential: true,
49071       semidetached_house: true,
49072       static_caravan: true
49073     };
49074     var publicKeys = {
49075       amenity: true,
49076       craft: true,
49077       historic: true,
49078       leisure: true,
49079       office: true,
49080       shop: true,
49081       tourism: true
49082     };
49083     var personalTags = {
49084       "contact:email": true,
49085       "contact:fax": true,
49086       "contact:phone": true,
49087       email: true,
49088       fax: true,
49089       phone: true
49090     };
49091     var validation = function checkPrivateData(entity) {
49092       var tags = entity.tags;
49093       if (!tags.building || !privateBuildingValues[tags.building]) return [];
49094       var keepTags = {};
49095       for (var k3 in tags) {
49096         if (publicKeys[k3]) return [];
49097         if (!personalTags[k3]) {
49098           keepTags[k3] = tags[k3];
49099         }
49100       }
49101       var tagDiff = utilTagDiff(tags, keepTags);
49102       if (!tagDiff.length) return [];
49103       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
49104       return [new validationIssue({
49105         type: type2,
49106         severity: "warning",
49107         message: showMessage,
49108         reference: showReference,
49109         entityIds: [entity.id],
49110         dynamicFixes: function() {
49111           return [
49112             new validationIssueFix({
49113               icon: "iD-operation-delete",
49114               title: _t.append("issues.fix." + fixID + ".title"),
49115               onClick: function(context) {
49116                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
49117               }
49118             })
49119           ];
49120         }
49121       })];
49122       function doUpgrade(graph) {
49123         var currEntity = graph.hasEntity(entity.id);
49124         if (!currEntity) return graph;
49125         var newTags = Object.assign({}, currEntity.tags);
49126         tagDiff.forEach(function(diff) {
49127           if (diff.type === "-") {
49128             delete newTags[diff.key];
49129           } else if (diff.type === "+") {
49130             newTags[diff.key] = diff.newVal;
49131           }
49132         });
49133         return actionChangeTags(currEntity.id, newTags)(graph);
49134       }
49135       function showMessage(context) {
49136         var currEntity = context.hasEntity(this.entityIds[0]);
49137         if (!currEntity) return "";
49138         return _t.append(
49139           "issues.private_data.contact.message",
49140           { feature: utilDisplayLabel(currEntity, context.graph()) }
49141         );
49142       }
49143       function showReference(selection2) {
49144         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
49145         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
49146         enter.append("strong").call(_t.append("issues.suggested"));
49147         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d2) {
49148           var klass = d2.type === "+" ? "add" : "remove";
49149           return "tagDiff-cell tagDiff-cell-" + klass;
49150         }).html(function(d2) {
49151           return d2.display;
49152         });
49153       }
49154     };
49155     validation.type = type2;
49156     return validation;
49157   }
49158   var init_private_data = __esm({
49159     "modules/validations/private_data.js"() {
49160       "use strict";
49161       init_change_tags();
49162       init_localizer();
49163       init_util();
49164       init_utilDisplayLabel();
49165       init_validation();
49166     }
49167   });
49168
49169   // modules/validations/suspicious_name.js
49170   var suspicious_name_exports = {};
49171   __export(suspicious_name_exports, {
49172     validationSuspiciousName: () => validationSuspiciousName
49173   });
49174   function validationSuspiciousName(context) {
49175     const type2 = "suspicious_name";
49176     const keysToTestForGenericValues = [
49177       "aerialway",
49178       "aeroway",
49179       "amenity",
49180       "building",
49181       "craft",
49182       "highway",
49183       "leisure",
49184       "railway",
49185       "man_made",
49186       "office",
49187       "shop",
49188       "tourism",
49189       "waterway"
49190     ];
49191     const ignoredPresets = /* @__PURE__ */ new Set([
49192       "amenity/place_of_worship/christian/jehovahs_witness",
49193       "__test__ignored_preset"
49194       // for unit tests
49195     ]);
49196     let _waitingForNsi = false;
49197     function isGenericMatchInNsi(tags) {
49198       const nsi = services.nsi;
49199       if (nsi) {
49200         _waitingForNsi = nsi.status() === "loading";
49201         if (!_waitingForNsi) {
49202           return nsi.isGenericName(tags);
49203         }
49204       }
49205       return false;
49206     }
49207     function nameMatchesRawTag(lowercaseName, tags) {
49208       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
49209         let key = keysToTestForGenericValues[i3];
49210         let val = tags[key];
49211         if (val) {
49212           val = val.toLowerCase();
49213           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
49214             return true;
49215           }
49216         }
49217       }
49218       return false;
49219     }
49220     function nameMatchesPresetName(name, preset) {
49221       if (!preset) return false;
49222       if (ignoredPresets.has(preset.id)) return false;
49223       name = name.toLowerCase();
49224       return name === preset.name().toLowerCase() || preset.aliases().some((alias) => name === alias.toLowerCase());
49225     }
49226     function isGenericName(name, tags, preset) {
49227       name = name.toLowerCase();
49228       return nameMatchesRawTag(name, tags) || nameMatchesPresetName(name, preset) || isGenericMatchInNsi(tags);
49229     }
49230     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
49231       return new validationIssue({
49232         type: type2,
49233         subtype: "generic_name",
49234         severity: "warning",
49235         message: function(context2) {
49236           let entity = context2.hasEntity(this.entityIds[0]);
49237           if (!entity) return "";
49238           let preset = _mainPresetIndex.match(entity, context2.graph());
49239           let langName = langCode && _mainLocalizer.languageName(langCode);
49240           return _t.append(
49241             "issues.generic_name.message" + (langName ? "_language" : ""),
49242             { feature: preset.name(), name: genericName, language: langName }
49243           );
49244         },
49245         reference: showReference,
49246         entityIds: [entityId],
49247         hash: `${nameKey}=${genericName}`,
49248         dynamicFixes: function() {
49249           return [
49250             new validationIssueFix({
49251               icon: "iD-operation-delete",
49252               title: _t.append("issues.fix.remove_the_name.title"),
49253               onClick: function(context2) {
49254                 let entityId2 = this.issue.entityIds[0];
49255                 let entity = context2.entity(entityId2);
49256                 let tags = Object.assign({}, entity.tags);
49257                 delete tags[nameKey];
49258                 context2.perform(
49259                   actionChangeTags(entityId2, tags),
49260                   _t("issues.fix.remove_generic_name.annotation")
49261                 );
49262               }
49263             })
49264           ];
49265         }
49266       });
49267       function showReference(selection2) {
49268         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
49269       }
49270     }
49271     let validation = function checkGenericName(entity) {
49272       const tags = entity.tags;
49273       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
49274       if (hasWikidata) return [];
49275       let issues = [];
49276       const preset = _mainPresetIndex.match(entity, context.graph());
49277       for (let key in tags) {
49278         const m3 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
49279         if (!m3) continue;
49280         const langCode = m3.length >= 2 ? m3[1] : null;
49281         const value = tags[key];
49282         if (isGenericName(value, tags, preset)) {
49283           issues.provisional = _waitingForNsi;
49284           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
49285         }
49286       }
49287       return issues;
49288     };
49289     validation.type = type2;
49290     return validation;
49291   }
49292   var init_suspicious_name = __esm({
49293     "modules/validations/suspicious_name.js"() {
49294       "use strict";
49295       init_change_tags();
49296       init_presets();
49297       init_services();
49298       init_localizer();
49299       init_validation();
49300     }
49301   });
49302
49303   // modules/validations/unsquare_way.js
49304   var unsquare_way_exports = {};
49305   __export(unsquare_way_exports, {
49306     validationUnsquareWay: () => validationUnsquareWay
49307   });
49308   function validationUnsquareWay(context) {
49309     var type2 = "unsquare_way";
49310     var DEFAULT_DEG_THRESHOLD = 5;
49311     var epsilon3 = 0.05;
49312     var nodeThreshold = 10;
49313     function isBuilding(entity, graph) {
49314       if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
49315       return entity.tags.building && entity.tags.building !== "no";
49316     }
49317     var validation = function checkUnsquareWay(entity, graph) {
49318       if (!isBuilding(entity, graph)) return [];
49319       if (entity.tags.nonsquare === "yes") return [];
49320       var isClosed = entity.isClosed();
49321       if (!isClosed) return [];
49322       var nodes = graph.childNodes(entity).slice();
49323       if (nodes.length > nodeThreshold + 1) return [];
49324       var osm = services.osm;
49325       if (!osm || nodes.some(function(node) {
49326         return !osm.isDataLoaded(node.loc);
49327       })) return [];
49328       var hasConnectedSquarableWays = nodes.some(function(node) {
49329         return graph.parentWays(node).some(function(way) {
49330           if (way.id === entity.id) return false;
49331           if (isBuilding(way, graph)) return true;
49332           return graph.parentRelations(way).some(function(parentRelation) {
49333             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
49334           });
49335         });
49336       });
49337       if (hasConnectedSquarableWays) return [];
49338       var storedDegreeThreshold = corePreferences("validate-square-degrees");
49339       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
49340       var points = nodes.map(function(node) {
49341         return context.projection(node.loc);
49342       });
49343       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
49344       var autoArgs;
49345       if (!entity.tags.wikidata) {
49346         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
49347         autoAction.transitionable = false;
49348         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
49349       }
49350       return [new validationIssue({
49351         type: type2,
49352         subtype: "building",
49353         severity: "warning",
49354         message: function(context2) {
49355           var entity2 = context2.hasEntity(this.entityIds[0]);
49356           return entity2 ? _t.append("issues.unsquare_way.message", {
49357             feature: utilDisplayLabel(entity2, context2.graph())
49358           }) : "";
49359         },
49360         reference: showReference,
49361         entityIds: [entity.id],
49362         hash: degreeThreshold,
49363         dynamicFixes: function() {
49364           return [
49365             new validationIssueFix({
49366               icon: "iD-operation-orthogonalize",
49367               title: _t.append("issues.fix.square_feature.title"),
49368               autoArgs,
49369               onClick: function(context2, completionHandler) {
49370                 var entityId = this.issue.entityIds[0];
49371                 context2.perform(
49372                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
49373                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
49374                 );
49375                 window.setTimeout(function() {
49376                   completionHandler();
49377                 }, 175);
49378               }
49379             })
49380             /*
49381             new validationIssueFix({
49382                 title: t.append('issues.fix.tag_as_unsquare.title'),
49383                 onClick: function(context) {
49384                     var entityId = this.issue.entityIds[0];
49385                     var entity = context.entity(entityId);
49386                     var tags = Object.assign({}, entity.tags);  // shallow copy
49387                     tags.nonsquare = 'yes';
49388                     context.perform(
49389                         actionChangeTags(entityId, tags),
49390                         t('issues.fix.tag_as_unsquare.annotation')
49391                     );
49392                 }
49393             })
49394             */
49395           ];
49396         }
49397       })];
49398       function showReference(selection2) {
49399         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
49400       }
49401     };
49402     validation.type = type2;
49403     return validation;
49404   }
49405   var init_unsquare_way = __esm({
49406     "modules/validations/unsquare_way.js"() {
49407       "use strict";
49408       init_preferences();
49409       init_localizer();
49410       init_orthogonalize();
49411       init_ortho();
49412       init_utilDisplayLabel();
49413       init_validation();
49414       init_services();
49415     }
49416   });
49417
49418   // modules/validations/index.js
49419   var validations_exports = {};
49420   __export(validations_exports, {
49421     validationAlmostJunction: () => validationAlmostJunction,
49422     validationCloseNodes: () => validationCloseNodes,
49423     validationCrossingWays: () => validationCrossingWays,
49424     validationDisconnectedWay: () => validationDisconnectedWay,
49425     validationFormatting: () => validationFormatting,
49426     validationHelpRequest: () => validationHelpRequest,
49427     validationImpossibleOneway: () => validationImpossibleOneway,
49428     validationIncompatibleSource: () => validationIncompatibleSource,
49429     validationMaprules: () => validationMaprules,
49430     validationMismatchedGeometry: () => validationMismatchedGeometry,
49431     validationMissingRole: () => validationMissingRole,
49432     validationMissingTag: () => validationMissingTag,
49433     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
49434     validationOsmApiLimits: () => validationOsmApiLimits,
49435     validationOutdatedTags: () => validationOutdatedTags,
49436     validationPrivateData: () => validationPrivateData,
49437     validationSuspiciousName: () => validationSuspiciousName,
49438     validationUnsquareWay: () => validationUnsquareWay
49439   });
49440   var init_validations = __esm({
49441     "modules/validations/index.js"() {
49442       "use strict";
49443       init_almost_junction();
49444       init_close_nodes();
49445       init_crossing_ways();
49446       init_disconnected_way();
49447       init_invalid_format();
49448       init_help_request();
49449       init_impossible_oneway();
49450       init_incompatible_source();
49451       init_maprules2();
49452       init_mismatched_geometry();
49453       init_missing_role();
49454       init_missing_tag();
49455       init_mutually_exclusive_tags();
49456       init_osm_api_limits();
49457       init_outdated_tags();
49458       init_private_data();
49459       init_suspicious_name();
49460       init_unsquare_way();
49461     }
49462   });
49463
49464   // modules/core/validator.js
49465   var validator_exports = {};
49466   __export(validator_exports, {
49467     coreValidator: () => coreValidator
49468   });
49469   function coreValidator(context) {
49470     let dispatch14 = dispatch_default("validated", "focusedIssue");
49471     const validator = {};
49472     let _rules = {};
49473     let _disabledRules = {};
49474     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
49475     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
49476     let _baseCache = validationCache("base");
49477     let _headCache = validationCache("head");
49478     let _completeDiff = {};
49479     let _headIsCurrent = false;
49480     let _deferredRIC = {};
49481     let _deferredST = /* @__PURE__ */ new Set();
49482     let _headPromise;
49483     const RETRY = 5e3;
49484     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
49485     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
49486     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
49487     function parseHashParam(param) {
49488       let result = [];
49489       let rules = (param || "").split(",");
49490       rules.forEach((rule) => {
49491         rule = rule.trim();
49492         const parts = rule.split("/", 2);
49493         const type2 = parts[0];
49494         const subtype = parts[1] || "*";
49495         if (!type2 || !subtype) return;
49496         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
49497       });
49498       return result;
49499       function makeRegExp(str) {
49500         const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
49501         return new RegExp("^" + escaped + "$");
49502       }
49503     }
49504     validator.init = () => {
49505       Object.values(validations_exports).forEach((validation) => {
49506         if (typeof validation !== "function") return;
49507         const fn = validation(context);
49508         const key = fn.type;
49509         _rules[key] = fn;
49510       });
49511       let disabledRules = corePreferences("validate-disabledRules");
49512       if (disabledRules) {
49513         disabledRules.split(",").forEach((k3) => _disabledRules[k3] = true);
49514       }
49515     };
49516     function reset(resetIgnored) {
49517       _baseCache.queue = [];
49518       _headCache.queue = [];
49519       Object.keys(_deferredRIC).forEach((key) => {
49520         window.cancelIdleCallback(key);
49521         _deferredRIC[key]();
49522       });
49523       _deferredRIC = {};
49524       _deferredST.forEach(window.clearTimeout);
49525       _deferredST.clear();
49526       if (resetIgnored) _ignoredIssueIDs.clear();
49527       _resolvedIssueIDs.clear();
49528       _baseCache = validationCache("base");
49529       _headCache = validationCache("head");
49530       _completeDiff = {};
49531       _headIsCurrent = false;
49532     }
49533     validator.reset = () => {
49534       reset(true);
49535     };
49536     validator.resetIgnoredIssues = () => {
49537       _ignoredIssueIDs.clear();
49538       dispatch14.call("validated");
49539     };
49540     validator.revalidateUnsquare = () => {
49541       revalidateUnsquare(_headCache);
49542       revalidateUnsquare(_baseCache);
49543       dispatch14.call("validated");
49544     };
49545     function revalidateUnsquare(cache) {
49546       const checkUnsquareWay = _rules.unsquare_way;
49547       if (!cache.graph || typeof checkUnsquareWay !== "function") return;
49548       cache.uncacheIssuesOfType("unsquare_way");
49549       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");
49550       buildings.forEach((entity) => {
49551         const detected = checkUnsquareWay(entity, cache.graph);
49552         if (!detected.length) return;
49553         cache.cacheIssues(detected);
49554       });
49555     }
49556     validator.getIssues = (options) => {
49557       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options);
49558       const view = context.map().extent();
49559       let seen = /* @__PURE__ */ new Set();
49560       let results = [];
49561       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
49562         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
49563           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
49564           if (opts.what === "edited" && !userModified) return;
49565           if (!filter2(issue)) return;
49566           seen.add(issue.id);
49567           results.push(issue);
49568         });
49569       }
49570       if (opts.what === "all") {
49571         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
49572           if (!filter2(issue)) return;
49573           seen.add(issue.id);
49574           results.push(issue);
49575         });
49576       }
49577       return results;
49578       function filter2(issue) {
49579         if (!issue) return false;
49580         if (seen.has(issue.id)) return false;
49581         if (_resolvedIssueIDs.has(issue.id)) return false;
49582         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
49583         if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
49584         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
49585         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
49586         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
49587         if (opts.where === "visible") {
49588           const extent = issue.extent(context.graph());
49589           if (!view.intersects(extent)) return false;
49590         }
49591         return true;
49592       }
49593     };
49594     validator.getResolvedIssues = () => {
49595       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
49596     };
49597     validator.focusIssue = (issue) => {
49598       const graph = context.graph();
49599       let selectID;
49600       let focusCenter;
49601       const issueExtent = issue.extent(graph);
49602       if (issueExtent) {
49603         focusCenter = issueExtent.center();
49604       }
49605       if (issue.entityIds && issue.entityIds.length) {
49606         selectID = issue.entityIds[0];
49607         if (selectID && selectID.charAt(0) === "r") {
49608           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
49609           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
49610           if (!nodeID) {
49611             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
49612             if (wayID) {
49613               nodeID = graph.entity(wayID).first();
49614             }
49615           }
49616           if (nodeID) {
49617             focusCenter = graph.entity(nodeID).loc;
49618           }
49619         }
49620       }
49621       if (focusCenter) {
49622         const setZoom = Math.max(context.map().zoom(), 19);
49623         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
49624       }
49625       if (selectID) {
49626         window.setTimeout(() => {
49627           context.enter(modeSelect(context, [selectID]));
49628           dispatch14.call("focusedIssue", this, issue);
49629         }, 250);
49630       }
49631     };
49632     validator.getIssuesBySeverity = (options) => {
49633       let groups = utilArrayGroupBy(validator.getIssues(options), "severity");
49634       groups.error = groups.error || [];
49635       groups.warning = groups.warning || [];
49636       return groups;
49637     };
49638     validator.getSharedEntityIssues = (entityIDs, options) => {
49639       const orderedIssueTypes = [
49640         // Show some issue types in a particular order:
49641         "missing_tag",
49642         "missing_role",
49643         // - missing data first
49644         "outdated_tags",
49645         "mismatched_geometry",
49646         // - identity issues
49647         "crossing_ways",
49648         "almost_junction",
49649         // - geometry issues where fixing them might solve connectivity issues
49650         "disconnected_way",
49651         "impossible_oneway"
49652         // - finally connectivity issues
49653       ];
49654       const allIssues = validator.getIssues(options);
49655       const forEntityIDs = new Set(entityIDs);
49656       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
49657         if (issue1.type === issue2.type) {
49658           return issue1.id < issue2.id ? -1 : 1;
49659         }
49660         const index1 = orderedIssueTypes.indexOf(issue1.type);
49661         const index2 = orderedIssueTypes.indexOf(issue2.type);
49662         if (index1 !== -1 && index2 !== -1) {
49663           return index1 - index2;
49664         } else if (index1 === -1 && index2 === -1) {
49665           return issue1.type < issue2.type ? -1 : 1;
49666         } else {
49667           return index1 !== -1 ? -1 : 1;
49668         }
49669       });
49670     };
49671     validator.getEntityIssues = (entityID, options) => {
49672       return validator.getSharedEntityIssues([entityID], options);
49673     };
49674     validator.getRuleKeys = () => {
49675       return Object.keys(_rules);
49676     };
49677     validator.isRuleEnabled = (key) => {
49678       return !_disabledRules[key];
49679     };
49680     validator.toggleRule = (key) => {
49681       if (_disabledRules[key]) {
49682         delete _disabledRules[key];
49683       } else {
49684         _disabledRules[key] = true;
49685       }
49686       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
49687       validator.validate();
49688     };
49689     validator.disableRules = (keys2) => {
49690       _disabledRules = {};
49691       keys2.forEach((k3) => _disabledRules[k3] = true);
49692       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
49693       validator.validate();
49694     };
49695     validator.ignoreIssue = (issueID) => {
49696       _ignoredIssueIDs.add(issueID);
49697     };
49698     validator.validate = () => {
49699       const baseGraph = context.history().base();
49700       if (!_headCache.graph) _headCache.graph = baseGraph;
49701       if (!_baseCache.graph) _baseCache.graph = baseGraph;
49702       const prevGraph = _headCache.graph;
49703       const currGraph = context.graph();
49704       if (currGraph === prevGraph) {
49705         _headIsCurrent = true;
49706         dispatch14.call("validated");
49707         return Promise.resolve();
49708       }
49709       if (_headPromise) {
49710         _headIsCurrent = false;
49711         return _headPromise;
49712       }
49713       _headCache.graph = currGraph;
49714       _completeDiff = context.history().difference().complete();
49715       const incrementalDiff = coreDifference(prevGraph, currGraph);
49716       const diff = Object.keys(incrementalDiff.complete());
49717       const entityIDs = _headCache.withAllRelatedEntities(diff);
49718       if (!entityIDs.size) {
49719         dispatch14.call("validated");
49720         return Promise.resolve();
49721       }
49722       const addConnectedWays = (graph) => diff.filter((entityID) => graph.hasEntity(entityID)).map((entityID) => graph.entity(entityID)).flatMap((entity) => graph.childNodes(entity)).flatMap((vertex) => graph.parentWays(vertex)).forEach((way) => entityIDs.add(way.id));
49723       addConnectedWays(currGraph);
49724       addConnectedWays(prevGraph);
49725       Object.values({ ...incrementalDiff.created(), ...incrementalDiff.deleted() }).filter((e3) => e3.type === "relation").flatMap((r2) => r2.members).forEach((m3) => entityIDs.add(m3.id));
49726       Object.values(incrementalDiff.modified()).filter((e3) => e3.type === "relation").map((r2) => ({ baseEntity: prevGraph.entity(r2.id), headEntity: r2 })).forEach(({ baseEntity, headEntity }) => {
49727         const bm = baseEntity.members.map((m3) => m3.id);
49728         const hm = headEntity.members.map((m3) => m3.id);
49729         const symDiff = utilArrayDifference(utilArrayUnion(bm, hm), utilArrayIntersection(bm, hm));
49730         symDiff.forEach((id2) => entityIDs.add(id2));
49731       });
49732       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
49733       }).then(() => {
49734         _headPromise = null;
49735         if (!_headIsCurrent) {
49736           validator.validate();
49737         }
49738       });
49739       return _headPromise;
49740     };
49741     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
49742       reset(false);
49743       validator.validate();
49744     });
49745     context.on("exit.validator", validator.validate);
49746     context.history().on("merge.validator", (entities) => {
49747       if (!entities) return;
49748       const baseGraph = context.history().base();
49749       if (!_headCache.graph) _headCache.graph = baseGraph;
49750       if (!_baseCache.graph) _baseCache.graph = baseGraph;
49751       let entityIDs = entities.map((entity) => entity.id);
49752       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
49753       validateEntitiesAsync(entityIDs, _baseCache);
49754     });
49755     function validateEntity(entity, graph) {
49756       let result = { issues: [], provisional: false };
49757       Object.keys(_rules).forEach(runValidation);
49758       return result;
49759       function runValidation(key) {
49760         const fn = _rules[key];
49761         if (typeof fn !== "function") {
49762           console.error("no such validation rule = " + key);
49763           return;
49764         }
49765         let detected = fn(entity, graph);
49766         if (detected.provisional) {
49767           result.provisional = true;
49768         }
49769         detected = detected.filter(applySeverityOverrides);
49770         result.issues = result.issues.concat(detected);
49771         function applySeverityOverrides(issue) {
49772           const type2 = issue.type;
49773           const subtype = issue.subtype || "";
49774           let i3;
49775           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
49776             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
49777               issue.severity = "error";
49778               return true;
49779             }
49780           }
49781           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
49782             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
49783               issue.severity = "warning";
49784               return true;
49785             }
49786           }
49787           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
49788             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
49789               return false;
49790             }
49791           }
49792           return true;
49793         }
49794       }
49795     }
49796     function updateResolvedIssues(entityIDs) {
49797       entityIDs.forEach((entityID) => {
49798         const baseIssues = _baseCache.issuesByEntityID[entityID];
49799         if (!baseIssues) return;
49800         baseIssues.forEach((issueID) => {
49801           const issue = _baseCache.issuesByIssueID[issueID];
49802           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
49803           if (userModified && !_headCache.issuesByIssueID[issueID]) {
49804             _resolvedIssueIDs.add(issueID);
49805           } else {
49806             _resolvedIssueIDs.delete(issueID);
49807           }
49808         });
49809       });
49810     }
49811     function validateEntitiesAsync(entityIDs, cache) {
49812       const jobs = Array.from(entityIDs).map((entityID) => {
49813         if (cache.queuedEntityIDs.has(entityID)) return null;
49814         cache.queuedEntityIDs.add(entityID);
49815         cache.uncacheEntityID(entityID);
49816         return () => {
49817           cache.queuedEntityIDs.delete(entityID);
49818           const graph = cache.graph;
49819           if (!graph) return;
49820           const entity = graph.hasEntity(entityID);
49821           if (!entity) return;
49822           const result = validateEntity(entity, graph);
49823           if (result.provisional) {
49824             cache.provisionalEntityIDs.add(entityID);
49825           }
49826           cache.cacheIssues(result.issues);
49827         };
49828       }).filter(Boolean);
49829       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
49830       if (cache.queuePromise) return cache.queuePromise;
49831       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
49832       }).finally(() => cache.queuePromise = null);
49833       return cache.queuePromise;
49834     }
49835     function revalidateProvisionalEntities(cache) {
49836       if (!cache.provisionalEntityIDs.size) return;
49837       const handle = window.setTimeout(() => {
49838         _deferredST.delete(handle);
49839         if (!cache.provisionalEntityIDs.size) return;
49840         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
49841       }, RETRY);
49842       _deferredST.add(handle);
49843     }
49844     function processQueue(cache) {
49845       if (!cache.queue.length) return Promise.resolve();
49846       const chunk = cache.queue.pop();
49847       return new Promise((resolvePromise, rejectPromise) => {
49848         const handle = window.requestIdleCallback(() => {
49849           delete _deferredRIC[handle];
49850           chunk.forEach((job) => job());
49851           resolvePromise();
49852         });
49853         _deferredRIC[handle] = rejectPromise;
49854       }).then(() => {
49855         if (cache.queue.length % 25 === 0) dispatch14.call("validated");
49856       }).then(() => processQueue(cache));
49857     }
49858     return utilRebind(validator, dispatch14, "on");
49859   }
49860   function validationCache(which) {
49861     let cache = {
49862       which,
49863       graph: null,
49864       queue: [],
49865       queuePromise: null,
49866       queuedEntityIDs: /* @__PURE__ */ new Set(),
49867       provisionalEntityIDs: /* @__PURE__ */ new Set(),
49868       issuesByIssueID: {},
49869       // issue.id -> issue
49870       issuesByEntityID: {}
49871       // entity.id -> Set(issue.id)
49872     };
49873     cache.cacheIssue = (issue) => {
49874       (issue.entityIds || []).forEach((entityID) => {
49875         if (!cache.issuesByEntityID[entityID]) {
49876           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
49877         }
49878         cache.issuesByEntityID[entityID].add(issue.id);
49879       });
49880       cache.issuesByIssueID[issue.id] = issue;
49881     };
49882     cache.uncacheIssue = (issue) => {
49883       (issue.entityIds || []).forEach((entityID) => {
49884         if (cache.issuesByEntityID[entityID]) {
49885           cache.issuesByEntityID[entityID].delete(issue.id);
49886         }
49887       });
49888       delete cache.issuesByIssueID[issue.id];
49889     };
49890     cache.cacheIssues = (issues) => {
49891       issues.forEach(cache.cacheIssue);
49892     };
49893     cache.uncacheIssues = (issues) => {
49894       issues.forEach(cache.uncacheIssue);
49895     };
49896     cache.uncacheIssuesOfType = (type2) => {
49897       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
49898       cache.uncacheIssues(issuesOfType);
49899     };
49900     cache.uncacheEntityID = (entityID) => {
49901       const entityIssueIDs = cache.issuesByEntityID[entityID];
49902       if (entityIssueIDs) {
49903         entityIssueIDs.forEach((issueID) => {
49904           const issue = cache.issuesByIssueID[issueID];
49905           if (issue) {
49906             cache.uncacheIssue(issue);
49907           } else {
49908             delete cache.issuesByIssueID[issueID];
49909           }
49910         });
49911       }
49912       delete cache.issuesByEntityID[entityID];
49913       cache.provisionalEntityIDs.delete(entityID);
49914     };
49915     cache.withAllRelatedEntities = (entityIDs) => {
49916       let result = /* @__PURE__ */ new Set();
49917       (entityIDs || []).forEach((entityID) => {
49918         result.add(entityID);
49919         const entityIssueIDs = cache.issuesByEntityID[entityID];
49920         if (entityIssueIDs) {
49921           entityIssueIDs.forEach((issueID) => {
49922             const issue = cache.issuesByIssueID[issueID];
49923             if (issue) {
49924               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
49925             } else {
49926               delete cache.issuesByIssueID[issueID];
49927             }
49928           });
49929         }
49930       });
49931       return result;
49932     };
49933     return cache;
49934   }
49935   var init_validator = __esm({
49936     "modules/core/validator.js"() {
49937       "use strict";
49938       init_src4();
49939       init_preferences();
49940       init_difference();
49941       init_extent();
49942       init_select5();
49943       init_util();
49944       init_validations();
49945     }
49946   });
49947
49948   // modules/core/uploader.js
49949   var uploader_exports = {};
49950   __export(uploader_exports, {
49951     coreUploader: () => coreUploader
49952   });
49953   function coreUploader(context) {
49954     var dispatch14 = dispatch_default(
49955       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
49956       "saveStarted",
49957       // dispatched as soon as a call to `save` has been deemed legitimate
49958       "saveEnded",
49959       // dispatched after the result event has been dispatched
49960       "willAttemptUpload",
49961       // dispatched before the actual upload call occurs, if it will
49962       "progressChanged",
49963       // Each save results in one of these outcomes:
49964       "resultNoChanges",
49965       // upload wasn't attempted since there were no edits
49966       "resultErrors",
49967       // upload failed due to errors
49968       "resultConflicts",
49969       // upload failed due to data conflicts
49970       "resultSuccess"
49971       // upload completed without errors
49972     );
49973     var _isSaving = false;
49974     let _anyConflictsAutomaticallyResolved = false;
49975     var _conflicts = [];
49976     var _errors = [];
49977     var _origChanges;
49978     var _discardTags = {};
49979     _mainFileFetcher.get("discarded").then(function(d2) {
49980       _discardTags = d2;
49981     }).catch(function() {
49982     });
49983     const uploader = {};
49984     uploader.isSaving = function() {
49985       return _isSaving;
49986     };
49987     uploader.save = function(changeset, tryAgain, checkConflicts) {
49988       if (_isSaving && !tryAgain) {
49989         return;
49990       }
49991       var osm = context.connection();
49992       if (!osm) return;
49993       if (!osm.authenticated()) {
49994         osm.authenticate(function(err) {
49995           if (!err) {
49996             uploader.save(changeset, tryAgain, checkConflicts);
49997           }
49998         });
49999         return;
50000       }
50001       if (!_isSaving) {
50002         _isSaving = true;
50003         dispatch14.call("saveStarted", this);
50004       }
50005       var history = context.history();
50006       _anyConflictsAutomaticallyResolved = false;
50007       _conflicts = [];
50008       _errors = [];
50009       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
50010       if (!tryAgain) {
50011         history.perform(actionNoop());
50012       }
50013       if (!checkConflicts) {
50014         upload(changeset);
50015       } else {
50016         performFullConflictCheck(changeset);
50017       }
50018     };
50019     function performFullConflictCheck(changeset) {
50020       var osm = context.connection();
50021       if (!osm) return;
50022       var history = context.history();
50023       var localGraph = context.graph();
50024       var remoteGraph = coreGraph(history.base(), true);
50025       var summary = history.difference().summary();
50026       var _toCheck = [];
50027       for (var i3 = 0; i3 < summary.length; i3++) {
50028         var item = summary[i3];
50029         if (item.changeType === "modified") {
50030           _toCheck.push(item.entity.id);
50031         }
50032       }
50033       var _toLoad = withChildNodes(_toCheck, localGraph);
50034       var _loaded = {};
50035       var _toLoadCount = 0;
50036       var _toLoadTotal = _toLoad.length;
50037       if (_toCheck.length) {
50038         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
50039         _toLoad.forEach(function(id2) {
50040           _loaded[id2] = false;
50041         });
50042         osm.loadMultiple(_toLoad, loaded);
50043       } else {
50044         upload(changeset);
50045       }
50046       return;
50047       function withChildNodes(ids, graph) {
50048         var s2 = new Set(ids);
50049         ids.forEach(function(id2) {
50050           var entity = graph.entity(id2);
50051           if (entity.type !== "way") return;
50052           graph.childNodes(entity).forEach(function(child) {
50053             if (child.version !== void 0) {
50054               s2.add(child.id);
50055             }
50056           });
50057         });
50058         return Array.from(s2);
50059       }
50060       function loaded(err, result) {
50061         if (_errors.length) return;
50062         if (err) {
50063           _errors.push({
50064             msg: err.message || err.responseText,
50065             details: [_t("save.status_code", { code: err.status })]
50066           });
50067           didResultInErrors();
50068         } else {
50069           var loadMore = [];
50070           result.data.forEach(function(entity) {
50071             remoteGraph.replace(entity);
50072             _loaded[entity.id] = true;
50073             _toLoad = _toLoad.filter(function(val) {
50074               return val !== entity.id;
50075             });
50076             if (!entity.visible) return;
50077             var i4, id2;
50078             if (entity.type === "way") {
50079               for (i4 = 0; i4 < entity.nodes.length; i4++) {
50080                 id2 = entity.nodes[i4];
50081                 if (_loaded[id2] === void 0) {
50082                   _loaded[id2] = false;
50083                   loadMore.push(id2);
50084                 }
50085               }
50086             } else if (entity.type === "relation" && entity.isMultipolygon()) {
50087               for (i4 = 0; i4 < entity.members.length; i4++) {
50088                 id2 = entity.members[i4].id;
50089                 if (_loaded[id2] === void 0) {
50090                   _loaded[id2] = false;
50091                   loadMore.push(id2);
50092                 }
50093               }
50094             }
50095           });
50096           _toLoadCount += result.data.length;
50097           _toLoadTotal += loadMore.length;
50098           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
50099           if (loadMore.length) {
50100             _toLoad.push.apply(_toLoad, loadMore);
50101             osm.loadMultiple(loadMore, loaded);
50102           }
50103           if (!_toLoad.length) {
50104             detectConflicts();
50105             upload(changeset);
50106           }
50107         }
50108       }
50109       function detectConflicts() {
50110         function choice(id2, text, action) {
50111           return {
50112             id: id2,
50113             text,
50114             action: function() {
50115               history.replace(action);
50116             }
50117           };
50118         }
50119         function formatUser(d2) {
50120           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
50121         }
50122         function entityName(entity) {
50123           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
50124         }
50125         function sameVersions(local, remote) {
50126           if (local.version !== remote.version) return false;
50127           if (local.type === "way") {
50128             var children2 = utilArrayUnion(local.nodes, remote.nodes);
50129             for (var i4 = 0; i4 < children2.length; i4++) {
50130               var a4 = localGraph.hasEntity(children2[i4]);
50131               var b3 = remoteGraph.hasEntity(children2[i4]);
50132               if (a4 && b3 && a4.version !== b3.version) return false;
50133             }
50134           }
50135           return true;
50136         }
50137         _toCheck.forEach(function(id2) {
50138           var local = localGraph.entity(id2);
50139           var remote = remoteGraph.entity(id2);
50140           if (sameVersions(local, remote)) return;
50141           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
50142           history.replace(merge3);
50143           var mergeConflicts = merge3.conflicts();
50144           if (!mergeConflicts.length) {
50145             _anyConflictsAutomaticallyResolved = true;
50146             return;
50147           }
50148           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
50149           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
50150           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
50151           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
50152           _conflicts.push({
50153             id: id2,
50154             name: entityName(local),
50155             details: mergeConflicts,
50156             chosen: 1,
50157             choices: [
50158               choice(id2, keepMine, forceLocal),
50159               choice(id2, keepTheirs, forceRemote)
50160             ]
50161           });
50162         });
50163       }
50164     }
50165     async function upload(changeset) {
50166       var osm = context.connection();
50167       if (!osm) {
50168         _errors.push({ msg: "No OSM Service" });
50169       }
50170       if (_conflicts.length) {
50171         didResultInConflicts(changeset);
50172       } else if (_errors.length) {
50173         didResultInErrors();
50174       } else {
50175         if (_anyConflictsAutomaticallyResolved) {
50176           changeset.tags.merge_conflict_resolved = "automatically";
50177           await osm.updateChangesetTags(changeset);
50178         }
50179         var history = context.history();
50180         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
50181         if (changes.modified.length || changes.created.length || changes.deleted.length) {
50182           dispatch14.call("willAttemptUpload", this);
50183           osm.putChangeset(changeset, changes, uploadCallback);
50184         } else {
50185           didResultInNoChanges();
50186         }
50187       }
50188     }
50189     function uploadCallback(err, changeset) {
50190       if (err) {
50191         if (err.status === 409) {
50192           uploader.save(changeset, true, true);
50193         } else {
50194           _errors.push({
50195             msg: err.message || err.responseText,
50196             details: [_t("save.status_code", { code: err.status })]
50197           });
50198           didResultInErrors();
50199         }
50200       } else {
50201         didResultInSuccess(changeset);
50202       }
50203     }
50204     function didResultInNoChanges() {
50205       dispatch14.call("resultNoChanges", this);
50206       endSave();
50207       context.flush();
50208     }
50209     function didResultInErrors() {
50210       context.history().pop();
50211       dispatch14.call("resultErrors", this, _errors);
50212       endSave();
50213     }
50214     function didResultInConflicts(changeset) {
50215       changeset.tags.merge_conflict_resolved = "manually";
50216       context.connection().updateChangesetTags(changeset);
50217       _conflicts.sort(function(a4, b3) {
50218         return b3.id.localeCompare(a4.id);
50219       });
50220       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
50221       endSave();
50222     }
50223     function didResultInSuccess(changeset) {
50224       context.history().clearSaved();
50225       dispatch14.call("resultSuccess", this, changeset);
50226       window.setTimeout(function() {
50227         endSave();
50228         context.flush();
50229       }, 2500);
50230     }
50231     function endSave() {
50232       _isSaving = false;
50233       dispatch14.call("saveEnded", this);
50234     }
50235     uploader.cancelConflictResolution = function() {
50236       context.history().pop();
50237     };
50238     uploader.processResolvedConflicts = function(changeset) {
50239       var history = context.history();
50240       for (var i3 = 0; i3 < _conflicts.length; i3++) {
50241         if (_conflicts[i3].chosen === 1) {
50242           var entity = context.hasEntity(_conflicts[i3].id);
50243           if (entity && entity.type === "way") {
50244             var children2 = utilArrayUniq(entity.nodes);
50245             for (var j3 = 0; j3 < children2.length; j3++) {
50246               history.replace(actionRevert(children2[j3]));
50247             }
50248           }
50249           history.replace(actionRevert(_conflicts[i3].id));
50250         }
50251       }
50252       uploader.save(changeset, true, false);
50253     };
50254     uploader.reset = function() {
50255     };
50256     return utilRebind(uploader, dispatch14, "on");
50257   }
50258   var init_uploader = __esm({
50259     "modules/core/uploader.js"() {
50260       "use strict";
50261       init_src4();
50262       init_lodash();
50263       init_file_fetcher();
50264       init_discard_tags();
50265       init_merge_remote_changes();
50266       init_noop2();
50267       init_revert();
50268       init_graph();
50269       init_localizer();
50270       init_util();
50271     }
50272   });
50273
50274   // modules/modes/draw_area.js
50275   var draw_area_exports = {};
50276   __export(draw_area_exports, {
50277     modeDrawArea: () => modeDrawArea
50278   });
50279   function modeDrawArea(context, wayID, startGraph, button) {
50280     var mode = {
50281       button,
50282       id: "draw-area"
50283     };
50284     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
50285       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
50286     });
50287     mode.wayID = wayID;
50288     mode.enter = function() {
50289       context.install(behavior);
50290     };
50291     mode.exit = function() {
50292       context.uninstall(behavior);
50293     };
50294     mode.selectedIDs = function() {
50295       return [wayID];
50296     };
50297     mode.activeID = function() {
50298       return behavior && behavior.activeID() || [];
50299     };
50300     return mode;
50301   }
50302   var init_draw_area = __esm({
50303     "modules/modes/draw_area.js"() {
50304       "use strict";
50305       init_localizer();
50306       init_draw_way();
50307     }
50308   });
50309
50310   // modules/modes/add_area.js
50311   var add_area_exports = {};
50312   __export(add_area_exports, {
50313     modeAddArea: () => modeAddArea
50314   });
50315   function modeAddArea(context, mode) {
50316     mode.id = "add-area";
50317     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
50318     function defaultTags(loc) {
50319       var defaultTags2 = { area: "yes" };
50320       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
50321       return defaultTags2;
50322     }
50323     function actionClose(wayId) {
50324       return function(graph) {
50325         return graph.replace(graph.entity(wayId).close());
50326       };
50327     }
50328     function start2(loc) {
50329       var startGraph = context.graph();
50330       var node = osmNode({ loc });
50331       var way = osmWay({ tags: defaultTags(loc) });
50332       context.perform(
50333         actionAddEntity(node),
50334         actionAddEntity(way),
50335         actionAddVertex(way.id, node.id),
50336         actionClose(way.id)
50337       );
50338       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50339     }
50340     function startFromWay(loc, edge) {
50341       var startGraph = context.graph();
50342       var node = osmNode({ loc });
50343       var way = osmWay({ tags: defaultTags(loc) });
50344       context.perform(
50345         actionAddEntity(node),
50346         actionAddEntity(way),
50347         actionAddVertex(way.id, node.id),
50348         actionClose(way.id),
50349         actionAddMidpoint({ loc, edge }, node)
50350       );
50351       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50352     }
50353     function startFromNode(node) {
50354       var startGraph = context.graph();
50355       var way = osmWay({ tags: defaultTags(node.loc) });
50356       context.perform(
50357         actionAddEntity(way),
50358         actionAddVertex(way.id, node.id),
50359         actionClose(way.id)
50360       );
50361       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
50362     }
50363     mode.enter = function() {
50364       context.install(behavior);
50365     };
50366     mode.exit = function() {
50367       context.uninstall(behavior);
50368     };
50369     return mode;
50370   }
50371   var init_add_area = __esm({
50372     "modules/modes/add_area.js"() {
50373       "use strict";
50374       init_add_entity();
50375       init_add_midpoint();
50376       init_add_vertex();
50377       init_add_way();
50378       init_draw_area();
50379       init_osm();
50380     }
50381   });
50382
50383   // modules/modes/add_line.js
50384   var add_line_exports = {};
50385   __export(add_line_exports, {
50386     modeAddLine: () => modeAddLine
50387   });
50388   function modeAddLine(context, mode) {
50389     mode.id = "add-line";
50390     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
50391     function defaultTags(loc) {
50392       var defaultTags2 = {};
50393       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
50394       return defaultTags2;
50395     }
50396     function start2(loc) {
50397       var startGraph = context.graph();
50398       var node = osmNode({ loc });
50399       var way = osmWay({ tags: defaultTags(loc) });
50400       context.perform(
50401         actionAddEntity(node),
50402         actionAddEntity(way),
50403         actionAddVertex(way.id, node.id)
50404       );
50405       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50406     }
50407     function startFromWay(loc, edge) {
50408       var startGraph = context.graph();
50409       var node = osmNode({ loc });
50410       var way = osmWay({ tags: defaultTags(loc) });
50411       context.perform(
50412         actionAddEntity(node),
50413         actionAddEntity(way),
50414         actionAddVertex(way.id, node.id),
50415         actionAddMidpoint({ loc, edge }, node)
50416       );
50417       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50418     }
50419     function startFromNode(node) {
50420       var startGraph = context.graph();
50421       var way = osmWay({ tags: defaultTags(node.loc) });
50422       context.perform(
50423         actionAddEntity(way),
50424         actionAddVertex(way.id, node.id)
50425       );
50426       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
50427     }
50428     mode.enter = function() {
50429       context.install(behavior);
50430     };
50431     mode.exit = function() {
50432       context.uninstall(behavior);
50433     };
50434     return mode;
50435   }
50436   var init_add_line = __esm({
50437     "modules/modes/add_line.js"() {
50438       "use strict";
50439       init_add_entity();
50440       init_add_midpoint();
50441       init_add_vertex();
50442       init_add_way();
50443       init_draw_line();
50444       init_osm();
50445     }
50446   });
50447
50448   // modules/modes/add_point.js
50449   var add_point_exports = {};
50450   __export(add_point_exports, {
50451     modeAddPoint: () => modeAddPoint
50452   });
50453   function modeAddPoint(context, mode) {
50454     mode.id = "add-point";
50455     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
50456     function defaultTags(loc) {
50457       var defaultTags2 = {};
50458       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
50459       return defaultTags2;
50460     }
50461     function add(loc) {
50462       var node = osmNode({ loc, tags: defaultTags(loc) });
50463       context.perform(
50464         actionAddEntity(node),
50465         _t("operations.add.annotation.point")
50466       );
50467       enterSelectMode(node);
50468     }
50469     function addWay(loc, edge) {
50470       var node = osmNode({ tags: defaultTags(loc) });
50471       context.perform(
50472         actionAddMidpoint({ loc, edge }, node),
50473         _t("operations.add.annotation.vertex")
50474       );
50475       enterSelectMode(node);
50476     }
50477     function enterSelectMode(node) {
50478       context.enter(
50479         modeSelect(context, [node.id]).newFeature(true)
50480       );
50481     }
50482     function addNode(node) {
50483       const _defaultTags = defaultTags(node.loc);
50484       if (Object.keys(_defaultTags).length === 0) {
50485         enterSelectMode(node);
50486         return;
50487       }
50488       var tags = Object.assign({}, node.tags);
50489       for (var key in _defaultTags) {
50490         tags[key] = _defaultTags[key];
50491       }
50492       context.perform(
50493         actionChangeTags(node.id, tags),
50494         _t("operations.add.annotation.point")
50495       );
50496       enterSelectMode(node);
50497     }
50498     function cancel() {
50499       context.enter(modeBrowse(context));
50500     }
50501     mode.enter = function() {
50502       context.install(behavior);
50503     };
50504     mode.exit = function() {
50505       context.uninstall(behavior);
50506     };
50507     return mode;
50508   }
50509   var init_add_point = __esm({
50510     "modules/modes/add_point.js"() {
50511       "use strict";
50512       init_localizer();
50513       init_draw();
50514       init_browse();
50515       init_select5();
50516       init_node2();
50517       init_add_entity();
50518       init_change_tags();
50519       init_add_midpoint();
50520     }
50521   });
50522
50523   // modules/behavior/drag.js
50524   var drag_exports = {};
50525   __export(drag_exports, {
50526     behaviorDrag: () => behaviorDrag
50527   });
50528   function behaviorDrag() {
50529     var dispatch14 = dispatch_default("start", "move", "end");
50530     var _tolerancePx = 1;
50531     var _penTolerancePx = 4;
50532     var _origin = null;
50533     var _selector = "";
50534     var _targetNode;
50535     var _targetEntity;
50536     var _surface;
50537     var _pointerId;
50538     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
50539     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
50540     var d3_event_userSelectSuppress = function() {
50541       var selection2 = selection_default();
50542       var select = selection2.style(d3_event_userSelectProperty);
50543       selection2.style(d3_event_userSelectProperty, "none");
50544       return function() {
50545         selection2.style(d3_event_userSelectProperty, select);
50546       };
50547     };
50548     function pointerdown(d3_event) {
50549       if (_pointerId) return;
50550       _pointerId = d3_event.pointerId || "mouse";
50551       _targetNode = this;
50552       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
50553       var offset;
50554       var startOrigin = pointerLocGetter(d3_event);
50555       var started = false;
50556       var selectEnable = d3_event_userSelectSuppress();
50557       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
50558       if (_origin) {
50559         offset = _origin.call(_targetNode, _targetEntity);
50560         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
50561       } else {
50562         offset = [0, 0];
50563       }
50564       d3_event.stopPropagation();
50565       function pointermove(d3_event2) {
50566         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
50567         var p2 = pointerLocGetter(d3_event2);
50568         if (!started) {
50569           var dist = geoVecLength(startOrigin, p2);
50570           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
50571           if (dist < tolerance) return;
50572           started = true;
50573           dispatch14.call("start", this, d3_event2, _targetEntity);
50574         } else {
50575           startOrigin = p2;
50576           d3_event2.stopPropagation();
50577           d3_event2.preventDefault();
50578           var dx = p2[0] - startOrigin[0];
50579           var dy = p2[1] - startOrigin[1];
50580           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
50581         }
50582       }
50583       function pointerup(d3_event2) {
50584         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
50585         _pointerId = null;
50586         if (started) {
50587           dispatch14.call("end", this, d3_event2, _targetEntity);
50588           d3_event2.preventDefault();
50589         }
50590         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
50591         selectEnable();
50592       }
50593     }
50594     function behavior(selection2) {
50595       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
50596       var delegate = pointerdown;
50597       if (_selector) {
50598         delegate = function(d3_event) {
50599           var root3 = this;
50600           var target = d3_event.target;
50601           for (; target && target !== root3; target = target.parentNode) {
50602             var datum2 = target.__data__;
50603             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
50604             if (_targetEntity && target[matchesSelector](_selector)) {
50605               return pointerdown.call(target, d3_event);
50606             }
50607           }
50608         };
50609       }
50610       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
50611     }
50612     behavior.off = function(selection2) {
50613       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
50614     };
50615     behavior.selector = function(_3) {
50616       if (!arguments.length) return _selector;
50617       _selector = _3;
50618       return behavior;
50619     };
50620     behavior.origin = function(_3) {
50621       if (!arguments.length) return _origin;
50622       _origin = _3;
50623       return behavior;
50624     };
50625     behavior.cancel = function() {
50626       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
50627       return behavior;
50628     };
50629     behavior.targetNode = function(_3) {
50630       if (!arguments.length) return _targetNode;
50631       _targetNode = _3;
50632       return behavior;
50633     };
50634     behavior.targetEntity = function(_3) {
50635       if (!arguments.length) return _targetEntity;
50636       _targetEntity = _3;
50637       return behavior;
50638     };
50639     behavior.surface = function(_3) {
50640       if (!arguments.length) return _surface;
50641       _surface = _3;
50642       return behavior;
50643     };
50644     return utilRebind(behavior, dispatch14, "on");
50645   }
50646   var init_drag2 = __esm({
50647     "modules/behavior/drag.js"() {
50648       "use strict";
50649       init_src4();
50650       init_src5();
50651       init_geo2();
50652       init_osm();
50653       init_rebind();
50654       init_util();
50655     }
50656   });
50657
50658   // modules/modes/drag_node.js
50659   var drag_node_exports = {};
50660   __export(drag_node_exports, {
50661     modeDragNode: () => modeDragNode
50662   });
50663   function modeDragNode(context) {
50664     var mode = {
50665       id: "drag-node",
50666       button: "browse"
50667     };
50668     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
50669     var edit = behaviorEdit(context);
50670     var _nudgeInterval;
50671     var _restoreSelectedIDs = [];
50672     var _wasMidpoint = false;
50673     var _isCancelled = false;
50674     var _activeEntity;
50675     var _startLoc;
50676     var _lastLoc;
50677     function startNudge(d3_event, entity, nudge) {
50678       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
50679       _nudgeInterval = window.setInterval(function() {
50680         context.map().pan(nudge);
50681         doMove(d3_event, entity, nudge);
50682       }, 50);
50683     }
50684     function stopNudge() {
50685       if (_nudgeInterval) {
50686         window.clearInterval(_nudgeInterval);
50687         _nudgeInterval = null;
50688       }
50689     }
50690     function moveAnnotation(entity) {
50691       return _t("operations.move.annotation." + entity.geometry(context.graph()));
50692     }
50693     function connectAnnotation(nodeEntity, targetEntity) {
50694       var nodeGeometry = nodeEntity.geometry(context.graph());
50695       var targetGeometry = targetEntity.geometry(context.graph());
50696       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
50697         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
50698         var targetParentWayIDs = context.graph().parentWays(targetEntity);
50699         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
50700         if (sharedParentWays.length !== 0) {
50701           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
50702             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
50703           }
50704           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
50705         }
50706       }
50707       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
50708     }
50709     function shouldSnapToNode(target) {
50710       if (!_activeEntity) return false;
50711       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
50712     }
50713     function origin(entity) {
50714       return context.projection(entity.loc);
50715     }
50716     function keydown(d3_event) {
50717       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
50718         if (context.surface().classed("nope")) {
50719           context.surface().classed("nope-suppressed", true);
50720         }
50721         context.surface().classed("nope", false).classed("nope-disabled", true);
50722       }
50723     }
50724     function keyup(d3_event) {
50725       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
50726         if (context.surface().classed("nope-suppressed")) {
50727           context.surface().classed("nope", true);
50728         }
50729         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
50730       }
50731     }
50732     function start2(d3_event, entity) {
50733       _wasMidpoint = entity.type === "midpoint";
50734       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
50735       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
50736       if (_isCancelled) {
50737         if (hasHidden) {
50738           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
50739         }
50740         return drag.cancel();
50741       }
50742       if (_wasMidpoint) {
50743         var midpoint = entity;
50744         entity = osmNode();
50745         context.perform(actionAddMidpoint(midpoint, entity));
50746         entity = context.entity(entity.id);
50747         var vertex = context.surface().selectAll("." + entity.id);
50748         drag.targetNode(vertex.node()).targetEntity(entity);
50749       } else {
50750         context.perform(actionNoop());
50751       }
50752       _activeEntity = entity;
50753       _startLoc = entity.loc;
50754       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
50755       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
50756       context.enter(mode);
50757     }
50758     function datum2(d3_event) {
50759       if (!d3_event || d3_event.altKey) {
50760         return {};
50761       } else {
50762         var d2 = d3_event.target.__data__;
50763         return d2 && d2.properties && d2.properties.target ? d2 : {};
50764       }
50765     }
50766     function doMove(d3_event, entity, nudge) {
50767       nudge = nudge || [0, 0];
50768       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
50769       var currMouse = geoVecSubtract(currPoint, nudge);
50770       var loc = context.projection.invert(currMouse);
50771       var target, edge;
50772       if (!_nudgeInterval) {
50773         var d2 = datum2(d3_event);
50774         target = d2 && d2.properties && d2.properties.entity;
50775         var targetLoc = target && target.loc;
50776         var targetNodes = d2 && d2.properties && d2.properties.nodes;
50777         if (targetLoc) {
50778           if (shouldSnapToNode(target)) {
50779             loc = targetLoc;
50780           }
50781         } else if (targetNodes) {
50782           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
50783           if (edge) {
50784             loc = edge.loc;
50785           }
50786         }
50787       }
50788       context.replace(
50789         actionMoveNode(entity.id, loc)
50790       );
50791       var isInvalid = false;
50792       if (target) {
50793         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
50794       }
50795       if (!isInvalid) {
50796         isInvalid = hasInvalidGeometry(entity, context.graph());
50797       }
50798       var nope = context.surface().classed("nope");
50799       if (isInvalid === "relation" || isInvalid === "restriction") {
50800         if (!nope) {
50801           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
50802             "operations.connect." + isInvalid,
50803             { relation: _mainPresetIndex.item("type/restriction").name() }
50804           ))();
50805         }
50806       } else if (isInvalid) {
50807         var errorID = isInvalid === "line" ? "lines" : "areas";
50808         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
50809       } else {
50810         if (nope) {
50811           context.ui().flash.duration(1).label("")();
50812         }
50813       }
50814       var nopeDisabled = context.surface().classed("nope-disabled");
50815       if (nopeDisabled) {
50816         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
50817       } else {
50818         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
50819       }
50820       _lastLoc = loc;
50821     }
50822     function hasRelationConflict(entity, target, edge, graph) {
50823       var testGraph = graph.update();
50824       if (edge) {
50825         var midpoint = osmNode();
50826         var action = actionAddMidpoint({
50827           loc: edge.loc,
50828           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
50829         }, midpoint);
50830         testGraph = action(testGraph);
50831         target = midpoint;
50832       }
50833       var ids = [entity.id, target.id];
50834       return actionConnect(ids).disabled(testGraph);
50835     }
50836     function hasInvalidGeometry(entity, graph) {
50837       var parents = graph.parentWays(entity);
50838       var i3, j3, k3;
50839       for (i3 = 0; i3 < parents.length; i3++) {
50840         var parent2 = parents[i3];
50841         var nodes = [];
50842         var activeIndex = null;
50843         var relations = graph.parentRelations(parent2);
50844         for (j3 = 0; j3 < relations.length; j3++) {
50845           if (!relations[j3].isMultipolygon()) continue;
50846           var rings = osmJoinWays(relations[j3].members, graph);
50847           for (k3 = 0; k3 < rings.length; k3++) {
50848             nodes = rings[k3].nodes;
50849             if (nodes.find(function(n3) {
50850               return n3.id === entity.id;
50851             })) {
50852               activeIndex = k3;
50853               if (geoHasSelfIntersections(nodes, entity.id)) {
50854                 return "multipolygonMember";
50855               }
50856             }
50857             rings[k3].coords = nodes.map(function(n3) {
50858               return n3.loc;
50859             });
50860           }
50861           for (k3 = 0; k3 < rings.length; k3++) {
50862             if (k3 === activeIndex) continue;
50863             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k3].nodes, entity.id)) {
50864               return "multipolygonRing";
50865             }
50866           }
50867         }
50868         if (activeIndex === null) {
50869           nodes = parent2.nodes.map(function(nodeID) {
50870             return graph.entity(nodeID);
50871           });
50872           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
50873             return parent2.geometry(graph);
50874           }
50875         }
50876       }
50877       return false;
50878     }
50879     function move(d3_event, entity, point) {
50880       if (_isCancelled) return;
50881       d3_event.stopPropagation();
50882       context.surface().classed("nope-disabled", d3_event.altKey);
50883       _lastLoc = context.projection.invert(point);
50884       doMove(d3_event, entity);
50885       var nudge = geoViewportEdge(point, context.map().dimensions());
50886       if (nudge) {
50887         startNudge(d3_event, entity, nudge);
50888       } else {
50889         stopNudge();
50890       }
50891     }
50892     function end(d3_event, entity) {
50893       if (_isCancelled) return;
50894       var wasPoint = entity.geometry(context.graph()) === "point";
50895       var d2 = datum2(d3_event);
50896       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
50897       var target = d2 && d2.properties && d2.properties.entity;
50898       if (nope) {
50899         context.perform(
50900           _actionBounceBack(entity.id, _startLoc)
50901         );
50902       } else if (target && target.type === "way") {
50903         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
50904         context.replace(
50905           actionAddMidpoint({
50906             loc: choice.loc,
50907             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
50908           }, entity),
50909           connectAnnotation(entity, target)
50910         );
50911       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
50912         context.replace(
50913           actionConnect([target.id, entity.id]),
50914           connectAnnotation(entity, target)
50915         );
50916       } else if (_wasMidpoint) {
50917         context.replace(
50918           actionNoop(),
50919           _t("operations.add.annotation.vertex")
50920         );
50921       } else {
50922         context.replace(
50923           actionNoop(),
50924           moveAnnotation(entity)
50925         );
50926       }
50927       if (wasPoint) {
50928         context.enter(modeSelect(context, [entity.id]));
50929       } else {
50930         var reselection = _restoreSelectedIDs.filter(function(id2) {
50931           return context.graph().hasEntity(id2);
50932         });
50933         if (reselection.length) {
50934           context.enter(modeSelect(context, reselection));
50935         } else {
50936           context.enter(modeBrowse(context));
50937         }
50938       }
50939     }
50940     function _actionBounceBack(nodeID, toLoc) {
50941       var moveNode = actionMoveNode(nodeID, toLoc);
50942       var action = function(graph, t2) {
50943         if (t2 === 1) context.pop();
50944         return moveNode(graph, t2);
50945       };
50946       action.transitionable = true;
50947       return action;
50948     }
50949     function cancel() {
50950       drag.cancel();
50951       context.enter(modeBrowse(context));
50952     }
50953     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);
50954     mode.enter = function() {
50955       context.install(hover);
50956       context.install(edit);
50957       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
50958       context.history().on("undone.drag-node", cancel);
50959     };
50960     mode.exit = function() {
50961       context.ui().sidebar.hover.cancel();
50962       context.uninstall(hover);
50963       context.uninstall(edit);
50964       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
50965       context.history().on("undone.drag-node", null);
50966       _activeEntity = null;
50967       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
50968       stopNudge();
50969     };
50970     mode.selectedIDs = function() {
50971       if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
50972       return mode;
50973     };
50974     mode.activeID = function() {
50975       if (!arguments.length) return _activeEntity && _activeEntity.id;
50976       return mode;
50977     };
50978     mode.restoreSelectedIDs = function(_3) {
50979       if (!arguments.length) return _restoreSelectedIDs;
50980       _restoreSelectedIDs = _3;
50981       return mode;
50982     };
50983     mode.behavior = drag;
50984     return mode;
50985   }
50986   var init_drag_node = __esm({
50987     "modules/modes/drag_node.js"() {
50988       "use strict";
50989       init_src5();
50990       init_presets();
50991       init_localizer();
50992       init_add_midpoint();
50993       init_connect();
50994       init_move_node();
50995       init_noop2();
50996       init_drag2();
50997       init_edit();
50998       init_hover();
50999       init_geo2();
51000       init_browse();
51001       init_select5();
51002       init_osm();
51003       init_util();
51004     }
51005   });
51006
51007   // modules/modes/drag_note.js
51008   var drag_note_exports = {};
51009   __export(drag_note_exports, {
51010     modeDragNote: () => modeDragNote
51011   });
51012   function modeDragNote(context) {
51013     var mode = {
51014       id: "drag-note",
51015       button: "browse"
51016     };
51017     var edit = behaviorEdit(context);
51018     var _nudgeInterval;
51019     var _lastLoc;
51020     var _note;
51021     function startNudge(d3_event, nudge) {
51022       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
51023       _nudgeInterval = window.setInterval(function() {
51024         context.map().pan(nudge);
51025         doMove(d3_event, nudge);
51026       }, 50);
51027     }
51028     function stopNudge() {
51029       if (_nudgeInterval) {
51030         window.clearInterval(_nudgeInterval);
51031         _nudgeInterval = null;
51032       }
51033     }
51034     function origin(note) {
51035       return context.projection(note.loc);
51036     }
51037     function start2(d3_event, note) {
51038       _note = note;
51039       var osm = services.osm;
51040       if (osm) {
51041         _note = osm.getNote(_note.id);
51042       }
51043       context.surface().selectAll(".note-" + _note.id).classed("active", true);
51044       context.perform(actionNoop());
51045       context.enter(mode);
51046       context.selectedNoteID(_note.id);
51047     }
51048     function move(d3_event, entity, point) {
51049       d3_event.stopPropagation();
51050       _lastLoc = context.projection.invert(point);
51051       doMove(d3_event);
51052       var nudge = geoViewportEdge(point, context.map().dimensions());
51053       if (nudge) {
51054         startNudge(d3_event, nudge);
51055       } else {
51056         stopNudge();
51057       }
51058     }
51059     function doMove(d3_event, nudge) {
51060       nudge = nudge || [0, 0];
51061       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
51062       var currMouse = geoVecSubtract(currPoint, nudge);
51063       var loc = context.projection.invert(currMouse);
51064       _note = _note.move(loc);
51065       var osm = services.osm;
51066       if (osm) {
51067         osm.replaceNote(_note);
51068       }
51069       context.replace(actionNoop());
51070     }
51071     function end() {
51072       context.replace(actionNoop());
51073       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
51074     }
51075     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);
51076     mode.enter = function() {
51077       context.install(edit);
51078     };
51079     mode.exit = function() {
51080       context.ui().sidebar.hover.cancel();
51081       context.uninstall(edit);
51082       context.surface().selectAll(".active").classed("active", false);
51083       stopNudge();
51084     };
51085     mode.behavior = drag;
51086     return mode;
51087   }
51088   var init_drag_note = __esm({
51089     "modules/modes/drag_note.js"() {
51090       "use strict";
51091       init_services();
51092       init_noop2();
51093       init_drag2();
51094       init_edit();
51095       init_geo2();
51096       init_select_note();
51097     }
51098   });
51099
51100   // modules/ui/data_header.js
51101   var data_header_exports = {};
51102   __export(data_header_exports, {
51103     uiDataHeader: () => uiDataHeader
51104   });
51105   function uiDataHeader() {
51106     var _datum;
51107     function dataHeader(selection2) {
51108       var header = selection2.selectAll(".data-header").data(
51109         _datum ? [_datum] : [],
51110         function(d2) {
51111           return d2.__featurehash__;
51112         }
51113       );
51114       header.exit().remove();
51115       var headerEnter = header.enter().append("div").attr("class", "data-header");
51116       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
51117       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
51118       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
51119     }
51120     dataHeader.datum = function(val) {
51121       if (!arguments.length) return _datum;
51122       _datum = val;
51123       return this;
51124     };
51125     return dataHeader;
51126   }
51127   var init_data_header = __esm({
51128     "modules/ui/data_header.js"() {
51129       "use strict";
51130       init_localizer();
51131       init_icon();
51132     }
51133   });
51134
51135   // modules/ui/combobox.js
51136   var combobox_exports = {};
51137   __export(combobox_exports, {
51138     uiCombobox: () => uiCombobox
51139   });
51140   function uiCombobox(context, klass) {
51141     var dispatch14 = dispatch_default("accept", "cancel", "update");
51142     var container = context.container();
51143     var _suggestions = [];
51144     var _data = [];
51145     var _fetched = {};
51146     var _selected = null;
51147     var _canAutocomplete = true;
51148     var _caseSensitive = false;
51149     var _cancelFetch = false;
51150     var _minItems = 2;
51151     var _tDown = 0;
51152     var _mouseEnterHandler, _mouseLeaveHandler;
51153     var _fetcher = function(val, cb) {
51154       cb(_data.filter(function(d2) {
51155         var terms = d2.terms || [];
51156         terms.push(d2.value);
51157         if (d2.key) {
51158           terms.push(d2.key);
51159         }
51160         return terms.some(function(term) {
51161           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
51162         });
51163       }));
51164     };
51165     var combobox = function(input, attachTo) {
51166       if (!input || input.empty()) return;
51167       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() {
51168         var parent2 = this.parentNode;
51169         var sibling = this.nextSibling;
51170         select_default2(parent2).selectAll(".combobox-caret").filter(function(d2) {
51171           return d2 === input.node();
51172         }).data([input.node()]).enter().insert("div", function() {
51173           return sibling;
51174         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
51175           d3_event.preventDefault();
51176           input.node().focus();
51177           mousedown(d3_event);
51178         }).on("mouseup.combo-caret", function(d3_event) {
51179           d3_event.preventDefault();
51180           mouseup(d3_event);
51181         });
51182       });
51183       function mousedown(d3_event) {
51184         if (d3_event.button !== 0) return;
51185         if (input.classed("disabled")) return;
51186         _tDown = +/* @__PURE__ */ new Date();
51187         var start2 = input.property("selectionStart");
51188         var end = input.property("selectionEnd");
51189         if (start2 !== end) {
51190           var val = utilGetSetValue(input);
51191           input.node().setSelectionRange(val.length, val.length);
51192           return;
51193         }
51194         input.on("mouseup.combo-input", mouseup);
51195       }
51196       function mouseup(d3_event) {
51197         input.on("mouseup.combo-input", null);
51198         if (d3_event.button !== 0) return;
51199         if (input.classed("disabled")) return;
51200         if (input.node() !== document.activeElement) return;
51201         var start2 = input.property("selectionStart");
51202         var end = input.property("selectionEnd");
51203         if (start2 !== end) return;
51204         var combo = container.selectAll(".combobox");
51205         if (combo.empty() || combo.datum() !== input.node()) {
51206           var tOrig = _tDown;
51207           window.setTimeout(function() {
51208             if (tOrig !== _tDown) return;
51209             fetchComboData("", function() {
51210               show();
51211               render();
51212             });
51213           }, 250);
51214         } else {
51215           hide();
51216         }
51217       }
51218       function focus() {
51219         fetchComboData("");
51220       }
51221       function blur() {
51222         _comboHideTimerID = window.setTimeout(hide, 75);
51223       }
51224       function show() {
51225         hide();
51226         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) {
51227           d3_event.preventDefault();
51228         });
51229         container.on("scroll.combo-scroll", render, true);
51230       }
51231       function hide() {
51232         _hide(container);
51233       }
51234       function keydown(d3_event) {
51235         var shown = !container.selectAll(".combobox").empty();
51236         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
51237         switch (d3_event.keyCode) {
51238           case 8:
51239           // ⌫ Backspace
51240           case 46:
51241             d3_event.stopPropagation();
51242             _selected = null;
51243             render();
51244             input.on("input.combo-input", function() {
51245               var start2 = input.property("selectionStart");
51246               input.node().setSelectionRange(start2, start2);
51247               input.on("input.combo-input", change);
51248               change(false);
51249             });
51250             break;
51251           case 9:
51252             accept(d3_event);
51253             break;
51254           case 13:
51255             d3_event.preventDefault();
51256             d3_event.stopPropagation();
51257             accept(d3_event);
51258             break;
51259           case 38:
51260             if (tagName === "textarea" && !shown) return;
51261             d3_event.preventDefault();
51262             if (tagName === "input" && !shown) {
51263               show();
51264             }
51265             nav(-1);
51266             break;
51267           case 40:
51268             if (tagName === "textarea" && !shown) return;
51269             d3_event.preventDefault();
51270             if (tagName === "input" && !shown) {
51271               show();
51272             }
51273             nav(1);
51274             break;
51275         }
51276       }
51277       function keyup(d3_event) {
51278         switch (d3_event.keyCode) {
51279           case 27:
51280             cancel();
51281             break;
51282         }
51283       }
51284       function change(doAutoComplete) {
51285         if (doAutoComplete === void 0) doAutoComplete = true;
51286         fetchComboData(value(), function(skipAutosuggest) {
51287           _selected = null;
51288           var val = input.property("value");
51289           if (_suggestions.length) {
51290             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
51291               _selected = tryAutocomplete();
51292             }
51293             if (!_selected) {
51294               _selected = val;
51295             }
51296           }
51297           if (val.length) {
51298             var combo = container.selectAll(".combobox");
51299             if (combo.empty()) {
51300               show();
51301             }
51302           } else {
51303             hide();
51304           }
51305           render();
51306         });
51307       }
51308       function nav(dir) {
51309         if (_suggestions.length) {
51310           var index = -1;
51311           for (var i3 = 0; i3 < _suggestions.length; i3++) {
51312             if (_selected && _suggestions[i3].value === _selected) {
51313               index = i3;
51314               break;
51315             }
51316           }
51317           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
51318           _selected = _suggestions[index].value;
51319           utilGetSetValue(input, _selected);
51320           dispatch14.call("update");
51321         }
51322         render();
51323         ensureVisible();
51324       }
51325       function ensureVisible() {
51326         var _a4;
51327         var combo = container.selectAll(".combobox");
51328         if (combo.empty()) return;
51329         var containerRect = container.node().getBoundingClientRect();
51330         var comboRect = combo.node().getBoundingClientRect();
51331         if (comboRect.bottom > containerRect.bottom) {
51332           var node = attachTo ? attachTo.node() : input.node();
51333           node.scrollIntoView({ behavior: "instant", block: "center" });
51334           render();
51335         }
51336         var selected = combo.selectAll(".combobox-option.selected").node();
51337         if (selected) {
51338           (_a4 = selected.scrollIntoView) == null ? void 0 : _a4.call(selected, { behavior: "smooth", block: "nearest" });
51339         }
51340       }
51341       function value() {
51342         var value2 = input.property("value");
51343         var start2 = input.property("selectionStart");
51344         var end = input.property("selectionEnd");
51345         if (start2 && end) {
51346           value2 = value2.substring(0, start2);
51347         }
51348         return value2;
51349       }
51350       function fetchComboData(v3, cb) {
51351         _cancelFetch = false;
51352         _fetcher.call(input, v3, function(results, skipAutosuggest) {
51353           if (_cancelFetch) return;
51354           _suggestions = results;
51355           results.forEach(function(d2) {
51356             _fetched[d2.value] = d2;
51357           });
51358           if (cb) {
51359             cb(skipAutosuggest);
51360           }
51361         });
51362       }
51363       function tryAutocomplete() {
51364         if (!_canAutocomplete) return;
51365         var val = _caseSensitive ? value() : value().toLowerCase();
51366         if (!val) return;
51367         if (isFinite(val)) return;
51368         const suggestionValues = [];
51369         _suggestions.forEach((s2) => {
51370           suggestionValues.push(s2.value);
51371           if (s2.key && s2.key !== s2.value) {
51372             suggestionValues.push(s2.key);
51373           }
51374         });
51375         var bestIndex = -1;
51376         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
51377           var suggestion = suggestionValues[i3];
51378           var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
51379           if (compare2 === val) {
51380             bestIndex = i3;
51381             break;
51382           } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
51383             bestIndex = i3;
51384           }
51385         }
51386         if (bestIndex !== -1) {
51387           var bestVal = suggestionValues[bestIndex];
51388           input.property("value", bestVal);
51389           input.node().setSelectionRange(val.length, bestVal.length);
51390           dispatch14.call("update");
51391           return bestVal;
51392         }
51393       }
51394       function render() {
51395         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
51396           hide();
51397           return;
51398         }
51399         var shown = !container.selectAll(".combobox").empty();
51400         if (!shown) return;
51401         var combo = container.selectAll(".combobox");
51402         var options = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
51403           return d2.value;
51404         });
51405         options.exit().remove();
51406         options.enter().append("a").attr("class", function(d2) {
51407           return "combobox-option " + (d2.klass || "");
51408         }).attr("title", function(d2) {
51409           return d2.title;
51410         }).each(function(d2) {
51411           if (d2.display) {
51412             d2.display(select_default2(this));
51413           } else {
51414             select_default2(this).text(d2.value);
51415           }
51416         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options).classed("selected", function(d2) {
51417           return d2.value === _selected || d2.key === _selected;
51418         }).on("click.combo-option", accept).order();
51419         var node = attachTo ? attachTo.node() : input.node();
51420         var containerRect = container.node().getBoundingClientRect();
51421         var rect = node.getBoundingClientRect();
51422         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
51423       }
51424       function accept(d3_event, d2) {
51425         _cancelFetch = true;
51426         var thiz = input.node();
51427         if (d2) {
51428           utilGetSetValue(input, d2.value);
51429           utilTriggerEvent(input, "change");
51430         }
51431         var val = utilGetSetValue(input);
51432         thiz.setSelectionRange(val.length, val.length);
51433         if (!d2) {
51434           d2 = _fetched[val];
51435         }
51436         dispatch14.call("accept", thiz, d2, val);
51437         hide();
51438       }
51439       function cancel() {
51440         _cancelFetch = true;
51441         var thiz = input.node();
51442         var val = utilGetSetValue(input);
51443         var start2 = input.property("selectionStart");
51444         var end = input.property("selectionEnd");
51445         val = val.slice(0, start2) + val.slice(end);
51446         utilGetSetValue(input, val);
51447         thiz.setSelectionRange(val.length, val.length);
51448         dispatch14.call("cancel", thiz);
51449         hide();
51450       }
51451     };
51452     combobox.canAutocomplete = function(val) {
51453       if (!arguments.length) return _canAutocomplete;
51454       _canAutocomplete = val;
51455       return combobox;
51456     };
51457     combobox.caseSensitive = function(val) {
51458       if (!arguments.length) return _caseSensitive;
51459       _caseSensitive = val;
51460       return combobox;
51461     };
51462     combobox.data = function(val) {
51463       if (!arguments.length) return _data;
51464       _data = val;
51465       return combobox;
51466     };
51467     combobox.fetcher = function(val) {
51468       if (!arguments.length) return _fetcher;
51469       _fetcher = val;
51470       return combobox;
51471     };
51472     combobox.minItems = function(val) {
51473       if (!arguments.length) return _minItems;
51474       _minItems = val;
51475       return combobox;
51476     };
51477     combobox.itemsMouseEnter = function(val) {
51478       if (!arguments.length) return _mouseEnterHandler;
51479       _mouseEnterHandler = val;
51480       return combobox;
51481     };
51482     combobox.itemsMouseLeave = function(val) {
51483       if (!arguments.length) return _mouseLeaveHandler;
51484       _mouseLeaveHandler = val;
51485       return combobox;
51486     };
51487     return utilRebind(combobox, dispatch14, "on");
51488   }
51489   function _hide(container) {
51490     if (_comboHideTimerID) {
51491       window.clearTimeout(_comboHideTimerID);
51492       _comboHideTimerID = void 0;
51493     }
51494     container.selectAll(".combobox").remove();
51495     container.on("scroll.combo-scroll", null);
51496   }
51497   var _comboHideTimerID;
51498   var init_combobox = __esm({
51499     "modules/ui/combobox.js"() {
51500       "use strict";
51501       init_src4();
51502       init_src5();
51503       init_util();
51504       uiCombobox.off = function(input, context) {
51505         _hide(context.container());
51506         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);
51507         context.container().on("scroll.combo-scroll", null);
51508       };
51509     }
51510   });
51511
51512   // modules/ui/toggle.js
51513   var toggle_exports = {};
51514   __export(toggle_exports, {
51515     uiToggle: () => uiToggle
51516   });
51517   function uiToggle(show, callback) {
51518     return function(selection2) {
51519       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
51520         select_default2(this).classed("hide", !show).style("opacity", null);
51521         if (callback) callback.apply(this);
51522       });
51523     };
51524   }
51525   var init_toggle = __esm({
51526     "modules/ui/toggle.js"() {
51527       "use strict";
51528       init_src5();
51529     }
51530   });
51531
51532   // modules/ui/disclosure.js
51533   var disclosure_exports = {};
51534   __export(disclosure_exports, {
51535     uiDisclosure: () => uiDisclosure
51536   });
51537   function uiDisclosure(context, key, expandedDefault) {
51538     var dispatch14 = dispatch_default("toggled");
51539     var _expanded;
51540     var _label = utilFunctor("");
51541     var _updatePreference = true;
51542     var _content = function() {
51543     };
51544     var disclosure = function(selection2) {
51545       if (_expanded === void 0 || _expanded === null) {
51546         var preference = corePreferences("disclosure." + key + ".expanded");
51547         _expanded = preference === null ? !!expandedDefault : preference === "true";
51548       }
51549       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
51550       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"));
51551       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
51552       hideToggle = hideToggleEnter.merge(hideToggle);
51553       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
51554       const label = _label();
51555       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
51556       if (typeof label !== "function") {
51557         labelSelection.text(_label());
51558       } else {
51559         labelSelection.text("").call(label);
51560       }
51561       hideToggle.selectAll(".hide-toggle-icon").attr(
51562         "xlink:href",
51563         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
51564       );
51565       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
51566       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
51567       if (_expanded) {
51568         wrap2.call(_content);
51569       }
51570       function toggle(d3_event) {
51571         d3_event.preventDefault();
51572         _expanded = !_expanded;
51573         if (_updatePreference) {
51574           corePreferences("disclosure." + key + ".expanded", _expanded);
51575         }
51576         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
51577         hideToggle.selectAll(".hide-toggle-icon").attr(
51578           "xlink:href",
51579           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
51580         );
51581         wrap2.call(uiToggle(_expanded));
51582         if (_expanded) {
51583           wrap2.call(_content);
51584         }
51585         dispatch14.call("toggled", this, _expanded);
51586       }
51587     };
51588     disclosure.label = function(val) {
51589       if (!arguments.length) return _label;
51590       _label = utilFunctor(val);
51591       return disclosure;
51592     };
51593     disclosure.expanded = function(val) {
51594       if (!arguments.length) return _expanded;
51595       _expanded = val;
51596       return disclosure;
51597     };
51598     disclosure.updatePreference = function(val) {
51599       if (!arguments.length) return _updatePreference;
51600       _updatePreference = val;
51601       return disclosure;
51602     };
51603     disclosure.content = function(val) {
51604       if (!arguments.length) return _content;
51605       _content = val;
51606       return disclosure;
51607     };
51608     return utilRebind(disclosure, dispatch14, "on");
51609   }
51610   var init_disclosure = __esm({
51611     "modules/ui/disclosure.js"() {
51612       "use strict";
51613       init_src4();
51614       init_preferences();
51615       init_icon();
51616       init_util();
51617       init_rebind();
51618       init_toggle();
51619       init_localizer();
51620     }
51621   });
51622
51623   // modules/ui/section.js
51624   var section_exports = {};
51625   __export(section_exports, {
51626     uiSection: () => uiSection
51627   });
51628   function uiSection(id2, context) {
51629     var _classes = utilFunctor("");
51630     var _shouldDisplay;
51631     var _content;
51632     var _disclosure;
51633     var _label;
51634     var _expandedByDefault = utilFunctor(true);
51635     var _disclosureContent;
51636     var _disclosureExpanded;
51637     var _containerSelection = select_default2(null);
51638     var section = {
51639       id: id2
51640     };
51641     section.classes = function(val) {
51642       if (!arguments.length) return _classes;
51643       _classes = utilFunctor(val);
51644       return section;
51645     };
51646     section.label = function(val) {
51647       if (!arguments.length) return _label;
51648       _label = utilFunctor(val);
51649       return section;
51650     };
51651     section.expandedByDefault = function(val) {
51652       if (!arguments.length) return _expandedByDefault;
51653       _expandedByDefault = utilFunctor(val);
51654       return section;
51655     };
51656     section.shouldDisplay = function(val) {
51657       if (!arguments.length) return _shouldDisplay;
51658       _shouldDisplay = utilFunctor(val);
51659       return section;
51660     };
51661     section.content = function(val) {
51662       if (!arguments.length) return _content;
51663       _content = val;
51664       return section;
51665     };
51666     section.disclosureContent = function(val) {
51667       if (!arguments.length) return _disclosureContent;
51668       _disclosureContent = val;
51669       return section;
51670     };
51671     section.disclosureExpanded = function(val) {
51672       if (!arguments.length) return _disclosureExpanded;
51673       _disclosureExpanded = val;
51674       return section;
51675     };
51676     section.render = function(selection2) {
51677       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
51678       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
51679       _containerSelection = sectionEnter.merge(_containerSelection);
51680       _containerSelection.call(renderContent);
51681     };
51682     section.reRender = function() {
51683       _containerSelection.call(renderContent);
51684     };
51685     section.selection = function() {
51686       return _containerSelection;
51687     };
51688     section.disclosure = function() {
51689       return _disclosure;
51690     };
51691     function renderContent(selection2) {
51692       if (_shouldDisplay) {
51693         var shouldDisplay = _shouldDisplay();
51694         selection2.classed("hide", !shouldDisplay);
51695         if (!shouldDisplay) {
51696           selection2.html("");
51697           return;
51698         }
51699       }
51700       if (_disclosureContent) {
51701         if (!_disclosure) {
51702           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
51703         }
51704         if (_disclosureExpanded !== void 0) {
51705           _disclosure.expanded(_disclosureExpanded);
51706           _disclosureExpanded = void 0;
51707         }
51708         selection2.call(_disclosure);
51709         return;
51710       }
51711       if (_content) {
51712         selection2.call(_content);
51713       }
51714     }
51715     return section;
51716   }
51717   var init_section = __esm({
51718     "modules/ui/section.js"() {
51719       "use strict";
51720       init_src5();
51721       init_disclosure();
51722       init_util();
51723     }
51724   });
51725
51726   // modules/ui/tag_reference.js
51727   var tag_reference_exports = {};
51728   __export(tag_reference_exports, {
51729     uiTagReference: () => uiTagReference
51730   });
51731   function uiTagReference(what) {
51732     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
51733     var tagReference = {};
51734     var _button = select_default2(null);
51735     var _body = select_default2(null);
51736     var _loaded;
51737     var _showing;
51738     function load() {
51739       if (!wikibase) return;
51740       _button.classed("tag-reference-loading", true);
51741       wikibase.getDocs(what, gotDocs);
51742     }
51743     function gotDocs(err, docs) {
51744       _body.html("");
51745       if (!docs || !docs.title) {
51746         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
51747         done();
51748         return;
51749       }
51750       if (docs.imageURL) {
51751         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.title).attr("src", docs.imageURL).on("load", function() {
51752           done();
51753         }).on("error", function() {
51754           select_default2(this).remove();
51755           done();
51756         });
51757       } else {
51758         done();
51759       }
51760       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
51761       if (docs.description) {
51762         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").call(docs.description);
51763       } else {
51764         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
51765       }
51766       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"));
51767       if (docs.wiki) {
51768         _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));
51769       }
51770       if (what.key === "comment") {
51771         _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"));
51772       }
51773     }
51774     function done() {
51775       _loaded = true;
51776       _button.classed("tag-reference-loading", false);
51777       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
51778       _showing = true;
51779       _button.selectAll("svg.icon use").each(function() {
51780         var iconUse = select_default2(this);
51781         if (iconUse.attr("href") === "#iD-icon-info") {
51782           iconUse.attr("href", "#iD-icon-info-filled");
51783         }
51784       });
51785     }
51786     function hide() {
51787       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
51788         _body.classed("expanded", false);
51789       });
51790       _showing = false;
51791       _button.selectAll("svg.icon use").each(function() {
51792         var iconUse = select_default2(this);
51793         if (iconUse.attr("href") === "#iD-icon-info-filled") {
51794           iconUse.attr("href", "#iD-icon-info");
51795         }
51796       });
51797     }
51798     tagReference.button = function(selection2, klass, iconName) {
51799       _button = selection2.selectAll(".tag-reference-button").data([0]);
51800       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
51801       _button.on("click", function(d3_event) {
51802         d3_event.stopPropagation();
51803         d3_event.preventDefault();
51804         this.blur();
51805         if (_showing) {
51806           hide();
51807         } else if (_loaded) {
51808           done();
51809         } else {
51810           load();
51811         }
51812       });
51813     };
51814     tagReference.body = function(selection2) {
51815       var itemID = what.qid || what.key + "-" + (what.value || "");
51816       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
51817         return d2;
51818       });
51819       _body.exit().remove();
51820       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
51821       if (_showing === false) {
51822         hide();
51823       }
51824     };
51825     tagReference.showing = function(val) {
51826       if (!arguments.length) return _showing;
51827       _showing = val;
51828       return tagReference;
51829     };
51830     return tagReference;
51831   }
51832   var init_tag_reference = __esm({
51833     "modules/ui/tag_reference.js"() {
51834       "use strict";
51835       init_src5();
51836       init_localizer();
51837       init_services();
51838       init_icon();
51839     }
51840   });
51841
51842   // modules/ui/sections/raw_tag_editor.js
51843   var raw_tag_editor_exports = {};
51844   __export(raw_tag_editor_exports, {
51845     uiSectionRawTagEditor: () => uiSectionRawTagEditor
51846   });
51847   function uiSectionRawTagEditor(id2, context) {
51848     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
51849       var count = Object.keys(_tags).filter(function(d2) {
51850         return d2;
51851       }).length;
51852       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
51853     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
51854     var taginfo = services.taginfo;
51855     var dispatch14 = dispatch_default("change");
51856     var availableViews = [
51857       { id: "list", icon: "#fas-th-list" },
51858       { id: "text", icon: "#fas-i-cursor" }
51859     ];
51860     let _discardTags = {};
51861     _mainFileFetcher.get("discarded").then((d2) => {
51862       _discardTags = d2;
51863     }).catch(() => {
51864     });
51865     var _tagView = corePreferences("raw-tag-editor-view") || "list";
51866     var _readOnlyTags = [];
51867     var _orderedKeys = [];
51868     var _pendingChange = null;
51869     var _state;
51870     var _presets;
51871     var _tags;
51872     var _entityIDs;
51873     var _didInteract = false;
51874     function interacted() {
51875       _didInteract = true;
51876     }
51877     function renderDisclosureContent(wrap2) {
51878       _orderedKeys = _orderedKeys.filter(function(key) {
51879         return _tags[key] !== void 0;
51880       });
51881       var all = Object.keys(_tags).sort();
51882       var missingKeys = utilArrayDifference(all, _orderedKeys);
51883       for (var i3 in missingKeys) {
51884         _orderedKeys.push(missingKeys[i3]);
51885       }
51886       var rowData = _orderedKeys.map(function(key, i4) {
51887         return { index: i4, key, value: _tags[key] };
51888       });
51889       rowData.push({ index: rowData.length, key: "", value: "" });
51890       var options = wrap2.selectAll(".raw-tag-options").data([0]);
51891       options.exit().remove();
51892       var optionsEnter = options.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
51893       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
51894         return d2.id;
51895       }).enter();
51896       optionEnter.append("button").attr("class", function(d2) {
51897         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
51898       }).attr("aria-selected", function(d2) {
51899         return _tagView === d2.id;
51900       }).attr("role", "tab").attr("title", function(d2) {
51901         return _t("icons." + d2.id);
51902       }).on("click", function(d3_event, d2) {
51903         _tagView = d2.id;
51904         corePreferences("raw-tag-editor-view", d2.id);
51905         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
51906           return datum2 === d2;
51907         }).attr("aria-selected", function(datum2) {
51908           return datum2 === d2;
51909         });
51910         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
51911         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
51912       }).each(function(d2) {
51913         select_default2(this).call(svgIcon(d2.icon));
51914       });
51915       var textData = rowsToText(rowData);
51916       var textarea = wrap2.selectAll(".tag-text").data([0]);
51917       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);
51918       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
51919       var list = wrap2.selectAll(".tag-list").data([0]);
51920       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
51921       var items = list.selectAll(".tag-row").data(rowData, function(d2) {
51922         return d2.key;
51923       });
51924       items.exit().each(unbind).remove();
51925       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
51926       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
51927       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);
51928       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);
51929       innerWrap.append("button").attr("tabindex", -1).attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
51930       items = items.merge(itemsEnter).sort(function(a4, b3) {
51931         return a4.index - b3.index;
51932       });
51933       items.classed("add-tag", (d2) => d2.key === "").each(function(d2) {
51934         var row = select_default2(this);
51935         var key = row.select("input.key");
51936         var value = row.select("input.value");
51937         if (_entityIDs && taginfo && _state !== "hover") {
51938           bindTypeahead(key, value);
51939         }
51940         var referenceOptions = { key: d2.key };
51941         if (typeof d2.value === "string") {
51942           referenceOptions.value = d2.value;
51943         }
51944         var reference = uiTagReference(referenceOptions, context);
51945         if (_state === "hover") {
51946           reference.showing(false);
51947         }
51948         row.select(".inner-wrap").call(reference.button).select(".tag-reference-button").attr("tabindex", -1).classed("disabled", (d4) => d4.key === "");
51949         row.call(reference.body);
51950         row.select("button.remove");
51951       });
51952       items.selectAll("input.key").attr("title", function(d2) {
51953         return d2.key;
51954       }).attr("readonly", function(d2) {
51955         return isReadOnly(d2) || null;
51956       }).call(
51957         utilGetSetValue,
51958         (d2) => d2.key,
51959         (_3, newKey) => _pendingChange === null || isEmpty_default(_pendingChange) || _pendingChange[newKey]
51960         // if there are pending changes: skip untouched keys
51961       );
51962       items.selectAll("input.value").attr("title", function(d2) {
51963         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
51964       }).classed("mixed", function(d2) {
51965         return Array.isArray(d2.value);
51966       }).attr("placeholder", function(d2) {
51967         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
51968       }).attr("readonly", function(d2) {
51969         return isReadOnly(d2) || null;
51970       }).call(
51971         utilGetSetValue,
51972         (d2) => {
51973           if (_pendingChange !== null && !isEmpty_default(_pendingChange) && !_pendingChange[d2.value]) {
51974             return null;
51975           }
51976           return typeof d2.value === "string" ? d2.value : "";
51977         },
51978         (_3, newValue) => newValue !== null
51979       );
51980       items.selectAll("button.remove").classed("disabled", (d2) => d2.key === "").on(
51981         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
51982         // 'click' fires too late - #5878
51983         (d3_event, d2) => {
51984           if (d3_event.button !== 0) return;
51985           removeTag(d3_event, d2);
51986         }
51987       );
51988     }
51989     function isReadOnly(d2) {
51990       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
51991         if (d2.key.match(_readOnlyTags[i3]) !== null) {
51992           return true;
51993         }
51994       }
51995       return false;
51996     }
51997     function setTextareaHeight() {
51998       if (_tagView !== "text") return;
51999       var selection2 = select_default2(this);
52000       var matches = selection2.node().value.match(/\n/g);
52001       var lineCount = 2 + Number(matches && matches.length);
52002       var lineHeight = 20;
52003       selection2.style("height", lineCount * lineHeight + "px");
52004     }
52005     function stringify3(s2) {
52006       const stringified = JSON.stringify(s2).slice(1, -1);
52007       if (stringified !== s2) {
52008         return `"${stringified}"`;
52009       } else {
52010         return s2;
52011       }
52012     }
52013     function unstringify(s2) {
52014       const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
52015       if (isQuoted) {
52016         try {
52017           return JSON.parse(s2);
52018         } catch {
52019           return s2;
52020         }
52021       } else {
52022         return s2;
52023       }
52024     }
52025     function rowsToText(rows) {
52026       var str = rows.filter(function(row) {
52027         return row.key && row.key.trim() !== "";
52028       }).map(function(row) {
52029         var rawVal = row.value;
52030         if (typeof rawVal !== "string") rawVal = "*";
52031         var val = rawVal ? stringify3(rawVal) : "";
52032         return stringify3(row.key) + "=" + val;
52033       }).join("\n");
52034       if (_state !== "hover" && str.length) {
52035         return str + "\n";
52036       }
52037       return str;
52038     }
52039     function textChanged() {
52040       var newText = this.value.trim();
52041       var newTags = {};
52042       newText.split("\n").forEach(function(row) {
52043         var m3 = row.match(/^\s*([^=]+)=(.*)$/);
52044         if (m3 !== null) {
52045           var k3 = context.cleanTagKey(unstringify(m3[1].trim()));
52046           var v3 = context.cleanTagValue(unstringify(m3[2].trim()));
52047           newTags[k3] = v3;
52048         }
52049       });
52050       var tagDiff = utilTagDiff(_tags, newTags);
52051       _pendingChange = _pendingChange || {};
52052       tagDiff.forEach(function(change) {
52053         if (isReadOnly({ key: change.key })) return;
52054         if (change.newVal === "*" && typeof change.oldVal !== "string") return;
52055         if (change.type === "-") {
52056           _pendingChange[change.key] = void 0;
52057         } else if (change.type === "+") {
52058           _pendingChange[change.key] = change.newVal || "";
52059         }
52060       });
52061       if (isEmpty_default(_pendingChange)) {
52062         _pendingChange = null;
52063         section.reRender();
52064         return;
52065       }
52066       scheduleChange();
52067     }
52068     function bindTypeahead(key, value) {
52069       if (isReadOnly(key.datum())) return;
52070       if (Array.isArray(value.datum().value)) {
52071         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
52072           var keyString = utilGetSetValue(key);
52073           if (!_tags[keyString]) return;
52074           var data = _tags[keyString].map(function(tagValue) {
52075             if (!tagValue) {
52076               return {
52077                 value: " ",
52078                 title: _t("inspector.empty"),
52079                 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
52080               };
52081             }
52082             return {
52083               value: tagValue,
52084               title: tagValue
52085             };
52086           });
52087           callback(data);
52088         }));
52089         return;
52090       }
52091       var geometry = context.graph().geometry(_entityIDs[0]);
52092       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
52093         taginfo.keys({
52094           debounce: true,
52095           geometry,
52096           query: value2
52097         }, function(err, data) {
52098           if (!err) {
52099             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => !/_\d$/.test(d2)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
52100             callback(sort(value2, filtered));
52101           }
52102         });
52103       }));
52104       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
52105         taginfo.values({
52106           debounce: true,
52107           key: utilGetSetValue(key),
52108           geometry,
52109           query: value2
52110         }, function(err, data) {
52111           if (!err) {
52112             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
52113             callback(sort(value2, filtered));
52114           }
52115         });
52116       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
52117       function sort(value2, data) {
52118         var sameletter = [];
52119         var other = [];
52120         for (var i3 = 0; i3 < data.length; i3++) {
52121           if (data[i3].value.substring(0, value2.length) === value2) {
52122             sameletter.push(data[i3]);
52123           } else {
52124             other.push(data[i3]);
52125           }
52126         }
52127         return sameletter.concat(other);
52128       }
52129     }
52130     function unbind() {
52131       var row = select_default2(this);
52132       row.selectAll("input.key").call(uiCombobox.off, context);
52133       row.selectAll("input.value").call(uiCombobox.off, context);
52134     }
52135     function keyChange(d3_event, d2) {
52136       if (select_default2(this).attr("readonly")) return;
52137       var kOld = d2.key;
52138       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
52139       var kNew = context.cleanTagKey(this.value.trim());
52140       if (isReadOnly({ key: kNew })) {
52141         this.value = kOld;
52142         return;
52143       }
52144       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
52145         this.value = kOld;
52146         section.selection().selectAll(".tag-list input.value").each(function(d4) {
52147           if (d4.key === kNew) {
52148             var input = select_default2(this).node();
52149             input.focus();
52150             input.select();
52151           }
52152         });
52153         return;
52154       }
52155       _pendingChange = _pendingChange || {};
52156       if (kOld) {
52157         if (kOld === kNew) return;
52158         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
52159         _pendingChange[kOld] = void 0;
52160       } else {
52161         let row = this.parentNode.parentNode;
52162         let inputVal = select_default2(row).selectAll("input.value");
52163         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
52164         _pendingChange[kNew] = vNew;
52165         utilGetSetValue(inputVal, vNew);
52166       }
52167       var existingKeyIndex = _orderedKeys.indexOf(kOld);
52168       if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
52169       d2.key = kNew;
52170       this.value = kNew;
52171       scheduleChange();
52172     }
52173     function valueChange(d3_event, d2) {
52174       if (isReadOnly(d2)) return;
52175       if (typeof d2.value !== "string" && !this.value) return;
52176       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
52177       _pendingChange = _pendingChange || {};
52178       _pendingChange[d2.key] = context.cleanTagValue(this.value);
52179       scheduleChange();
52180     }
52181     function removeTag(d3_event, d2) {
52182       if (isReadOnly(d2)) return;
52183       _orderedKeys = _orderedKeys.filter(function(key) {
52184         return key !== d2.key;
52185       });
52186       _pendingChange = _pendingChange || {};
52187       _pendingChange[d2.key] = void 0;
52188       scheduleChange();
52189     }
52190     function scheduleChange() {
52191       if (!_pendingChange) return;
52192       for (const key in _pendingChange) {
52193         _tags[key] = _pendingChange[key];
52194       }
52195       dispatch14.call("change", this, _entityIDs, _pendingChange);
52196       _pendingChange = null;
52197     }
52198     section.state = function(val) {
52199       if (!arguments.length) return _state;
52200       if (_state !== val) {
52201         _orderedKeys = [];
52202         _state = val;
52203       }
52204       return section;
52205     };
52206     section.presets = function(val) {
52207       if (!arguments.length) return _presets;
52208       _presets = val;
52209       if (_presets && _presets.length && _presets[0].isFallback()) {
52210         section.disclosureExpanded(true);
52211       } else if (!_didInteract) {
52212         section.disclosureExpanded(null);
52213       }
52214       return section;
52215     };
52216     section.tags = function(val) {
52217       if (!arguments.length) return _tags;
52218       _tags = val;
52219       return section;
52220     };
52221     section.entityIDs = function(val) {
52222       if (!arguments.length) return _entityIDs;
52223       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
52224         _entityIDs = val;
52225         _orderedKeys = [];
52226       }
52227       return section;
52228     };
52229     section.readOnlyTags = function(val) {
52230       if (!arguments.length) return _readOnlyTags;
52231       _readOnlyTags = val;
52232       return section;
52233     };
52234     return utilRebind(section, dispatch14, "on");
52235   }
52236   var init_raw_tag_editor = __esm({
52237     "modules/ui/sections/raw_tag_editor.js"() {
52238       "use strict";
52239       init_src4();
52240       init_src5();
52241       init_lodash();
52242       init_services();
52243       init_icon();
52244       init_combobox();
52245       init_section();
52246       init_tag_reference();
52247       init_preferences();
52248       init_localizer();
52249       init_array3();
52250       init_util();
52251       init_tags();
52252       init_core();
52253     }
52254   });
52255
52256   // modules/ui/data_editor.js
52257   var data_editor_exports = {};
52258   __export(data_editor_exports, {
52259     uiDataEditor: () => uiDataEditor
52260   });
52261   function uiDataEditor(context) {
52262     var dataHeader = uiDataHeader();
52263     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
52264     var _datum;
52265     function dataEditor(selection2) {
52266       var header = selection2.selectAll(".header").data([0]);
52267       var headerEnter = header.enter().append("div").attr("class", "header fillL");
52268       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
52269         context.enter(modeBrowse(context));
52270       }).call(svgIcon("#iD-icon-close"));
52271       headerEnter.append("h2").call(_t.append("map_data.title"));
52272       var body = selection2.selectAll(".body").data([0]);
52273       body = body.enter().append("div").attr("class", "body").merge(body);
52274       var editor = body.selectAll(".data-editor").data([0]);
52275       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
52276       var rte = body.selectAll(".raw-tag-editor").data([0]);
52277       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
52278         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
52279       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
52280     }
52281     dataEditor.datum = function(val) {
52282       if (!arguments.length) return _datum;
52283       _datum = val;
52284       return this;
52285     };
52286     return dataEditor;
52287   }
52288   var init_data_editor = __esm({
52289     "modules/ui/data_editor.js"() {
52290       "use strict";
52291       init_localizer();
52292       init_browse();
52293       init_icon();
52294       init_data_header();
52295       init_raw_tag_editor();
52296     }
52297   });
52298
52299   // modules/modes/select_data.js
52300   var select_data_exports = {};
52301   __export(select_data_exports, {
52302     modeSelectData: () => modeSelectData
52303   });
52304   function modeSelectData(context, selectedDatum) {
52305     var mode = {
52306       id: "select-data",
52307       button: "browse"
52308     };
52309     var keybinding = utilKeybinding("select-data");
52310     var dataEditor = uiDataEditor(context);
52311     var behaviors = [
52312       behaviorBreathe(context),
52313       behaviorHover(context),
52314       behaviorSelect(context),
52315       behaviorLasso(context),
52316       modeDragNode(context).behavior,
52317       modeDragNote(context).behavior
52318     ];
52319     function selectData(d3_event, drawn) {
52320       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
52321       if (selection2.empty()) {
52322         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
52323         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
52324           context.enter(modeBrowse(context));
52325         }
52326       } else {
52327         selection2.classed("selected", true);
52328       }
52329     }
52330     function esc() {
52331       if (context.container().select(".combobox").size()) return;
52332       context.enter(modeBrowse(context));
52333     }
52334     mode.zoomToSelected = function() {
52335       var extent = geoExtent(bounds_default(selectedDatum));
52336       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
52337     };
52338     mode.enter = function() {
52339       behaviors.forEach(context.install);
52340       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
52341       select_default2(document).call(keybinding);
52342       selectData();
52343       var sidebar = context.ui().sidebar;
52344       sidebar.show(dataEditor.datum(selectedDatum));
52345       var extent = geoExtent(bounds_default(selectedDatum));
52346       sidebar.expand(sidebar.intersects(extent));
52347       context.map().on("drawn.select-data", selectData);
52348     };
52349     mode.exit = function() {
52350       behaviors.forEach(context.uninstall);
52351       select_default2(document).call(keybinding.unbind);
52352       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
52353       context.map().on("drawn.select-data", null);
52354       context.ui().sidebar.hide();
52355     };
52356     return mode;
52357   }
52358   var init_select_data = __esm({
52359     "modules/modes/select_data.js"() {
52360       "use strict";
52361       init_src2();
52362       init_src5();
52363       init_breathe();
52364       init_hover();
52365       init_lasso2();
52366       init_select4();
52367       init_localizer();
52368       init_geo2();
52369       init_browse();
52370       init_drag_node();
52371       init_drag_note();
52372       init_data_editor();
52373       init_util();
52374     }
52375   });
52376
52377   // modules/ui/keepRight_details.js
52378   var keepRight_details_exports = {};
52379   __export(keepRight_details_exports, {
52380     uiKeepRightDetails: () => uiKeepRightDetails
52381   });
52382   function uiKeepRightDetails(context) {
52383     let _qaItem;
52384     function issueDetail(d2) {
52385       const { itemType, parentIssueType } = d2;
52386       const unknown = { html: _t.html("inspector.unknown") };
52387       let replacements = d2.replacements || {};
52388       replacements.default = unknown;
52389       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
52390         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
52391       } else {
52392         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
52393       }
52394     }
52395     function keepRightDetails(selection2) {
52396       const details = selection2.selectAll(".error-details").data(
52397         _qaItem ? [_qaItem] : [],
52398         (d2) => `${d2.id}-${d2.status || 0}`
52399       );
52400       details.exit().remove();
52401       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
52402       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
52403       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
52404       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
52405       let relatedEntities = [];
52406       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
52407         const link2 = select_default2(this);
52408         const isObjectLink = link2.classed("error_object_link");
52409         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
52410         const entity = context.hasEntity(entityID);
52411         relatedEntities.push(entityID);
52412         link2.on("mouseenter", () => {
52413           utilHighlightEntities([entityID], true, context);
52414         }).on("mouseleave", () => {
52415           utilHighlightEntities([entityID], false, context);
52416         }).on("click", (d3_event) => {
52417           d3_event.preventDefault();
52418           utilHighlightEntities([entityID], false, context);
52419           const osmlayer = context.layers().layer("osm");
52420           if (!osmlayer.enabled()) {
52421             osmlayer.enabled(true);
52422           }
52423           context.map().centerZoomEase(_qaItem.loc, 20);
52424           if (entity) {
52425             context.enter(modeSelect(context, [entityID]));
52426           } else {
52427             context.loadEntity(entityID, (err, result) => {
52428               if (err) return;
52429               const entity2 = result.data.find((e3) => e3.id === entityID);
52430               if (entity2) context.enter(modeSelect(context, [entityID]));
52431             });
52432           }
52433         });
52434         if (entity) {
52435           let name = utilDisplayName(entity);
52436           if (!name && !isObjectLink) {
52437             const preset = _mainPresetIndex.match(entity, context.graph());
52438             name = preset && !preset.isFallback() && preset.name();
52439           }
52440           if (name) {
52441             this.innerText = name;
52442           }
52443         }
52444       });
52445       context.features().forceVisible(relatedEntities);
52446       context.map().pan([0, 0]);
52447     }
52448     keepRightDetails.issue = function(val) {
52449       if (!arguments.length) return _qaItem;
52450       _qaItem = val;
52451       return keepRightDetails;
52452     };
52453     return keepRightDetails;
52454   }
52455   var init_keepRight_details = __esm({
52456     "modules/ui/keepRight_details.js"() {
52457       "use strict";
52458       init_src5();
52459       init_presets();
52460       init_select5();
52461       init_localizer();
52462       init_util();
52463     }
52464   });
52465
52466   // modules/ui/keepRight_header.js
52467   var keepRight_header_exports = {};
52468   __export(keepRight_header_exports, {
52469     uiKeepRightHeader: () => uiKeepRightHeader
52470   });
52471   function uiKeepRightHeader() {
52472     let _qaItem;
52473     function issueTitle(d2) {
52474       const { itemType, parentIssueType } = d2;
52475       const unknown = _t.html("inspector.unknown");
52476       let replacements = d2.replacements || {};
52477       replacements.default = { html: unknown };
52478       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
52479         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
52480       } else {
52481         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
52482       }
52483     }
52484     function keepRightHeader(selection2) {
52485       const header = selection2.selectAll(".qa-header").data(
52486         _qaItem ? [_qaItem] : [],
52487         (d2) => `${d2.id}-${d2.status || 0}`
52488       );
52489       header.exit().remove();
52490       const headerEnter = header.enter().append("div").attr("class", "qa-header");
52491       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
52492       iconEnter.append("div").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
52493       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
52494     }
52495     keepRightHeader.issue = function(val) {
52496       if (!arguments.length) return _qaItem;
52497       _qaItem = val;
52498       return keepRightHeader;
52499     };
52500     return keepRightHeader;
52501   }
52502   var init_keepRight_header = __esm({
52503     "modules/ui/keepRight_header.js"() {
52504       "use strict";
52505       init_icon();
52506       init_localizer();
52507     }
52508   });
52509
52510   // modules/ui/view_on_keepRight.js
52511   var view_on_keepRight_exports = {};
52512   __export(view_on_keepRight_exports, {
52513     uiViewOnKeepRight: () => uiViewOnKeepRight
52514   });
52515   function uiViewOnKeepRight() {
52516     let _qaItem;
52517     function viewOnKeepRight(selection2) {
52518       let url;
52519       if (services.keepRight && _qaItem instanceof QAItem) {
52520         url = services.keepRight.issueURL(_qaItem);
52521       }
52522       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
52523       link2.exit().remove();
52524       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
52525       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
52526     }
52527     viewOnKeepRight.what = function(val) {
52528       if (!arguments.length) return _qaItem;
52529       _qaItem = val;
52530       return viewOnKeepRight;
52531     };
52532     return viewOnKeepRight;
52533   }
52534   var init_view_on_keepRight = __esm({
52535     "modules/ui/view_on_keepRight.js"() {
52536       "use strict";
52537       init_localizer();
52538       init_services();
52539       init_icon();
52540       init_osm();
52541     }
52542   });
52543
52544   // modules/ui/keepRight_editor.js
52545   var keepRight_editor_exports = {};
52546   __export(keepRight_editor_exports, {
52547     uiKeepRightEditor: () => uiKeepRightEditor
52548   });
52549   function uiKeepRightEditor(context) {
52550     const dispatch14 = dispatch_default("change");
52551     const qaDetails = uiKeepRightDetails(context);
52552     const qaHeader = uiKeepRightHeader(context);
52553     let _qaItem;
52554     function keepRightEditor(selection2) {
52555       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
52556       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
52557       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
52558       let body = selection2.selectAll(".body").data([0]);
52559       body = body.enter().append("div").attr("class", "body").merge(body);
52560       const editor = body.selectAll(".qa-editor").data([0]);
52561       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
52562       const footer = selection2.selectAll(".footer").data([0]);
52563       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
52564     }
52565     function keepRightSaveSection(selection2) {
52566       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52567       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
52568       let saveSection = selection2.selectAll(".qa-save").data(
52569         isShown ? [_qaItem] : [],
52570         (d2) => `${d2.id}-${d2.status || 0}`
52571       );
52572       saveSection.exit().remove();
52573       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
52574       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
52575       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment || d2.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
52576       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
52577       function changeInput() {
52578         const input = select_default2(this);
52579         let val = input.property("value").trim();
52580         if (val === _qaItem.comment) {
52581           val = void 0;
52582         }
52583         _qaItem = _qaItem.update({ newComment: val });
52584         const qaService = services.keepRight;
52585         if (qaService) {
52586           qaService.replaceItem(_qaItem);
52587         }
52588         saveSection.call(qaSaveButtons);
52589       }
52590     }
52591     function qaSaveButtons(selection2) {
52592       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52593       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
52594       buttonSection.exit().remove();
52595       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
52596       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
52597       buttonEnter.append("button").attr("class", "button close-button action");
52598       buttonEnter.append("button").attr("class", "button ignore-button action");
52599       buttonSection = buttonSection.merge(buttonEnter);
52600       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
52601         this.blur();
52602         const qaService = services.keepRight;
52603         if (qaService) {
52604           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52605         }
52606       });
52607       buttonSection.select(".close-button").html((d2) => {
52608         const andComment = d2.newComment ? "_comment" : "";
52609         return _t.html(`QA.keepRight.close${andComment}`);
52610       }).on("click.close", function(d3_event, d2) {
52611         this.blur();
52612         const qaService = services.keepRight;
52613         if (qaService) {
52614           d2.newStatus = "ignore_t";
52615           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52616         }
52617       });
52618       buttonSection.select(".ignore-button").html((d2) => {
52619         const andComment = d2.newComment ? "_comment" : "";
52620         return _t.html(`QA.keepRight.ignore${andComment}`);
52621       }).on("click.ignore", function(d3_event, d2) {
52622         this.blur();
52623         const qaService = services.keepRight;
52624         if (qaService) {
52625           d2.newStatus = "ignore";
52626           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52627         }
52628       });
52629     }
52630     keepRightEditor.error = function(val) {
52631       if (!arguments.length) return _qaItem;
52632       _qaItem = val;
52633       return keepRightEditor;
52634     };
52635     return utilRebind(keepRightEditor, dispatch14, "on");
52636   }
52637   var init_keepRight_editor = __esm({
52638     "modules/ui/keepRight_editor.js"() {
52639       "use strict";
52640       init_src4();
52641       init_src5();
52642       init_localizer();
52643       init_services();
52644       init_browse();
52645       init_icon();
52646       init_keepRight_details();
52647       init_keepRight_header();
52648       init_view_on_keepRight();
52649       init_util();
52650     }
52651   });
52652
52653   // modules/ui/osmose_details.js
52654   var osmose_details_exports = {};
52655   __export(osmose_details_exports, {
52656     uiOsmoseDetails: () => uiOsmoseDetails
52657   });
52658   function uiOsmoseDetails(context) {
52659     let _qaItem;
52660     function issueString(d2, type2) {
52661       if (!d2) return "";
52662       const s2 = services.osmose.getStrings(d2.itemType);
52663       return type2 in s2 ? s2[type2] : "";
52664     }
52665     function osmoseDetails(selection2) {
52666       const details = selection2.selectAll(".error-details").data(
52667         _qaItem ? [_qaItem] : [],
52668         (d2) => `${d2.id}-${d2.status || 0}`
52669       );
52670       details.exit().remove();
52671       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
52672       if (issueString(_qaItem, "detail")) {
52673         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52674         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
52675         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52676       }
52677       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
52678       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
52679       if (issueString(_qaItem, "fix")) {
52680         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52681         div.append("h4").call(_t.append("QA.osmose.fix_title"));
52682         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52683       }
52684       if (issueString(_qaItem, "trap")) {
52685         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
52686         div.append("h4").call(_t.append("QA.osmose.trap_title"));
52687         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52688       }
52689       const thisItem = _qaItem;
52690       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
52691         if (!d2.elems || d2.elems.length === 0) return;
52692         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty()) return;
52693         if (d2.detail) {
52694           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
52695           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
52696         }
52697         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
52698         elemsDiv.append("ul").selectAll("li").data(d2.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d4) => d4).each(function() {
52699           const link2 = select_default2(this);
52700           const entityID = this.textContent;
52701           const entity = context.hasEntity(entityID);
52702           link2.on("mouseenter", () => {
52703             utilHighlightEntities([entityID], true, context);
52704           }).on("mouseleave", () => {
52705             utilHighlightEntities([entityID], false, context);
52706           }).on("click", (d3_event) => {
52707             d3_event.preventDefault();
52708             utilHighlightEntities([entityID], false, context);
52709             const osmlayer = context.layers().layer("osm");
52710             if (!osmlayer.enabled()) {
52711               osmlayer.enabled(true);
52712             }
52713             context.map().centerZoom(d2.loc, 20);
52714             if (entity) {
52715               context.enter(modeSelect(context, [entityID]));
52716             } else {
52717               context.loadEntity(entityID, (err, result) => {
52718                 if (err) return;
52719                 const entity2 = result.data.find((e3) => e3.id === entityID);
52720                 if (entity2) context.enter(modeSelect(context, [entityID]));
52721               });
52722             }
52723           });
52724           if (entity) {
52725             let name = utilDisplayName(entity);
52726             if (!name) {
52727               const preset = _mainPresetIndex.match(entity, context.graph());
52728               name = preset && !preset.isFallback() && preset.name();
52729             }
52730             if (name) {
52731               this.innerText = name;
52732             }
52733           }
52734         });
52735         context.features().forceVisible(d2.elems);
52736         context.map().pan([0, 0]);
52737       }).catch((err) => {
52738         console.log(err);
52739       });
52740     }
52741     osmoseDetails.issue = function(val) {
52742       if (!arguments.length) return _qaItem;
52743       _qaItem = val;
52744       return osmoseDetails;
52745     };
52746     return osmoseDetails;
52747   }
52748   var init_osmose_details = __esm({
52749     "modules/ui/osmose_details.js"() {
52750       "use strict";
52751       init_src5();
52752       init_presets();
52753       init_select5();
52754       init_localizer();
52755       init_services();
52756       init_util();
52757     }
52758   });
52759
52760   // modules/ui/osmose_header.js
52761   var osmose_header_exports = {};
52762   __export(osmose_header_exports, {
52763     uiOsmoseHeader: () => uiOsmoseHeader
52764   });
52765   function uiOsmoseHeader() {
52766     let _qaItem;
52767     function issueTitle(d2) {
52768       const unknown = _t("inspector.unknown");
52769       if (!d2) return unknown;
52770       const s2 = services.osmose.getStrings(d2.itemType);
52771       return "title" in s2 ? s2.title : unknown;
52772     }
52773     function osmoseHeader(selection2) {
52774       const header = selection2.selectAll(".qa-header").data(
52775         _qaItem ? [_qaItem] : [],
52776         (d2) => `${d2.id}-${d2.status || 0}`
52777       );
52778       header.exit().remove();
52779       const headerEnter = header.enter().append("div").attr("class", "qa-header");
52780       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
52781       svgEnter.append("polygon").attr("fill", (d2) => services.osmose.getColor(d2.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");
52782       svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
52783       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
52784     }
52785     osmoseHeader.issue = function(val) {
52786       if (!arguments.length) return _qaItem;
52787       _qaItem = val;
52788       return osmoseHeader;
52789     };
52790     return osmoseHeader;
52791   }
52792   var init_osmose_header = __esm({
52793     "modules/ui/osmose_header.js"() {
52794       "use strict";
52795       init_services();
52796       init_localizer();
52797     }
52798   });
52799
52800   // modules/ui/view_on_osmose.js
52801   var view_on_osmose_exports = {};
52802   __export(view_on_osmose_exports, {
52803     uiViewOnOsmose: () => uiViewOnOsmose
52804   });
52805   function uiViewOnOsmose() {
52806     let _qaItem;
52807     function viewOnOsmose(selection2) {
52808       let url;
52809       if (services.osmose && _qaItem instanceof QAItem) {
52810         url = services.osmose.itemURL(_qaItem);
52811       }
52812       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
52813       link2.exit().remove();
52814       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
52815       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
52816     }
52817     viewOnOsmose.what = function(val) {
52818       if (!arguments.length) return _qaItem;
52819       _qaItem = val;
52820       return viewOnOsmose;
52821     };
52822     return viewOnOsmose;
52823   }
52824   var init_view_on_osmose = __esm({
52825     "modules/ui/view_on_osmose.js"() {
52826       "use strict";
52827       init_localizer();
52828       init_services();
52829       init_icon();
52830       init_osm();
52831     }
52832   });
52833
52834   // modules/ui/osmose_editor.js
52835   var osmose_editor_exports = {};
52836   __export(osmose_editor_exports, {
52837     uiOsmoseEditor: () => uiOsmoseEditor
52838   });
52839   function uiOsmoseEditor(context) {
52840     const dispatch14 = dispatch_default("change");
52841     const qaDetails = uiOsmoseDetails(context);
52842     const qaHeader = uiOsmoseHeader(context);
52843     let _qaItem;
52844     function osmoseEditor(selection2) {
52845       const header = selection2.selectAll(".header").data([0]);
52846       const headerEnter = header.enter().append("div").attr("class", "header fillL");
52847       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
52848       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
52849       let body = selection2.selectAll(".body").data([0]);
52850       body = body.enter().append("div").attr("class", "body").merge(body);
52851       let editor = body.selectAll(".qa-editor").data([0]);
52852       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
52853       const footer = selection2.selectAll(".footer").data([0]);
52854       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
52855     }
52856     function osmoseSaveSection(selection2) {
52857       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52858       const isShown = _qaItem && isSelected;
52859       let saveSection = selection2.selectAll(".qa-save").data(
52860         isShown ? [_qaItem] : [],
52861         (d2) => `${d2.id}-${d2.status || 0}`
52862       );
52863       saveSection.exit().remove();
52864       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
52865       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
52866     }
52867     function qaSaveButtons(selection2) {
52868       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
52869       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
52870       buttonSection.exit().remove();
52871       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
52872       buttonEnter.append("button").attr("class", "button close-button action");
52873       buttonEnter.append("button").attr("class", "button ignore-button action");
52874       buttonSection = buttonSection.merge(buttonEnter);
52875       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
52876         this.blur();
52877         const qaService = services.osmose;
52878         if (qaService) {
52879           d2.newStatus = "done";
52880           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52881         }
52882       });
52883       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
52884         this.blur();
52885         const qaService = services.osmose;
52886         if (qaService) {
52887           d2.newStatus = "false";
52888           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
52889         }
52890       });
52891     }
52892     osmoseEditor.error = function(val) {
52893       if (!arguments.length) return _qaItem;
52894       _qaItem = val;
52895       return osmoseEditor;
52896     };
52897     return utilRebind(osmoseEditor, dispatch14, "on");
52898   }
52899   var init_osmose_editor = __esm({
52900     "modules/ui/osmose_editor.js"() {
52901       "use strict";
52902       init_src4();
52903       init_localizer();
52904       init_services();
52905       init_browse();
52906       init_icon();
52907       init_osmose_details();
52908       init_osmose_header();
52909       init_view_on_osmose();
52910       init_util();
52911     }
52912   });
52913
52914   // modules/modes/select_error.js
52915   var select_error_exports = {};
52916   __export(select_error_exports, {
52917     modeSelectError: () => modeSelectError
52918   });
52919   function modeSelectError(context, selectedErrorID, selectedErrorService) {
52920     var mode = {
52921       id: "select-error",
52922       button: "browse"
52923     };
52924     var keybinding = utilKeybinding("select-error");
52925     var errorService = services[selectedErrorService];
52926     var errorEditor;
52927     switch (selectedErrorService) {
52928       case "keepRight":
52929         errorEditor = uiKeepRightEditor(context).on("change", function() {
52930           context.map().pan([0, 0]);
52931           var error = checkSelectedID();
52932           if (!error) return;
52933           context.ui().sidebar.show(errorEditor.error(error));
52934         });
52935         break;
52936       case "osmose":
52937         errorEditor = uiOsmoseEditor(context).on("change", function() {
52938           context.map().pan([0, 0]);
52939           var error = checkSelectedID();
52940           if (!error) return;
52941           context.ui().sidebar.show(errorEditor.error(error));
52942         });
52943         break;
52944     }
52945     var behaviors = [
52946       behaviorBreathe(context),
52947       behaviorHover(context),
52948       behaviorSelect(context),
52949       behaviorLasso(context),
52950       modeDragNode(context).behavior,
52951       modeDragNote(context).behavior
52952     ];
52953     function checkSelectedID() {
52954       if (!errorService) return;
52955       var error = errorService.getError(selectedErrorID);
52956       if (!error) {
52957         context.enter(modeBrowse(context));
52958       }
52959       return error;
52960     }
52961     mode.zoomToSelected = function() {
52962       if (!errorService) return;
52963       var error = errorService.getError(selectedErrorID);
52964       if (error) {
52965         context.map().centerZoomEase(error.loc, 20);
52966       }
52967     };
52968     mode.enter = function() {
52969       var error = checkSelectedID();
52970       if (!error) return;
52971       behaviors.forEach(context.install);
52972       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
52973       select_default2(document).call(keybinding);
52974       selectError();
52975       var sidebar = context.ui().sidebar;
52976       sidebar.show(errorEditor.error(error));
52977       context.map().on("drawn.select-error", selectError);
52978       function selectError(d3_event, drawn) {
52979         if (!checkSelectedID()) return;
52980         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
52981         if (selection2.empty()) {
52982           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
52983           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
52984             context.enter(modeBrowse(context));
52985           }
52986         } else {
52987           selection2.classed("selected", true);
52988           context.selectedErrorID(selectedErrorID);
52989         }
52990       }
52991       function esc() {
52992         if (context.container().select(".combobox").size()) return;
52993         context.enter(modeBrowse(context));
52994       }
52995     };
52996     mode.exit = function() {
52997       behaviors.forEach(context.uninstall);
52998       select_default2(document).call(keybinding.unbind);
52999       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
53000       context.map().on("drawn.select-error", null);
53001       context.ui().sidebar.hide();
53002       context.selectedErrorID(null);
53003       context.features().forceVisible([]);
53004     };
53005     return mode;
53006   }
53007   var init_select_error = __esm({
53008     "modules/modes/select_error.js"() {
53009       "use strict";
53010       init_src5();
53011       init_breathe();
53012       init_hover();
53013       init_lasso2();
53014       init_select4();
53015       init_localizer();
53016       init_services();
53017       init_browse();
53018       init_drag_node();
53019       init_drag_note();
53020       init_keepRight_editor();
53021       init_osmose_editor();
53022       init_util();
53023     }
53024   });
53025
53026   // modules/behavior/select.js
53027   var select_exports = {};
53028   __export(select_exports, {
53029     behaviorSelect: () => behaviorSelect
53030   });
53031   function behaviorSelect(context) {
53032     var _tolerancePx = 4;
53033     var _lastMouseEvent = null;
53034     var _showMenu = false;
53035     var _downPointers = {};
53036     var _longPressTimeout = null;
53037     var _lastInteractionType = null;
53038     var _multiselectionPointerId = null;
53039     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
53040     function keydown(d3_event) {
53041       if (d3_event.keyCode === 32) {
53042         var activeNode = document.activeElement;
53043         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
53044       }
53045       if (d3_event.keyCode === 93 || // context menu key
53046       d3_event.keyCode === 32) {
53047         d3_event.preventDefault();
53048       }
53049       if (d3_event.repeat) return;
53050       cancelLongPress();
53051       if (d3_event.shiftKey) {
53052         context.surface().classed("behavior-multiselect", true);
53053       }
53054       if (d3_event.keyCode === 32) {
53055         if (!_downPointers.spacebar && _lastMouseEvent) {
53056           cancelLongPress();
53057           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
53058           _downPointers.spacebar = {
53059             firstEvent: _lastMouseEvent,
53060             lastEvent: _lastMouseEvent
53061           };
53062         }
53063       }
53064     }
53065     function keyup(d3_event) {
53066       cancelLongPress();
53067       if (!d3_event.shiftKey) {
53068         context.surface().classed("behavior-multiselect", false);
53069       }
53070       if (d3_event.keyCode === 93) {
53071         d3_event.preventDefault();
53072         _lastInteractionType = "menukey";
53073         contextmenu(d3_event);
53074       } else if (d3_event.keyCode === 32) {
53075         var pointer = _downPointers.spacebar;
53076         if (pointer) {
53077           delete _downPointers.spacebar;
53078           if (pointer.done) return;
53079           d3_event.preventDefault();
53080           _lastInteractionType = "spacebar";
53081           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
53082         }
53083       }
53084     }
53085     function pointerdown(d3_event) {
53086       var id2 = (d3_event.pointerId || "mouse").toString();
53087       cancelLongPress();
53088       if (d3_event.buttons && d3_event.buttons !== 1) return;
53089       context.ui().closeEditMenu();
53090       if (d3_event.pointerType !== "mouse") {
53091         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
53092       }
53093       _downPointers[id2] = {
53094         firstEvent: d3_event,
53095         lastEvent: d3_event
53096       };
53097     }
53098     function didLongPress(id2, interactionType) {
53099       var pointer = _downPointers[id2];
53100       if (!pointer) return;
53101       for (var i3 in _downPointers) {
53102         _downPointers[i3].done = true;
53103       }
53104       _longPressTimeout = null;
53105       _lastInteractionType = interactionType;
53106       _showMenu = true;
53107       click(pointer.firstEvent, pointer.lastEvent, id2);
53108     }
53109     function pointermove(d3_event) {
53110       var id2 = (d3_event.pointerId || "mouse").toString();
53111       if (_downPointers[id2]) {
53112         _downPointers[id2].lastEvent = d3_event;
53113       }
53114       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
53115         _lastMouseEvent = d3_event;
53116         if (_downPointers.spacebar) {
53117           _downPointers.spacebar.lastEvent = d3_event;
53118         }
53119       }
53120     }
53121     function pointerup(d3_event) {
53122       var id2 = (d3_event.pointerId || "mouse").toString();
53123       var pointer = _downPointers[id2];
53124       if (!pointer) return;
53125       delete _downPointers[id2];
53126       if (_multiselectionPointerId === id2) {
53127         _multiselectionPointerId = null;
53128       }
53129       if (pointer.done) return;
53130       click(pointer.firstEvent, d3_event, id2);
53131     }
53132     function pointercancel(d3_event) {
53133       var id2 = (d3_event.pointerId || "mouse").toString();
53134       if (!_downPointers[id2]) return;
53135       delete _downPointers[id2];
53136       if (_multiselectionPointerId === id2) {
53137         _multiselectionPointerId = null;
53138       }
53139     }
53140     function contextmenu(d3_event) {
53141       d3_event.preventDefault();
53142       if (!+d3_event.clientX && !+d3_event.clientY) {
53143         if (_lastMouseEvent) {
53144           d3_event = _lastMouseEvent;
53145         } else {
53146           return;
53147         }
53148       } else {
53149         _lastMouseEvent = d3_event;
53150         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
53151         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
53152           _lastInteractionType = "touch";
53153         } else {
53154           _lastInteractionType = "rightclick";
53155         }
53156       }
53157       _showMenu = true;
53158       click(d3_event, d3_event);
53159     }
53160     function click(firstEvent, lastEvent, pointerId) {
53161       cancelLongPress();
53162       var mapNode = context.container().select(".main-map").node();
53163       var pointGetter = utilFastMouse(mapNode);
53164       var p1 = pointGetter(firstEvent);
53165       var p2 = pointGetter(lastEvent);
53166       var dist = geoVecLength(p1, p2);
53167       if (dist > _tolerancePx || !mapContains(lastEvent)) {
53168         resetProperties();
53169         return;
53170       }
53171       var targetDatum = lastEvent.target.__data__;
53172       if (targetDatum === 0 && lastEvent.target.parentNode.__data__) {
53173         targetDatum = lastEvent.target.parentNode.__data__;
53174       }
53175       var multiselectEntityId;
53176       if (!_multiselectionPointerId) {
53177         var selectPointerInfo = pointerDownOnSelection(pointerId);
53178         if (selectPointerInfo) {
53179           _multiselectionPointerId = selectPointerInfo.pointerId;
53180           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
53181           _downPointers[selectPointerInfo.pointerId].done = true;
53182         }
53183       }
53184       var isMultiselect = context.mode().id === "select" && // and shift key is down
53185       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
53186       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
53187       _multiselectionPointerId && !multiselectEntityId);
53188       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
53189       function mapContains(event) {
53190         var rect = mapNode.getBoundingClientRect();
53191         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
53192       }
53193       function pointerDownOnSelection(skipPointerId) {
53194         var mode = context.mode();
53195         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
53196         for (var pointerId2 in _downPointers) {
53197           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
53198           var pointerInfo = _downPointers[pointerId2];
53199           var p12 = pointGetter(pointerInfo.firstEvent);
53200           var p22 = pointGetter(pointerInfo.lastEvent);
53201           if (geoVecLength(p12, p22) > _tolerancePx) continue;
53202           var datum2 = pointerInfo.firstEvent.target.__data__;
53203           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
53204           if (context.graph().hasEntity(entity.id)) {
53205             return {
53206               pointerId: pointerId2,
53207               entityId: entity.id,
53208               selected: selectedIDs.indexOf(entity.id) !== -1
53209             };
53210           }
53211         }
53212         return null;
53213       }
53214     }
53215     function processClick(datum2, isMultiselect, point, alsoSelectId) {
53216       var mode = context.mode();
53217       var showMenu = _showMenu;
53218       var interactionType = _lastInteractionType;
53219       var entity = datum2 && datum2.properties && datum2.properties.entity;
53220       if (entity) datum2 = entity;
53221       if (datum2 && datum2.type === "midpoint") {
53222         datum2 = datum2.parents[0];
53223       }
53224       var newMode;
53225       if (datum2 instanceof osmEntity) {
53226         var selectedIDs = context.selectedIDs();
53227         context.selectedNoteID(null);
53228         context.selectedErrorID(null);
53229         if (!isMultiselect) {
53230           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
53231             if (alsoSelectId === datum2.id) alsoSelectId = null;
53232             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
53233             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
53234             context.enter(newMode);
53235           }
53236         } else {
53237           if (selectedIDs.indexOf(datum2.id) !== -1) {
53238             if (!showMenu) {
53239               selectedIDs = selectedIDs.filter(function(id2) {
53240                 return id2 !== datum2.id;
53241               });
53242               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
53243               context.enter(newMode);
53244             }
53245           } else {
53246             selectedIDs = selectedIDs.concat([datum2.id]);
53247             newMode = mode.selectedIDs(selectedIDs);
53248             context.enter(newMode);
53249           }
53250         }
53251       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
53252         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
53253       } else if (datum2 instanceof osmNote && !isMultiselect) {
53254         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
53255       } else if (datum2 instanceof QAItem && !isMultiselect) {
53256         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
53257       } else if (datum2.service === "photo") {
53258       } else {
53259         context.selectedNoteID(null);
53260         context.selectedErrorID(null);
53261         if (!isMultiselect && mode.id !== "browse") {
53262           context.enter(modeBrowse(context));
53263         }
53264       }
53265       context.ui().closeEditMenu();
53266       if (showMenu) context.ui().showEditMenu(point, interactionType);
53267       resetProperties();
53268     }
53269     function cancelLongPress() {
53270       if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
53271       _longPressTimeout = null;
53272     }
53273     function resetProperties() {
53274       cancelLongPress();
53275       _showMenu = false;
53276       _lastInteractionType = null;
53277     }
53278     function behavior(selection2) {
53279       resetProperties();
53280       _lastMouseEvent = context.map().lastPointerEvent();
53281       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) {
53282         var e3 = d3_event;
53283         if (+e3.clientX === 0 && +e3.clientY === 0) {
53284           d3_event.preventDefault();
53285         }
53286       });
53287       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
53288     }
53289     behavior.off = function(selection2) {
53290       cancelLongPress();
53291       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);
53292       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
53293       context.surface().classed("behavior-multiselect", false);
53294     };
53295     return behavior;
53296   }
53297   var init_select4 = __esm({
53298     "modules/behavior/select.js"() {
53299       "use strict";
53300       init_src5();
53301       init_geo2();
53302       init_browse();
53303       init_select5();
53304       init_select_data();
53305       init_select_note();
53306       init_select_error();
53307       init_osm();
53308       init_util2();
53309     }
53310   });
53311
53312   // modules/ui/note_comments.js
53313   var note_comments_exports = {};
53314   __export(note_comments_exports, {
53315     uiNoteComments: () => uiNoteComments
53316   });
53317   function uiNoteComments() {
53318     var _note;
53319     function noteComments(selection2) {
53320       if (_note.isNew()) return;
53321       var comments = selection2.selectAll(".comments-container").data([0]);
53322       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
53323       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
53324       commentEnter.append("div").attr("class", function(d2) {
53325         return "comment-avatar user-" + d2.uid;
53326       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
53327       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
53328       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
53329       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
53330         var selection3 = select_default2(this);
53331         var osm = services.osm;
53332         if (osm && d2.user) {
53333           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
53334         }
53335         if (d2.user) {
53336           selection3.text(d2.user);
53337         } else {
53338           selection3.call(_t.append("note.anonymous"));
53339         }
53340       });
53341       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
53342         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
53343       });
53344       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
53345         return d2.html;
53346       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
53347       comments.call(replaceAvatars);
53348     }
53349     function replaceAvatars(selection2) {
53350       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
53351       var osm = services.osm;
53352       if (showThirdPartyIcons !== "true" || !osm) return;
53353       var uids = {};
53354       _note.comments.forEach(function(d2) {
53355         if (d2.uid) uids[d2.uid] = true;
53356       });
53357       Object.keys(uids).forEach(function(uid) {
53358         osm.loadUser(uid, function(err, user) {
53359           if (!user || !user.image_url) return;
53360           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);
53361         });
53362       });
53363     }
53364     function localeDateString2(s2) {
53365       if (!s2) return null;
53366       var options = { day: "numeric", month: "short", year: "numeric" };
53367       s2 = s2.replace(/-/g, "/");
53368       var d2 = new Date(s2);
53369       if (isNaN(d2.getTime())) return null;
53370       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options);
53371     }
53372     noteComments.note = function(val) {
53373       if (!arguments.length) return _note;
53374       _note = val;
53375       return noteComments;
53376     };
53377     return noteComments;
53378   }
53379   var init_note_comments = __esm({
53380     "modules/ui/note_comments.js"() {
53381       "use strict";
53382       init_src5();
53383       init_preferences();
53384       init_localizer();
53385       init_icon();
53386       init_services();
53387     }
53388   });
53389
53390   // modules/ui/note_header.js
53391   var note_header_exports = {};
53392   __export(note_header_exports, {
53393     uiNoteHeader: () => uiNoteHeader
53394   });
53395   function uiNoteHeader() {
53396     var _note;
53397     function noteHeader(selection2) {
53398       var header = selection2.selectAll(".note-header").data(
53399         _note ? [_note] : [],
53400         function(d2) {
53401           return d2.status + d2.id;
53402         }
53403       );
53404       header.exit().remove();
53405       var headerEnter = header.enter().append("div").attr("class", "note-header");
53406       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
53407         return "note-header-icon " + d2.status;
53408       }).classed("new", function(d2) {
53409         return d2.id < 0;
53410       });
53411       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
53412       iconEnter.each(function(d2) {
53413         var statusIcon;
53414         if (d2.id < 0) {
53415           statusIcon = "#iD-icon-plus";
53416         } else if (d2.status === "open") {
53417           statusIcon = "#iD-icon-close";
53418         } else {
53419           statusIcon = "#iD-icon-apply";
53420         }
53421         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
53422       });
53423       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
53424         if (_note.isNew()) {
53425           return _t.html("note.new");
53426         }
53427         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
53428       });
53429     }
53430     noteHeader.note = function(val) {
53431       if (!arguments.length) return _note;
53432       _note = val;
53433       return noteHeader;
53434     };
53435     return noteHeader;
53436   }
53437   var init_note_header = __esm({
53438     "modules/ui/note_header.js"() {
53439       "use strict";
53440       init_localizer();
53441       init_icon();
53442     }
53443   });
53444
53445   // modules/ui/note_report.js
53446   var note_report_exports = {};
53447   __export(note_report_exports, {
53448     uiNoteReport: () => uiNoteReport
53449   });
53450   function uiNoteReport() {
53451     var _note;
53452     function noteReport(selection2) {
53453       var url;
53454       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
53455         url = services.osm.noteReportURL(_note);
53456       }
53457       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
53458       link2.exit().remove();
53459       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
53460         return d2;
53461       }).call(svgIcon("#iD-icon-out-link", "inline"));
53462       linkEnter.append("span").call(_t.append("note.report"));
53463     }
53464     noteReport.note = function(val) {
53465       if (!arguments.length) return _note;
53466       _note = val;
53467       return noteReport;
53468     };
53469     return noteReport;
53470   }
53471   var init_note_report = __esm({
53472     "modules/ui/note_report.js"() {
53473       "use strict";
53474       init_localizer();
53475       init_osm();
53476       init_services();
53477       init_icon();
53478     }
53479   });
53480
53481   // modules/ui/view_on_osm.js
53482   var view_on_osm_exports = {};
53483   __export(view_on_osm_exports, {
53484     uiViewOnOSM: () => uiViewOnOSM
53485   });
53486   function uiViewOnOSM(context) {
53487     var _what;
53488     function viewOnOSM(selection2) {
53489       var url;
53490       if (_what instanceof osmEntity) {
53491         url = context.connection().entityURL(_what);
53492       } else if (_what instanceof osmNote) {
53493         url = context.connection().noteURL(_what);
53494       }
53495       var data = !_what || _what.isNew() ? [] : [_what];
53496       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
53497         return d2.id;
53498       });
53499       link2.exit().remove();
53500       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
53501       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
53502     }
53503     viewOnOSM.what = function(_3) {
53504       if (!arguments.length) return _what;
53505       _what = _3;
53506       return viewOnOSM;
53507     };
53508     return viewOnOSM;
53509   }
53510   var init_view_on_osm = __esm({
53511     "modules/ui/view_on_osm.js"() {
53512       "use strict";
53513       init_localizer();
53514       init_osm();
53515       init_icon();
53516     }
53517   });
53518
53519   // modules/ui/note_editor.js
53520   var note_editor_exports = {};
53521   __export(note_editor_exports, {
53522     uiNoteEditor: () => uiNoteEditor
53523   });
53524   function uiNoteEditor(context) {
53525     var dispatch14 = dispatch_default("change");
53526     var noteComments = uiNoteComments(context);
53527     var noteHeader = uiNoteHeader();
53528     var _note;
53529     var _newNote;
53530     function noteEditor(selection2) {
53531       var header = selection2.selectAll(".header").data([0]);
53532       var headerEnter = header.enter().append("div").attr("class", "header fillL");
53533       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
53534         context.enter(modeBrowse(context));
53535       }).call(svgIcon("#iD-icon-close"));
53536       headerEnter.append("h2").call(_t.append("note.title"));
53537       var body = selection2.selectAll(".body").data([0]);
53538       body = body.enter().append("div").attr("class", "body").merge(body);
53539       var editor = body.selectAll(".note-editor").data([0]);
53540       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
53541       var footer = selection2.selectAll(".footer").data([0]);
53542       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
53543       var osm = services.osm;
53544       if (osm) {
53545         osm.on("change.note-save", function() {
53546           selection2.call(noteEditor);
53547         });
53548       }
53549     }
53550     function noteSaveSection(selection2) {
53551       var isSelected = _note && _note.id === context.selectedNoteID();
53552       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
53553         return d2.status + d2.id;
53554       });
53555       noteSave.exit().remove();
53556       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
53557       noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
53558         if (_note.isNew()) {
53559           _t.append("note.newDescription")(select_default2(this));
53560         } else {
53561           _t.append("note.newComment")(select_default2(this));
53562         }
53563       });
53564       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
53565         return d2.newComment;
53566       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
53567       if (!commentTextarea.empty() && _newNote) {
53568         commentTextarea.node().focus();
53569       }
53570       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
53571       function keydown(d3_event) {
53572         if (!(d3_event.keyCode === 13 && // ↩ Return
53573         d3_event.metaKey)) return;
53574         var osm = services.osm;
53575         if (!osm) return;
53576         var hasAuth = osm.authenticated();
53577         if (!hasAuth) return;
53578         if (!_note.newComment) return;
53579         d3_event.preventDefault();
53580         select_default2(this).on("keydown.note-input", null);
53581         window.setTimeout(function() {
53582           if (_note.isNew()) {
53583             noteSave.selectAll(".save-button").node().focus();
53584             clickSave(_note);
53585           } else {
53586             noteSave.selectAll(".comment-button").node().focus();
53587             clickComment(_note);
53588           }
53589         }, 10);
53590       }
53591       function changeInput() {
53592         var input = select_default2(this);
53593         var val = input.property("value").trim() || void 0;
53594         _note = _note.update({ newComment: val });
53595         var osm = services.osm;
53596         if (osm) {
53597           osm.replaceNote(_note);
53598         }
53599         noteSave.call(noteSaveButtons);
53600       }
53601     }
53602     function userDetails(selection2) {
53603       var detailSection = selection2.selectAll(".detail-section").data([0]);
53604       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
53605       var osm = services.osm;
53606       if (!osm) return;
53607       var hasAuth = osm.authenticated();
53608       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
53609       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
53610       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
53611       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
53612       authEnter.append("span").call(_t.append("note.login"));
53613       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) {
53614         d3_event.preventDefault();
53615         osm.authenticate();
53616       });
53617       authEnter.transition().duration(200).style("opacity", 1);
53618       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
53619       prose.exit().remove();
53620       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
53621       osm.userDetails(function(err, user) {
53622         if (err) return;
53623         var userLink = select_default2(document.createElement("div"));
53624         if (user.image_url) {
53625           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
53626         }
53627         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
53628         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
53629       });
53630     }
53631     function noteSaveButtons(selection2) {
53632       var osm = services.osm;
53633       var hasAuth = osm && osm.authenticated();
53634       var isSelected = _note && _note.id === context.selectedNoteID();
53635       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
53636         return d2.status + d2.id;
53637       });
53638       buttonSection.exit().remove();
53639       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
53640       if (_note.isNew()) {
53641         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
53642         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
53643       } else {
53644         buttonEnter.append("button").attr("class", "button status-button action");
53645         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
53646       }
53647       buttonSection = buttonSection.merge(buttonEnter);
53648       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
53649       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
53650       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
53651         var action = d2.status === "open" ? "close" : "open";
53652         var andComment = d2.newComment ? "_comment" : "";
53653         _t.addOrUpdate("note." + action + andComment)(select_default2(this));
53654       }).on("click.status", clickStatus);
53655       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
53656       function isSaveDisabled(d2) {
53657         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
53658       }
53659     }
53660     function clickCancel(d3_event, d2) {
53661       this.blur();
53662       var osm = services.osm;
53663       if (osm) {
53664         osm.removeNote(d2);
53665       }
53666       context.enter(modeBrowse(context));
53667       dispatch14.call("change");
53668     }
53669     function clickSave(d3_event, d2) {
53670       this.blur();
53671       var osm = services.osm;
53672       if (osm) {
53673         osm.postNoteCreate(d2, function(err, note) {
53674           dispatch14.call("change", note);
53675         });
53676       }
53677     }
53678     function clickStatus(d3_event, d2) {
53679       this.blur();
53680       var osm = services.osm;
53681       if (osm) {
53682         var setStatus = d2.status === "open" ? "closed" : "open";
53683         osm.postNoteUpdate(d2, setStatus, function(err, note) {
53684           dispatch14.call("change", note);
53685         });
53686       }
53687     }
53688     function clickComment(d3_event, d2) {
53689       this.blur();
53690       var osm = services.osm;
53691       if (osm) {
53692         osm.postNoteUpdate(d2, d2.status, function(err, note) {
53693           dispatch14.call("change", note);
53694         });
53695       }
53696     }
53697     noteEditor.note = function(val) {
53698       if (!arguments.length) return _note;
53699       _note = val;
53700       return noteEditor;
53701     };
53702     noteEditor.newNote = function(val) {
53703       if (!arguments.length) return _newNote;
53704       _newNote = val;
53705       return noteEditor;
53706     };
53707     return utilRebind(noteEditor, dispatch14, "on");
53708   }
53709   var init_note_editor = __esm({
53710     "modules/ui/note_editor.js"() {
53711       "use strict";
53712       init_src4();
53713       init_src5();
53714       init_localizer();
53715       init_services();
53716       init_browse();
53717       init_icon();
53718       init_note_comments();
53719       init_note_header();
53720       init_note_report();
53721       init_view_on_osm();
53722       init_util();
53723     }
53724   });
53725
53726   // modules/modes/select_note.js
53727   var select_note_exports = {};
53728   __export(select_note_exports, {
53729     modeSelectNote: () => modeSelectNote
53730   });
53731   function modeSelectNote(context, selectedNoteID) {
53732     var mode = {
53733       id: "select-note",
53734       button: "browse"
53735     };
53736     var _keybinding = utilKeybinding("select-note");
53737     var _noteEditor = uiNoteEditor(context).on("change", function() {
53738       context.map().pan([0, 0]);
53739       var note = checkSelectedID();
53740       if (!note) return;
53741       context.ui().sidebar.show(_noteEditor.note(note));
53742     });
53743     var _behaviors = [
53744       behaviorBreathe(context),
53745       behaviorHover(context),
53746       behaviorSelect(context),
53747       behaviorLasso(context),
53748       modeDragNode(context).behavior,
53749       modeDragNote(context).behavior
53750     ];
53751     var _newFeature = false;
53752     function checkSelectedID() {
53753       if (!services.osm) return;
53754       var note = services.osm.getNote(selectedNoteID);
53755       if (!note) {
53756         context.enter(modeBrowse(context));
53757       }
53758       return note;
53759     }
53760     function selectNote(d3_event, drawn) {
53761       if (!checkSelectedID()) return;
53762       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
53763       if (selection2.empty()) {
53764         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
53765         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
53766           context.enter(modeBrowse(context));
53767         }
53768       } else {
53769         selection2.classed("selected", true);
53770         context.selectedNoteID(selectedNoteID);
53771       }
53772     }
53773     function esc() {
53774       if (context.container().select(".combobox").size()) return;
53775       context.enter(modeBrowse(context));
53776     }
53777     mode.zoomToSelected = function() {
53778       if (!services.osm) return;
53779       var note = services.osm.getNote(selectedNoteID);
53780       if (note) {
53781         context.map().centerZoomEase(note.loc, 20);
53782       }
53783     };
53784     mode.newFeature = function(val) {
53785       if (!arguments.length) return _newFeature;
53786       _newFeature = val;
53787       return mode;
53788     };
53789     mode.enter = function() {
53790       var note = checkSelectedID();
53791       if (!note) return;
53792       _behaviors.forEach(context.install);
53793       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
53794       select_default2(document).call(_keybinding);
53795       selectNote();
53796       var sidebar = context.ui().sidebar;
53797       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
53798       sidebar.expand(sidebar.intersects(note.extent()));
53799       context.map().on("drawn.select", selectNote);
53800     };
53801     mode.exit = function() {
53802       _behaviors.forEach(context.uninstall);
53803       select_default2(document).call(_keybinding.unbind);
53804       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
53805       context.map().on("drawn.select", null);
53806       context.ui().sidebar.hide();
53807       context.selectedNoteID(null);
53808     };
53809     return mode;
53810   }
53811   var init_select_note = __esm({
53812     "modules/modes/select_note.js"() {
53813       "use strict";
53814       init_src5();
53815       init_breathe();
53816       init_hover();
53817       init_lasso2();
53818       init_select4();
53819       init_localizer();
53820       init_browse();
53821       init_drag_node();
53822       init_drag_note();
53823       init_services();
53824       init_note_editor();
53825       init_util();
53826     }
53827   });
53828
53829   // modules/modes/add_note.js
53830   var add_note_exports = {};
53831   __export(add_note_exports, {
53832     modeAddNote: () => modeAddNote
53833   });
53834   function modeAddNote(context) {
53835     var mode = {
53836       id: "add-note",
53837       button: "note",
53838       description: _t.append("modes.add_note.description"),
53839       key: _t("modes.add_note.key")
53840     };
53841     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
53842     function add(loc) {
53843       var osm = services.osm;
53844       if (!osm) return;
53845       var note = osmNote({ loc, status: "open", comments: [] });
53846       osm.replaceNote(note);
53847       context.map().pan([0, 0]);
53848       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
53849     }
53850     function cancel() {
53851       context.enter(modeBrowse(context));
53852     }
53853     mode.enter = function() {
53854       context.install(behavior);
53855     };
53856     mode.exit = function() {
53857       context.uninstall(behavior);
53858     };
53859     return mode;
53860   }
53861   var init_add_note = __esm({
53862     "modules/modes/add_note.js"() {
53863       "use strict";
53864       init_localizer();
53865       init_draw();
53866       init_browse();
53867       init_select_note();
53868       init_osm();
53869       init_services();
53870     }
53871   });
53872
53873   // modules/operations/move.js
53874   var move_exports2 = {};
53875   __export(move_exports2, {
53876     operationMove: () => operationMove
53877   });
53878   function operationMove(context, selectedIDs) {
53879     var multi = selectedIDs.length === 1 ? "single" : "multiple";
53880     var nodes = utilGetAllNodes(selectedIDs, context.graph());
53881     var coords = nodes.map(function(n3) {
53882       return n3.loc;
53883     });
53884     var extent = utilTotalExtent(selectedIDs, context.graph());
53885     var operation2 = function() {
53886       context.enter(modeMove(context, selectedIDs));
53887     };
53888     operation2.available = function() {
53889       return selectedIDs.length > 0;
53890     };
53891     operation2.disabled = function() {
53892       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
53893         return "too_large";
53894       } else if (someMissing()) {
53895         return "not_downloaded";
53896       } else if (selectedIDs.some(context.hasHiddenConnections)) {
53897         return "connected_to_hidden";
53898       } else if (selectedIDs.some(incompleteRelation)) {
53899         return "incomplete_relation";
53900       }
53901       return false;
53902       function someMissing() {
53903         if (context.inIntro()) return false;
53904         var osm = context.connection();
53905         if (osm) {
53906           var missing = coords.filter(function(loc) {
53907             return !osm.isDataLoaded(loc);
53908           });
53909           if (missing.length) {
53910             missing.forEach(function(loc) {
53911               context.loadTileAtLoc(loc);
53912             });
53913             return true;
53914           }
53915         }
53916         return false;
53917       }
53918       function incompleteRelation(id2) {
53919         var entity = context.entity(id2);
53920         return entity.type === "relation" && !entity.isComplete(context.graph());
53921       }
53922     };
53923     operation2.tooltip = function() {
53924       var disable = operation2.disabled();
53925       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
53926     };
53927     operation2.annotation = function() {
53928       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
53929     };
53930     operation2.id = "move";
53931     operation2.keys = [_t("operations.move.key")];
53932     operation2.title = _t.append("operations.move.title");
53933     operation2.behavior = behaviorOperation(context).which(operation2);
53934     operation2.mouseOnly = true;
53935     return operation2;
53936   }
53937   var init_move2 = __esm({
53938     "modules/operations/move.js"() {
53939       "use strict";
53940       init_localizer();
53941       init_operation();
53942       init_move3();
53943       init_util2();
53944     }
53945   });
53946
53947   // modules/operations/orthogonalize.js
53948   var orthogonalize_exports2 = {};
53949   __export(orthogonalize_exports2, {
53950     operationOrthogonalize: () => operationOrthogonalize
53951   });
53952   function operationOrthogonalize(context, selectedIDs) {
53953     var _extent;
53954     var _type;
53955     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
53956     var _amount = _actions.length === 1 ? "single" : "multiple";
53957     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
53958       return n3.loc;
53959     });
53960     function chooseAction(entityID) {
53961       var entity = context.entity(entityID);
53962       var geometry = entity.geometry(context.graph());
53963       if (!_extent) {
53964         _extent = entity.extent(context.graph());
53965       } else {
53966         _extent = _extent.extend(entity.extent(context.graph()));
53967       }
53968       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
53969         if (_type && _type !== "feature") return null;
53970         _type = "feature";
53971         return actionOrthogonalize(entityID, context.projection);
53972       } else if (geometry === "vertex") {
53973         if (_type && _type !== "corner") return null;
53974         _type = "corner";
53975         var graph = context.graph();
53976         var parents = graph.parentWays(entity);
53977         if (parents.length === 1) {
53978           var way = parents[0];
53979           if (way.nodes.indexOf(entityID) !== -1) {
53980             return actionOrthogonalize(way.id, context.projection, entityID);
53981           }
53982         }
53983       }
53984       return null;
53985     }
53986     var operation2 = function() {
53987       if (!_actions.length) return;
53988       var combinedAction = function(graph, t2) {
53989         _actions.forEach(function(action) {
53990           if (!action.disabled(graph)) {
53991             graph = action(graph, t2);
53992           }
53993         });
53994         return graph;
53995       };
53996       combinedAction.transitionable = true;
53997       context.perform(combinedAction, operation2.annotation());
53998       window.setTimeout(function() {
53999         context.validator().validate();
54000       }, 300);
54001     };
54002     operation2.available = function() {
54003       return _actions.length && selectedIDs.length === _actions.length;
54004     };
54005     operation2.disabled = function() {
54006       if (!_actions.length) return "";
54007       var actionDisableds = _actions.map(function(action) {
54008         return action.disabled(context.graph());
54009       }).filter(Boolean);
54010       if (actionDisableds.length === _actions.length) {
54011         if (new Set(actionDisableds).size > 1) {
54012           return "multiple_blockers";
54013         }
54014         return actionDisableds[0];
54015       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
54016         return "too_large";
54017       } else if (someMissing()) {
54018         return "not_downloaded";
54019       } else if (selectedIDs.some(context.hasHiddenConnections)) {
54020         return "connected_to_hidden";
54021       }
54022       return false;
54023       function someMissing() {
54024         if (context.inIntro()) return false;
54025         var osm = context.connection();
54026         if (osm) {
54027           var missing = _coords.filter(function(loc) {
54028             return !osm.isDataLoaded(loc);
54029           });
54030           if (missing.length) {
54031             missing.forEach(function(loc) {
54032               context.loadTileAtLoc(loc);
54033             });
54034             return true;
54035           }
54036         }
54037         return false;
54038       }
54039     };
54040     operation2.tooltip = function() {
54041       var disable = operation2.disabled();
54042       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
54043     };
54044     operation2.annotation = function() {
54045       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
54046     };
54047     operation2.id = "orthogonalize";
54048     operation2.keys = [_t("operations.orthogonalize.key")];
54049     operation2.title = _t.append("operations.orthogonalize.title");
54050     operation2.behavior = behaviorOperation(context).which(operation2);
54051     return operation2;
54052   }
54053   var init_orthogonalize2 = __esm({
54054     "modules/operations/orthogonalize.js"() {
54055       "use strict";
54056       init_localizer();
54057       init_orthogonalize();
54058       init_operation();
54059       init_util();
54060     }
54061   });
54062
54063   // modules/operations/reflect.js
54064   var reflect_exports2 = {};
54065   __export(reflect_exports2, {
54066     operationReflect: () => operationReflect,
54067     operationReflectLong: () => operationReflectLong,
54068     operationReflectShort: () => operationReflectShort
54069   });
54070   function operationReflectShort(context, selectedIDs) {
54071     return operationReflect(context, selectedIDs, "short");
54072   }
54073   function operationReflectLong(context, selectedIDs) {
54074     return operationReflect(context, selectedIDs, "long");
54075   }
54076   function operationReflect(context, selectedIDs, axis) {
54077     axis = axis || "long";
54078     var multi = selectedIDs.length === 1 ? "single" : "multiple";
54079     var nodes = utilGetAllNodes(selectedIDs, context.graph());
54080     var coords = nodes.map(function(n3) {
54081       return n3.loc;
54082     });
54083     var extent = utilTotalExtent(selectedIDs, context.graph());
54084     var operation2 = function() {
54085       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
54086       context.perform(action, operation2.annotation());
54087       window.setTimeout(function() {
54088         context.validator().validate();
54089       }, 300);
54090     };
54091     operation2.available = function() {
54092       return nodes.length >= 3;
54093     };
54094     operation2.disabled = function() {
54095       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
54096         return "too_large";
54097       } else if (someMissing()) {
54098         return "not_downloaded";
54099       } else if (selectedIDs.some(context.hasHiddenConnections)) {
54100         return "connected_to_hidden";
54101       } else if (selectedIDs.some(incompleteRelation)) {
54102         return "incomplete_relation";
54103       }
54104       return false;
54105       function someMissing() {
54106         if (context.inIntro()) return false;
54107         var osm = context.connection();
54108         if (osm) {
54109           var missing = coords.filter(function(loc) {
54110             return !osm.isDataLoaded(loc);
54111           });
54112           if (missing.length) {
54113             missing.forEach(function(loc) {
54114               context.loadTileAtLoc(loc);
54115             });
54116             return true;
54117           }
54118         }
54119         return false;
54120       }
54121       function incompleteRelation(id2) {
54122         var entity = context.entity(id2);
54123         return entity.type === "relation" && !entity.isComplete(context.graph());
54124       }
54125     };
54126     operation2.tooltip = function() {
54127       var disable = operation2.disabled();
54128       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
54129     };
54130     operation2.annotation = function() {
54131       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
54132     };
54133     operation2.id = "reflect-" + axis;
54134     operation2.keys = [_t("operations.reflect.key." + axis)];
54135     operation2.title = _t.append("operations.reflect.title." + axis);
54136     operation2.behavior = behaviorOperation(context).which(operation2);
54137     return operation2;
54138   }
54139   var init_reflect2 = __esm({
54140     "modules/operations/reflect.js"() {
54141       "use strict";
54142       init_localizer();
54143       init_reflect();
54144       init_operation();
54145       init_util2();
54146     }
54147   });
54148
54149   // modules/modes/rotate.js
54150   var rotate_exports2 = {};
54151   __export(rotate_exports2, {
54152     modeRotate: () => modeRotate
54153   });
54154   function modeRotate(context, entityIDs) {
54155     var _tolerancePx = 4;
54156     var mode = {
54157       id: "rotate",
54158       button: "browse"
54159     };
54160     var keybinding = utilKeybinding("rotate");
54161     var behaviors = [
54162       behaviorEdit(context),
54163       operationCircularize(context, entityIDs).behavior,
54164       operationDelete(context, entityIDs).behavior,
54165       operationMove(context, entityIDs).behavior,
54166       operationOrthogonalize(context, entityIDs).behavior,
54167       operationReflectLong(context, entityIDs).behavior,
54168       operationReflectShort(context, entityIDs).behavior
54169     ];
54170     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
54171     var _prevGraph;
54172     var _prevAngle;
54173     var _prevTransform;
54174     var _pivot;
54175     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54176     function doRotate(d3_event) {
54177       var fn;
54178       if (context.graph() !== _prevGraph) {
54179         fn = context.perform;
54180       } else {
54181         fn = context.replace;
54182       }
54183       var projection2 = context.projection;
54184       var currTransform = projection2.transform();
54185       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
54186         var nodes = utilGetAllNodes(entityIDs, context.graph());
54187         var points = nodes.map(function(n3) {
54188           return projection2(n3.loc);
54189         });
54190         _pivot = getPivot(points);
54191         _prevAngle = void 0;
54192       }
54193       var currMouse = context.map().mouse(d3_event);
54194       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
54195       if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
54196       var delta = currAngle - _prevAngle;
54197       fn(actionRotate(entityIDs, _pivot, delta, projection2));
54198       _prevTransform = currTransform;
54199       _prevAngle = currAngle;
54200       _prevGraph = context.graph();
54201     }
54202     function getPivot(points) {
54203       var _pivot2;
54204       if (points.length === 1) {
54205         _pivot2 = points[0];
54206       } else if (points.length === 2) {
54207         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
54208       } else {
54209         var polygonHull = hull_default(points);
54210         if (polygonHull.length === 2) {
54211           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
54212         } else {
54213           _pivot2 = centroid_default2(hull_default(points));
54214         }
54215       }
54216       return _pivot2;
54217     }
54218     function finish(d3_event) {
54219       d3_event.stopPropagation();
54220       context.replace(actionNoop(), annotation);
54221       context.enter(modeSelect(context, entityIDs));
54222     }
54223     function cancel() {
54224       if (_prevGraph) context.pop();
54225       context.enter(modeSelect(context, entityIDs));
54226     }
54227     function undone() {
54228       context.enter(modeBrowse(context));
54229     }
54230     mode.enter = function() {
54231       _prevGraph = null;
54232       context.features().forceVisible(entityIDs);
54233       behaviors.forEach(context.install);
54234       var downEvent;
54235       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
54236         downEvent = d3_event;
54237       });
54238       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
54239         if (!downEvent) return;
54240         var mapNode = context.container().select(".main-map").node();
54241         var pointGetter = utilFastMouse(mapNode);
54242         var p1 = pointGetter(downEvent);
54243         var p2 = pointGetter(d3_event);
54244         var dist = geoVecLength(p1, p2);
54245         if (dist <= _tolerancePx) finish(d3_event);
54246         downEvent = null;
54247       }, true);
54248       context.history().on("undone.modeRotate", undone);
54249       keybinding.on("\u238B", cancel).on("\u21A9", finish);
54250       select_default2(document).call(keybinding);
54251     };
54252     mode.exit = function() {
54253       behaviors.forEach(context.uninstall);
54254       context.surface().on(_pointerPrefix + "down.modeRotate", null);
54255       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
54256       context.history().on("undone.modeRotate", null);
54257       select_default2(document).call(keybinding.unbind);
54258       context.features().forceVisible([]);
54259     };
54260     mode.selectedIDs = function() {
54261       if (!arguments.length) return entityIDs;
54262       return mode;
54263     };
54264     return mode;
54265   }
54266   var init_rotate2 = __esm({
54267     "modules/modes/rotate.js"() {
54268       "use strict";
54269       init_src5();
54270       init_src3();
54271       init_localizer();
54272       init_rotate();
54273       init_noop2();
54274       init_edit();
54275       init_vector();
54276       init_browse();
54277       init_select5();
54278       init_circularize2();
54279       init_delete();
54280       init_move2();
54281       init_orthogonalize2();
54282       init_reflect2();
54283       init_keybinding();
54284       init_util2();
54285     }
54286   });
54287
54288   // modules/ui/conflicts.js
54289   var conflicts_exports = {};
54290   __export(conflicts_exports, {
54291     uiConflicts: () => uiConflicts
54292   });
54293   function uiConflicts(context) {
54294     var dispatch14 = dispatch_default("cancel", "save");
54295     var keybinding = utilKeybinding("conflicts");
54296     var _origChanges;
54297     var _conflictList;
54298     var _shownConflictIndex;
54299     function keybindingOn() {
54300       select_default2(document).call(keybinding.on("\u238B", cancel, true));
54301     }
54302     function keybindingOff() {
54303       select_default2(document).call(keybinding.unbind);
54304     }
54305     function tryAgain() {
54306       keybindingOff();
54307       dispatch14.call("save");
54308     }
54309     function cancel() {
54310       keybindingOff();
54311       dispatch14.call("cancel");
54312     }
54313     function conflicts(selection2) {
54314       keybindingOn();
54315       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
54316       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
54317       headerEnter.append("h2").call(_t.append("save.conflict.header"));
54318       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
54319       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
54320       var changeset = new osmChangeset();
54321       delete changeset.id;
54322       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
54323       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
54324       var fileName = "changes.osc";
54325       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
54326       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
54327       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
54328       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
54329       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
54330       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
54331       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
54332       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
54333     }
54334     function showConflict(selection2, index) {
54335       index = utilWrap(index, _conflictList.length);
54336       _shownConflictIndex = index;
54337       var parent2 = select_default2(selection2.node().parentNode);
54338       if (index === _conflictList.length - 1) {
54339         window.setTimeout(function() {
54340           parent2.select(".conflicts-button").attr("disabled", null);
54341           parent2.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
54342         }, 250);
54343       }
54344       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
54345       conflict.exit().remove();
54346       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
54347       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
54348       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
54349         return d2.name;
54350       }).on("click", function(d3_event, d2) {
54351         d3_event.preventDefault();
54352         zoomToEntity(d2.id);
54353       });
54354       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
54355       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
54356         return d2.details || [];
54357       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
54358         return d2;
54359       });
54360       details.append("div").attr("class", "conflict-choices").call(addChoices);
54361       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(d2, i3) {
54362         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
54363       }).on("click", function(d3_event, d2) {
54364         d3_event.preventDefault();
54365         var container = parent2.selectAll(".conflict-container");
54366         var sign2 = d2 === "previous" ? -1 : 1;
54367         container.selectAll(".conflict").remove();
54368         container.call(showConflict, index + sign2);
54369       }).each(function(d2) {
54370         _t.append("save.conflict." + d2)(select_default2(this));
54371       });
54372     }
54373     function addChoices(selection2) {
54374       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
54375         return d2.choices || [];
54376       });
54377       var choicesEnter = choices.enter().append("li").attr("class", "layer");
54378       var labelEnter = choicesEnter.append("label");
54379       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
54380         return d2.id;
54381       }).on("change", function(d3_event, d2) {
54382         var ul = this.parentNode.parentNode.parentNode;
54383         ul.__data__.chosen = d2.id;
54384         choose(d3_event, ul, d2);
54385       });
54386       labelEnter.append("span").text(function(d2) {
54387         return d2.text;
54388       });
54389       choicesEnter.merge(choices).each(function(d2) {
54390         var ul = this.parentNode;
54391         if (ul.__data__.chosen === d2.id) {
54392           choose(null, ul, d2);
54393         }
54394       });
54395     }
54396     function choose(d3_event, ul, datum2) {
54397       if (d3_event) d3_event.preventDefault();
54398       select_default2(ul).selectAll("li").classed("active", function(d2) {
54399         return d2 === datum2;
54400       }).selectAll("input").property("checked", function(d2) {
54401         return d2 === datum2;
54402       });
54403       var extent = geoExtent();
54404       var entity;
54405       entity = context.graph().hasEntity(datum2.id);
54406       if (entity) extent._extend(entity.extent(context.graph()));
54407       datum2.action();
54408       entity = context.graph().hasEntity(datum2.id);
54409       if (entity) extent._extend(entity.extent(context.graph()));
54410       zoomToEntity(datum2.id, extent);
54411     }
54412     function zoomToEntity(id2, extent) {
54413       context.surface().selectAll(".hover").classed("hover", false);
54414       var entity = context.graph().hasEntity(id2);
54415       if (entity) {
54416         if (extent) {
54417           context.map().trimmedExtent(extent);
54418         } else {
54419           context.map().zoomToEase(entity);
54420         }
54421         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
54422       }
54423     }
54424     conflicts.conflictList = function(_3) {
54425       if (!arguments.length) return _conflictList;
54426       _conflictList = _3;
54427       return conflicts;
54428     };
54429     conflicts.origChanges = function(_3) {
54430       if (!arguments.length) return _origChanges;
54431       _origChanges = _3;
54432       return conflicts;
54433     };
54434     conflicts.shownEntityIds = function() {
54435       if (_conflictList && typeof _shownConflictIndex === "number") {
54436         return [_conflictList[_shownConflictIndex].id];
54437       }
54438       return [];
54439     };
54440     return utilRebind(conflicts, dispatch14, "on");
54441   }
54442   var init_conflicts = __esm({
54443     "modules/ui/conflicts.js"() {
54444       "use strict";
54445       init_src4();
54446       init_src5();
54447       init_localizer();
54448       init_jxon();
54449       init_geo2();
54450       init_osm();
54451       init_icon();
54452       init_util();
54453     }
54454   });
54455
54456   // modules/ui/confirm.js
54457   var confirm_exports = {};
54458   __export(confirm_exports, {
54459     uiConfirm: () => uiConfirm
54460   });
54461   function uiConfirm(selection2) {
54462     var modalSelection = uiModal(selection2);
54463     modalSelection.select(".modal").classed("modal-alert", true);
54464     var section = modalSelection.select(".content");
54465     section.append("div").attr("class", "modal-section header");
54466     section.append("div").attr("class", "modal-section message-text");
54467     var buttons = section.append("div").attr("class", "modal-section buttons cf");
54468     modalSelection.okButton = function() {
54469       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
54470         modalSelection.remove();
54471       }).call(_t.append("confirm.okay")).node().focus();
54472       return modalSelection;
54473     };
54474     return modalSelection;
54475   }
54476   var init_confirm = __esm({
54477     "modules/ui/confirm.js"() {
54478       "use strict";
54479       init_localizer();
54480       init_modal();
54481     }
54482   });
54483
54484   // modules/ui/popover.js
54485   var popover_exports = {};
54486   __export(popover_exports, {
54487     uiPopover: () => uiPopover
54488   });
54489   function uiPopover(klass) {
54490     var _id = _popoverID++;
54491     var _anchorSelection = select_default2(null);
54492     var popover = function(selection2) {
54493       _anchorSelection = selection2;
54494       selection2.each(setup);
54495     };
54496     var _animation = utilFunctor(false);
54497     var _placement = utilFunctor("top");
54498     var _alignment = utilFunctor("center");
54499     var _scrollContainer = utilFunctor(select_default2(null));
54500     var _content;
54501     var _displayType = utilFunctor("");
54502     var _hasArrow = utilFunctor(true);
54503     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54504     popover.displayType = function(val) {
54505       if (arguments.length) {
54506         _displayType = utilFunctor(val);
54507         return popover;
54508       } else {
54509         return _displayType;
54510       }
54511     };
54512     popover.hasArrow = function(val) {
54513       if (arguments.length) {
54514         _hasArrow = utilFunctor(val);
54515         return popover;
54516       } else {
54517         return _hasArrow;
54518       }
54519     };
54520     popover.placement = function(val) {
54521       if (arguments.length) {
54522         _placement = utilFunctor(val);
54523         return popover;
54524       } else {
54525         return _placement;
54526       }
54527     };
54528     popover.alignment = function(val) {
54529       if (arguments.length) {
54530         _alignment = utilFunctor(val);
54531         return popover;
54532       } else {
54533         return _alignment;
54534       }
54535     };
54536     popover.scrollContainer = function(val) {
54537       if (arguments.length) {
54538         _scrollContainer = utilFunctor(val);
54539         return popover;
54540       } else {
54541         return _scrollContainer;
54542       }
54543     };
54544     popover.content = function(val) {
54545       if (arguments.length) {
54546         _content = val;
54547         return popover;
54548       } else {
54549         return _content;
54550       }
54551     };
54552     popover.isShown = function() {
54553       var popoverSelection = _anchorSelection.select(".popover-" + _id);
54554       return !popoverSelection.empty() && popoverSelection.classed("in");
54555     };
54556     popover.show = function() {
54557       _anchorSelection.each(show);
54558     };
54559     popover.updateContent = function() {
54560       _anchorSelection.each(updateContent);
54561     };
54562     popover.hide = function() {
54563       _anchorSelection.each(hide);
54564     };
54565     popover.toggle = function() {
54566       _anchorSelection.each(toggle);
54567     };
54568     popover.destroy = function(selection2, selector) {
54569       selector = selector || ".popover-" + _id;
54570       selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("focus.popover", null).on("blur.popover", null).on("click.popover", null).attr("title", function() {
54571         return this.getAttribute("data-original-title") || this.getAttribute("title");
54572       }).attr("data-original-title", null).selectAll(selector).remove();
54573     };
54574     popover.destroyAny = function(selection2) {
54575       selection2.call(popover.destroy, ".popover");
54576     };
54577     function setup() {
54578       var anchor = select_default2(this);
54579       var animate = _animation.apply(this, arguments);
54580       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
54581       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
54582       enter.append("div").attr("class", "popover-arrow");
54583       enter.append("div").attr("class", "popover-inner");
54584       popoverSelection = enter.merge(popoverSelection);
54585       if (animate) {
54586         popoverSelection.classed("fade", true);
54587       }
54588       var display = _displayType.apply(this, arguments);
54589       if (display === "hover") {
54590         var _lastNonMouseEnterTime;
54591         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
54592           if (d3_event.pointerType) {
54593             if (d3_event.pointerType !== "mouse") {
54594               _lastNonMouseEnterTime = d3_event.timeStamp;
54595               return;
54596             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
54597               return;
54598             }
54599           }
54600           if (d3_event.buttons !== 0) return;
54601           show.apply(this, arguments);
54602         }).on(_pointerPrefix + "leave.popover", function() {
54603           hide.apply(this, arguments);
54604         }).on("focus.popover", function() {
54605           show.apply(this, arguments);
54606         }).on("blur.popover", function() {
54607           hide.apply(this, arguments);
54608         });
54609       } else if (display === "clickFocus") {
54610         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
54611           d3_event.preventDefault();
54612           d3_event.stopPropagation();
54613         }).on(_pointerPrefix + "up.popover", function(d3_event) {
54614           d3_event.preventDefault();
54615           d3_event.stopPropagation();
54616         }).on("click.popover", toggle);
54617         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
54618           anchor.each(function() {
54619             hide.apply(this, arguments);
54620           });
54621         });
54622       }
54623     }
54624     function show() {
54625       var anchor = select_default2(this);
54626       var popoverSelection = anchor.selectAll(".popover-" + _id);
54627       if (popoverSelection.empty()) {
54628         anchor.call(popover.destroy);
54629         anchor.each(setup);
54630         popoverSelection = anchor.selectAll(".popover-" + _id);
54631       }
54632       popoverSelection.classed("in", true);
54633       var displayType = _displayType.apply(this, arguments);
54634       if (displayType === "clickFocus") {
54635         anchor.classed("active", true);
54636         popoverSelection.node().focus();
54637       }
54638       anchor.each(updateContent);
54639     }
54640     function updateContent() {
54641       var anchor = select_default2(this);
54642       if (_content) {
54643         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
54644       }
54645       updatePosition.apply(this, arguments);
54646       updatePosition.apply(this, arguments);
54647       updatePosition.apply(this, arguments);
54648     }
54649     function updatePosition() {
54650       var anchor = select_default2(this);
54651       var popoverSelection = anchor.selectAll(".popover-" + _id);
54652       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
54653       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
54654       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
54655       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
54656       var placement = _placement.apply(this, arguments);
54657       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
54658       var alignment = _alignment.apply(this, arguments);
54659       var alignFactor = 0.5;
54660       if (alignment === "leading") {
54661         alignFactor = 0;
54662       } else if (alignment === "trailing") {
54663         alignFactor = 1;
54664       }
54665       var anchorFrame = getFrame(anchor.node());
54666       var popoverFrame = getFrame(popoverSelection.node());
54667       var position;
54668       switch (placement) {
54669         case "top":
54670           position = {
54671             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
54672             y: anchorFrame.y - popoverFrame.h
54673           };
54674           break;
54675         case "bottom":
54676           position = {
54677             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
54678             y: anchorFrame.y + anchorFrame.h
54679           };
54680           break;
54681         case "left":
54682           position = {
54683             x: anchorFrame.x - popoverFrame.w,
54684             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
54685           };
54686           break;
54687         case "right":
54688           position = {
54689             x: anchorFrame.x + anchorFrame.w,
54690             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
54691           };
54692           break;
54693       }
54694       if (position) {
54695         if (scrollNode && (placement === "top" || placement === "bottom")) {
54696           var initialPosX = position.x;
54697           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
54698             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
54699           } else if (position.x < 10) {
54700             position.x = 10;
54701           }
54702           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
54703           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
54704           arrow.style("left", ~~arrowPosX + "px");
54705         }
54706         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
54707       } else {
54708         popoverSelection.style("left", null).style("top", null);
54709       }
54710       function getFrame(node) {
54711         var positionStyle = select_default2(node).style("position");
54712         if (positionStyle === "absolute" || positionStyle === "static") {
54713           return {
54714             x: node.offsetLeft - scrollLeft,
54715             y: node.offsetTop - scrollTop,
54716             w: node.offsetWidth,
54717             h: node.offsetHeight
54718           };
54719         } else {
54720           return {
54721             x: 0,
54722             y: 0,
54723             w: node.offsetWidth,
54724             h: node.offsetHeight
54725           };
54726         }
54727       }
54728     }
54729     function hide() {
54730       var anchor = select_default2(this);
54731       if (_displayType.apply(this, arguments) === "clickFocus") {
54732         anchor.classed("active", false);
54733       }
54734       anchor.selectAll(".popover-" + _id).classed("in", false);
54735     }
54736     function toggle() {
54737       if (select_default2(this).select(".popover-" + _id).classed("in")) {
54738         hide.apply(this, arguments);
54739       } else {
54740         show.apply(this, arguments);
54741       }
54742     }
54743     return popover;
54744   }
54745   var _popoverID;
54746   var init_popover = __esm({
54747     "modules/ui/popover.js"() {
54748       "use strict";
54749       init_src5();
54750       init_util2();
54751       _popoverID = 0;
54752     }
54753   });
54754
54755   // modules/ui/tooltip.js
54756   var tooltip_exports = {};
54757   __export(tooltip_exports, {
54758     uiTooltip: () => uiTooltip
54759   });
54760   function uiTooltip(klass) {
54761     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
54762     var _title = function() {
54763       var title = this.getAttribute("data-original-title");
54764       if (title) {
54765         return title;
54766       } else {
54767         title = this.getAttribute("title");
54768         this.removeAttribute("title");
54769         this.setAttribute("data-original-title", title);
54770       }
54771       return title;
54772     };
54773     var _heading = utilFunctor(null);
54774     var _keys = utilFunctor(null);
54775     tooltip.title = function(val) {
54776       if (!arguments.length) return _title;
54777       _title = utilFunctor(val);
54778       return tooltip;
54779     };
54780     tooltip.heading = function(val) {
54781       if (!arguments.length) return _heading;
54782       _heading = utilFunctor(val);
54783       return tooltip;
54784     };
54785     tooltip.keys = function(val) {
54786       if (!arguments.length) return _keys;
54787       _keys = utilFunctor(val);
54788       return tooltip;
54789     };
54790     tooltip.content(function() {
54791       var heading = _heading.apply(this, arguments);
54792       var text = _title.apply(this, arguments);
54793       var keys2 = _keys.apply(this, arguments);
54794       var headingCallback = typeof heading === "function" ? heading : (s2) => s2.text(heading);
54795       var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
54796       return function(selection2) {
54797         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
54798         headingSelect.exit().remove();
54799         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
54800         var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
54801         textSelect.exit().remove();
54802         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
54803         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
54804         keyhintWrap.exit().remove();
54805         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
54806         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
54807         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
54808         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
54809           return d2;
54810         });
54811       };
54812     });
54813     return tooltip;
54814   }
54815   var init_tooltip = __esm({
54816     "modules/ui/tooltip.js"() {
54817       "use strict";
54818       init_util2();
54819       init_localizer();
54820       init_popover();
54821     }
54822   });
54823
54824   // modules/ui/intro/helper.js
54825   var helper_exports = {};
54826   __export(helper_exports, {
54827     helpHtml: () => helpHtml,
54828     icon: () => icon,
54829     isMostlySquare: () => isMostlySquare,
54830     localize: () => localize,
54831     missingStrings: () => missingStrings,
54832     pad: () => pad2,
54833     pointBox: () => pointBox,
54834     selectMenuItem: () => selectMenuItem,
54835     transitionTime: () => transitionTime
54836   });
54837   function pointBox(loc, context) {
54838     var rect = context.surfaceRect();
54839     var point = context.curtainProjection(loc);
54840     return {
54841       left: point[0] + rect.left - 40,
54842       top: point[1] + rect.top - 60,
54843       width: 80,
54844       height: 90
54845     };
54846   }
54847   function pad2(locOrBox, padding, context) {
54848     var box;
54849     if (locOrBox instanceof Array) {
54850       var rect = context.surfaceRect();
54851       var point = context.curtainProjection(locOrBox);
54852       box = {
54853         left: point[0] + rect.left,
54854         top: point[1] + rect.top
54855       };
54856     } else {
54857       box = locOrBox;
54858     }
54859     return {
54860       left: box.left - padding,
54861       top: box.top - padding,
54862       width: (box.width || 0) + 2 * padding,
54863       height: (box.width || 0) + 2 * padding
54864     };
54865   }
54866   function icon(name, svgklass, useklass) {
54867     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
54868   }
54869   function helpHtml(id2, replacements) {
54870     if (!helpStringReplacements) {
54871       helpStringReplacements = {
54872         // insert icons corresponding to various UI elements
54873         point_icon: icon("#iD-icon-point", "inline"),
54874         line_icon: icon("#iD-icon-line", "inline"),
54875         area_icon: icon("#iD-icon-area", "inline"),
54876         note_icon: icon("#iD-icon-note", "inline add-note"),
54877         plus: icon("#iD-icon-plus", "inline"),
54878         minus: icon("#iD-icon-minus", "inline"),
54879         layers_icon: icon("#iD-icon-layers", "inline"),
54880         data_icon: icon("#iD-icon-data", "inline"),
54881         inspect: icon("#iD-icon-inspect", "inline"),
54882         help_icon: icon("#iD-icon-help", "inline"),
54883         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
54884         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
54885         save_icon: icon("#iD-icon-save", "inline"),
54886         // operation icons
54887         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
54888         continue_icon: icon("#iD-operation-continue", "inline operation"),
54889         copy_icon: icon("#iD-operation-copy", "inline operation"),
54890         delete_icon: icon("#iD-operation-delete", "inline operation"),
54891         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
54892         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
54893         extract_icon: icon("#iD-operation-extract", "inline operation"),
54894         merge_icon: icon("#iD-operation-merge", "inline operation"),
54895         move_icon: icon("#iD-operation-move", "inline operation"),
54896         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
54897         paste_icon: icon("#iD-operation-paste", "inline operation"),
54898         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
54899         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
54900         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
54901         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
54902         split_icon: icon("#iD-operation-split", "inline operation"),
54903         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
54904         // interaction icons
54905         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
54906         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
54907         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
54908         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
54909         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
54910         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
54911         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
54912         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
54913         // insert keys; may be localized and platform-dependent
54914         shift: uiCmd.display("\u21E7"),
54915         alt: uiCmd.display("\u2325"),
54916         return: uiCmd.display("\u21B5"),
54917         esc: _t.html("shortcuts.key.esc"),
54918         space: _t.html("shortcuts.key.space"),
54919         add_note_key: _t.html("modes.add_note.key"),
54920         help_key: _t.html("help.key"),
54921         shortcuts_key: _t.html("shortcuts.toggle.key"),
54922         // reference localized UI labels directly so that they'll always match
54923         save: _t.html("save.title"),
54924         undo: _t.html("undo.title"),
54925         redo: _t.html("redo.title"),
54926         upload: _t.html("commit.save"),
54927         point: _t.html("modes.add_point.title"),
54928         line: _t.html("modes.add_line.title"),
54929         area: _t.html("modes.add_area.title"),
54930         note: _t.html("modes.add_note.label"),
54931         circularize: _t.html("operations.circularize.title"),
54932         continue: _t.html("operations.continue.title"),
54933         copy: _t.html("operations.copy.title"),
54934         delete: _t.html("operations.delete.title"),
54935         disconnect: _t.html("operations.disconnect.title"),
54936         downgrade: _t.html("operations.downgrade.title"),
54937         extract: _t.html("operations.extract.title"),
54938         merge: _t.html("operations.merge.title"),
54939         move: _t.html("operations.move.title"),
54940         orthogonalize: _t.html("operations.orthogonalize.title"),
54941         paste: _t.html("operations.paste.title"),
54942         reflect_long: _t.html("operations.reflect.title.long"),
54943         reflect_short: _t.html("operations.reflect.title.short"),
54944         reverse: _t.html("operations.reverse.title"),
54945         rotate: _t.html("operations.rotate.title"),
54946         split: _t.html("operations.split.title"),
54947         straighten: _t.html("operations.straighten.title"),
54948         map_data: _t.html("map_data.title"),
54949         osm_notes: _t.html("map_data.layers.notes.title"),
54950         fields: _t.html("inspector.fields"),
54951         tags: _t.html("inspector.tags"),
54952         relations: _t.html("inspector.relations"),
54953         new_relation: _t.html("inspector.new_relation"),
54954         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
54955         background_settings: _t.html("background.description"),
54956         imagery_offset: _t.html("background.fix_misalignment"),
54957         start_the_walkthrough: _t.html("splash.walkthrough"),
54958         help: _t.html("help.title"),
54959         ok: _t.html("intro.ok")
54960       };
54961       for (var key in helpStringReplacements) {
54962         helpStringReplacements[key] = { html: helpStringReplacements[key] };
54963       }
54964     }
54965     var reps;
54966     if (replacements) {
54967       reps = Object.assign(replacements, helpStringReplacements);
54968     } else {
54969       reps = helpStringReplacements;
54970     }
54971     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
54972   }
54973   function slugify(text) {
54974     return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
54975   }
54976   function checkKey(key, text) {
54977     if (_t(key, { default: void 0 }) === void 0) {
54978       if (missingStrings.hasOwnProperty(key)) return;
54979       missingStrings[key] = text;
54980       var missing = key + ": " + text;
54981       if (typeof console !== "undefined") console.log(missing);
54982     }
54983   }
54984   function localize(obj) {
54985     var key;
54986     var name = obj.tags && obj.tags.name;
54987     if (name) {
54988       key = "intro.graph.name." + slugify(name);
54989       obj.tags.name = _t(key, { default: name });
54990       checkKey(key, name);
54991     }
54992     var street = obj.tags && obj.tags["addr:street"];
54993     if (street) {
54994       key = "intro.graph.name." + slugify(street);
54995       obj.tags["addr:street"] = _t(key, { default: street });
54996       checkKey(key, street);
54997       var addrTags = [
54998         "block_number",
54999         "city",
55000         "county",
55001         "district",
55002         "hamlet",
55003         "neighbourhood",
55004         "postcode",
55005         "province",
55006         "quarter",
55007         "state",
55008         "subdistrict",
55009         "suburb"
55010       ];
55011       addrTags.forEach(function(k3) {
55012         var key2 = "intro.graph." + k3;
55013         var tag = "addr:" + k3;
55014         var val = obj.tags && obj.tags[tag];
55015         var str = _t(key2, { default: val });
55016         if (str) {
55017           if (str.match(/^<.*>$/) !== null) {
55018             delete obj.tags[tag];
55019           } else {
55020             obj.tags[tag] = str;
55021           }
55022         }
55023       });
55024     }
55025     return obj;
55026   }
55027   function isMostlySquare(points) {
55028     var threshold = 15;
55029     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
55030     var upperBound = Math.cos(threshold * Math.PI / 180);
55031     for (var i3 = 0; i3 < points.length; i3++) {
55032       var a4 = points[(i3 - 1 + points.length) % points.length];
55033       var origin = points[i3];
55034       var b3 = points[(i3 + 1) % points.length];
55035       var dotp = geoVecNormalizedDot(a4, b3, origin);
55036       var mag = Math.abs(dotp);
55037       if (mag > lowerBound && mag < upperBound) {
55038         return false;
55039       }
55040     }
55041     return true;
55042   }
55043   function selectMenuItem(context, operation2) {
55044     return context.container().select(".edit-menu .edit-menu-item-" + operation2);
55045   }
55046   function transitionTime(point1, point2) {
55047     var distance = geoSphericalDistance(point1, point2);
55048     if (distance === 0) {
55049       return 0;
55050     } else if (distance < 80) {
55051       return 500;
55052     } else {
55053       return 1e3;
55054     }
55055   }
55056   var helpStringReplacements, missingStrings;
55057   var init_helper = __esm({
55058     "modules/ui/intro/helper.js"() {
55059       "use strict";
55060       init_localizer();
55061       init_geo2();
55062       init_cmd();
55063       missingStrings = {};
55064     }
55065   });
55066
55067   // modules/ui/field_help.js
55068   var field_help_exports = {};
55069   __export(field_help_exports, {
55070     uiFieldHelp: () => uiFieldHelp
55071   });
55072   function uiFieldHelp(context, fieldName) {
55073     var fieldHelp = {};
55074     var _inspector = select_default2(null);
55075     var _wrap = select_default2(null);
55076     var _body = select_default2(null);
55077     var fieldHelpKeys = {
55078       restrictions: [
55079         ["about", [
55080           "about",
55081           "from_via_to",
55082           "maxdist",
55083           "maxvia"
55084         ]],
55085         ["inspecting", [
55086           "about",
55087           "from_shadow",
55088           "allow_shadow",
55089           "restrict_shadow",
55090           "only_shadow",
55091           "restricted",
55092           "only"
55093         ]],
55094         ["modifying", [
55095           "about",
55096           "indicators",
55097           "allow_turn",
55098           "restrict_turn",
55099           "only_turn"
55100         ]],
55101         ["tips", [
55102           "simple",
55103           "simple_example",
55104           "indirect",
55105           "indirect_example",
55106           "indirect_noedit"
55107         ]]
55108       ]
55109     };
55110     var fieldHelpHeadings = {};
55111     var replacements = {
55112       distField: { html: _t.html("restriction.controls.distance") },
55113       viaField: { html: _t.html("restriction.controls.via") },
55114       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
55115       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
55116       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
55117       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
55118       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
55119       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
55120       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
55121     };
55122     var docs = fieldHelpKeys[fieldName].map(function(key) {
55123       var helpkey = "help.field." + fieldName + "." + key[0];
55124       var text = key[1].reduce(function(all, part) {
55125         var subkey = helpkey + "." + part;
55126         var depth = fieldHelpHeadings[subkey];
55127         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
55128         return all + hhh + _t.html(subkey, replacements) + "\n\n";
55129       }, "");
55130       return {
55131         key: helpkey,
55132         title: _t.html(helpkey + ".title"),
55133         html: k(text.trim())
55134       };
55135     });
55136     function show() {
55137       updatePosition();
55138       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
55139     }
55140     function hide() {
55141       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
55142         _body.classed("hide", true);
55143       });
55144     }
55145     function clickHelp(index) {
55146       var d2 = docs[index];
55147       var tkeys = fieldHelpKeys[fieldName][index][1];
55148       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
55149         return i3 === index;
55150       });
55151       var content = _body.selectAll(".field-help-content").html(d2.html);
55152       content.selectAll("p").attr("class", function(d4, i3) {
55153         return tkeys[i3];
55154       });
55155       if (d2.key === "help.field.restrictions.inspecting") {
55156         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
55157       } else if (d2.key === "help.field.restrictions.modifying") {
55158         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
55159       }
55160     }
55161     fieldHelp.button = function(selection2) {
55162       if (_body.empty()) return;
55163       var button = selection2.selectAll(".field-help-button").data([0]);
55164       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
55165         d3_event.stopPropagation();
55166         d3_event.preventDefault();
55167         if (_body.classed("hide")) {
55168           show();
55169         } else {
55170           hide();
55171         }
55172       });
55173     };
55174     function updatePosition() {
55175       var wrap2 = _wrap.node();
55176       var inspector = _inspector.node();
55177       var wRect = wrap2.getBoundingClientRect();
55178       var iRect = inspector.getBoundingClientRect();
55179       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
55180     }
55181     fieldHelp.body = function(selection2) {
55182       _wrap = selection2.selectAll(".form-field-input-wrap");
55183       if (_wrap.empty()) return;
55184       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
55185       if (_inspector.empty()) return;
55186       _body = _inspector.selectAll(".field-help-body").data([0]);
55187       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
55188       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
55189       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
55190       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
55191         d3_event.stopPropagation();
55192         d3_event.preventDefault();
55193         hide();
55194       }).call(svgIcon("#iD-icon-close"));
55195       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
55196       var titles = docs.map(function(d2) {
55197         return d2.title;
55198       });
55199       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
55200         return d2;
55201       }).on("click", function(d3_event, d2) {
55202         d3_event.stopPropagation();
55203         d3_event.preventDefault();
55204         clickHelp(titles.indexOf(d2));
55205       });
55206       enter.append("div").attr("class", "field-help-content");
55207       _body = _body.merge(enter);
55208       clickHelp(0);
55209     };
55210     return fieldHelp;
55211   }
55212   var init_field_help = __esm({
55213     "modules/ui/field_help.js"() {
55214       "use strict";
55215       init_src5();
55216       init_marked_esm();
55217       init_localizer();
55218       init_icon();
55219       init_helper();
55220     }
55221   });
55222
55223   // modules/ui/fields/check.js
55224   var check_exports = {};
55225   __export(check_exports, {
55226     uiFieldCheck: () => uiFieldCheck,
55227     uiFieldDefaultCheck: () => uiFieldCheck,
55228     uiFieldOnewayCheck: () => uiFieldCheck
55229   });
55230   function uiFieldCheck(field, context) {
55231     var dispatch14 = dispatch_default("change");
55232     var options = field.options;
55233     var values = [];
55234     var texts = [];
55235     var _tags;
55236     var input = select_default2(null);
55237     var text = select_default2(null);
55238     var label = select_default2(null);
55239     var reverser = select_default2(null);
55240     var _impliedYes;
55241     var _entityIDs = [];
55242     var _value;
55243     var stringsField = field.resolveReference("stringsCrossReference");
55244     if (!options && stringsField.options) {
55245       options = stringsField.options;
55246     }
55247     if (options) {
55248       for (var i3 in options) {
55249         var v3 = options[i3];
55250         values.push(v3 === "undefined" ? void 0 : v3);
55251         texts.push(stringsField.t.html("options." + v3, { "default": v3 }));
55252       }
55253     } else {
55254       values = [void 0, "yes"];
55255       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
55256       if (field.type !== "defaultCheck") {
55257         values.push("no");
55258         texts.push(_t.html("inspector.check.no"));
55259       }
55260     }
55261     function checkImpliedYes() {
55262       _impliedYes = field.id === "oneway_yes";
55263       if (field.id === "oneway") {
55264         var entity = context.entity(_entityIDs[0]);
55265         if (entity.type === "way" && !!utilCheckTagDictionary(entity.tags, omit_default(osmOneWayTags, "oneway"))) {
55266           _impliedYes = true;
55267           texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
55268         }
55269       }
55270     }
55271     function reverserHidden() {
55272       if (!context.container().select("div.inspector-hover").empty()) return true;
55273       return !(_value === "yes" || _impliedYes && !_value);
55274     }
55275     function reverserSetText(selection2) {
55276       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
55277       if (reverserHidden() || !entity) return selection2;
55278       var first = entity.first();
55279       var last2 = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
55280       var pseudoDirection = first < last2;
55281       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
55282       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
55283       return selection2;
55284     }
55285     var check = function(selection2) {
55286       checkImpliedYes();
55287       label = selection2.selectAll(".form-field-input-wrap").data([0]);
55288       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
55289       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
55290       enter.append("span").html(texts[0]).attr("class", "value");
55291       if (field.type === "onewayCheck") {
55292         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
55293       }
55294       label = label.merge(enter);
55295       input = label.selectAll("input");
55296       text = label.selectAll("span.value");
55297       input.on("click", function(d3_event) {
55298         d3_event.stopPropagation();
55299         var t2 = {};
55300         if (Array.isArray(_tags[field.key])) {
55301           if (values.indexOf("yes") !== -1) {
55302             t2[field.key] = "yes";
55303           } else {
55304             t2[field.key] = values[0];
55305           }
55306         } else {
55307           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
55308         }
55309         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
55310           t2[field.key] = values[0];
55311         }
55312         dispatch14.call("change", this, t2);
55313       });
55314       if (field.type === "onewayCheck") {
55315         reverser = label.selectAll(".reverser");
55316         reverser.call(reverserSetText).on("click", function(d3_event) {
55317           d3_event.preventDefault();
55318           d3_event.stopPropagation();
55319           context.perform(
55320             function(graph) {
55321               for (var i4 in _entityIDs) {
55322                 graph = actionReverse(_entityIDs[i4])(graph);
55323               }
55324               return graph;
55325             },
55326             _t("operations.reverse.annotation.line", { n: 1 })
55327           );
55328           context.validator().validate();
55329           select_default2(this).call(reverserSetText);
55330         });
55331       }
55332     };
55333     check.entityIDs = function(val) {
55334       if (!arguments.length) return _entityIDs;
55335       _entityIDs = val;
55336       return check;
55337     };
55338     check.tags = function(tags) {
55339       _tags = tags;
55340       function isChecked(val) {
55341         return val !== "no" && val !== "" && val !== void 0 && val !== null;
55342       }
55343       function textFor(val) {
55344         if (val === "") val = void 0;
55345         var index = values.indexOf(val);
55346         return index !== -1 ? texts[index] : '"' + val + '"';
55347       }
55348       checkImpliedYes();
55349       var isMixed = Array.isArray(tags[field.key]);
55350       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
55351       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
55352         _value = "yes";
55353       }
55354       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
55355       text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
55356       label.classed("set", !!_value);
55357       if (field.type === "onewayCheck") {
55358         reverser.classed("hide", reverserHidden()).call(reverserSetText);
55359       }
55360     };
55361     check.focus = function() {
55362       input.node().focus();
55363     };
55364     return utilRebind(check, dispatch14, "on");
55365   }
55366   var init_check = __esm({
55367     "modules/ui/fields/check.js"() {
55368       "use strict";
55369       init_src4();
55370       init_src5();
55371       init_lodash();
55372       init_rebind();
55373       init_localizer();
55374       init_reverse();
55375       init_icon();
55376       init_util();
55377       init_tags();
55378     }
55379   });
55380
55381   // modules/svg/helpers.js
55382   var helpers_exports = {};
55383   __export(helpers_exports, {
55384     svgMarkerSegments: () => svgMarkerSegments,
55385     svgPassiveVertex: () => svgPassiveVertex,
55386     svgPath: () => svgPath,
55387     svgPointTransform: () => svgPointTransform,
55388     svgRelationMemberTags: () => svgRelationMemberTags,
55389     svgSegmentWay: () => svgSegmentWay
55390   });
55391   function svgPassiveVertex(node, graph, activeID) {
55392     if (!activeID) return 1;
55393     if (activeID === node.id) return 0;
55394     var parents = graph.parentWays(node);
55395     var i3, j3, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
55396     for (i3 = 0; i3 < parents.length; i3++) {
55397       nodes = parents[i3].nodes;
55398       isClosed = parents[i3].isClosed();
55399       for (j3 = 0; j3 < nodes.length; j3++) {
55400         if (nodes[j3] === node.id) {
55401           ix1 = j3 - 2;
55402           ix2 = j3 - 1;
55403           ix3 = j3 + 1;
55404           ix4 = j3 + 2;
55405           if (isClosed) {
55406             max3 = nodes.length - 1;
55407             if (ix1 < 0) ix1 = max3 + ix1;
55408             if (ix2 < 0) ix2 = max3 + ix2;
55409             if (ix3 > max3) ix3 = ix3 - max3;
55410             if (ix4 > max3) ix4 = ix4 - max3;
55411           }
55412           if (nodes[ix1] === activeID) return 0;
55413           else if (nodes[ix2] === activeID) return 2;
55414           else if (nodes[ix3] === activeID) return 2;
55415           else if (nodes[ix4] === activeID) return 0;
55416           else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
55417         }
55418       }
55419     }
55420     return 1;
55421   }
55422   function svgMarkerSegments(projection2, graph, dt2, shouldReverse = () => false, bothDirections = () => false) {
55423     return function(entity) {
55424       let i3 = 0;
55425       let offset = dt2 / 2;
55426       const segments = [];
55427       const clip = paddedClipExtent(projection2);
55428       const coordinates = graph.childNodes(entity).map(function(n3) {
55429         return n3.loc;
55430       });
55431       let a4, b3;
55432       const _shouldReverse = shouldReverse(entity);
55433       const _bothDirections = bothDirections(entity);
55434       stream_default({
55435         type: "LineString",
55436         coordinates
55437       }, projection2.stream(clip({
55438         lineStart: function() {
55439         },
55440         lineEnd: function() {
55441           a4 = null;
55442         },
55443         point: function(x2, y2) {
55444           b3 = [x2, y2];
55445           if (a4) {
55446             let span = geoVecLength(a4, b3) - offset;
55447             if (span >= 0) {
55448               const heading = geoVecAngle(a4, b3);
55449               const dx = dt2 * Math.cos(heading);
55450               const dy = dt2 * Math.sin(heading);
55451               let p2 = [
55452                 a4[0] + offset * Math.cos(heading),
55453                 a4[1] + offset * Math.sin(heading)
55454               ];
55455               const coord2 = [a4, p2];
55456               for (span -= dt2; span >= 0; span -= dt2) {
55457                 p2 = geoVecAdd(p2, [dx, dy]);
55458                 coord2.push(p2);
55459               }
55460               coord2.push(b3);
55461               let segment = "";
55462               if (!_shouldReverse || _bothDirections) {
55463                 for (let j3 = 0; j3 < coord2.length; j3++) {
55464                   segment += (j3 === 0 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
55465                 }
55466                 segments.push({ id: entity.id, index: i3++, d: segment });
55467               }
55468               if (_shouldReverse || _bothDirections) {
55469                 segment = "";
55470                 for (let j3 = coord2.length - 1; j3 >= 0; j3--) {
55471                   segment += (j3 === coord2.length - 1 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
55472                 }
55473                 segments.push({ id: entity.id, index: i3++, d: segment });
55474               }
55475             }
55476             offset = -span;
55477           }
55478           a4 = b3;
55479         }
55480       })));
55481       return segments;
55482     };
55483   }
55484   function svgPath(projection2, graph, isArea) {
55485     const cache = {};
55486     const project = projection2.stream;
55487     const clip = paddedClipExtent(projection2, isArea);
55488     const path = path_default().projection({ stream: function(output) {
55489       return project(clip(output));
55490     } });
55491     const svgpath = function(entity) {
55492       if (entity.id in cache) {
55493         return cache[entity.id];
55494       } else {
55495         return cache[entity.id] = path(entity.asGeoJSON(graph));
55496       }
55497     };
55498     svgpath.geojson = function(d2) {
55499       if (d2.__featurehash__ !== void 0) {
55500         if (d2.__featurehash__ in cache) {
55501           return cache[d2.__featurehash__];
55502         } else {
55503           return cache[d2.__featurehash__] = path(d2);
55504         }
55505       } else {
55506         return path(d2);
55507       }
55508     };
55509     return svgpath;
55510   }
55511   function svgPointTransform(projection2) {
55512     var svgpoint = function(entity) {
55513       var pt2 = projection2(entity.loc);
55514       return "translate(" + pt2[0] + "," + pt2[1] + ")";
55515     };
55516     svgpoint.geojson = function(d2) {
55517       return svgpoint(d2.properties.entity);
55518     };
55519     return svgpoint;
55520   }
55521   function svgRelationMemberTags(graph) {
55522     return function(entity) {
55523       var tags = entity.tags;
55524       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
55525       graph.parentRelations(entity).forEach(function(relation) {
55526         var type2 = relation.tags.type;
55527         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
55528           tags = Object.assign({}, relation.tags, tags);
55529         }
55530       });
55531       return tags;
55532     };
55533   }
55534   function svgSegmentWay(way, graph, activeID) {
55535     if (activeID === void 0) {
55536       return graph.transient(way, "waySegments", getWaySegments);
55537     } else {
55538       return getWaySegments();
55539     }
55540     function getWaySegments() {
55541       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
55542       var features = { passive: [], active: [] };
55543       var start2 = {};
55544       var end = {};
55545       var node, type2;
55546       for (var i3 = 0; i3 < way.nodes.length; i3++) {
55547         node = graph.entity(way.nodes[i3]);
55548         type2 = svgPassiveVertex(node, graph, activeID);
55549         end = { node, type: type2 };
55550         if (start2.type !== void 0) {
55551           if (start2.node.id === activeID || end.node.id === activeID) {
55552           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
55553             pushActive(start2, end, i3);
55554           } else if (start2.type === 0 && end.type === 0) {
55555             pushActive(start2, end, i3);
55556           } else {
55557             pushPassive(start2, end, i3);
55558           }
55559         }
55560         start2 = end;
55561       }
55562       return features;
55563       function pushActive(start3, end2, index) {
55564         features.active.push({
55565           type: "Feature",
55566           id: way.id + "-" + index + "-nope",
55567           properties: {
55568             nope: true,
55569             target: true,
55570             entity: way,
55571             nodes: [start3.node, end2.node],
55572             index
55573           },
55574           geometry: {
55575             type: "LineString",
55576             coordinates: [start3.node.loc, end2.node.loc]
55577           }
55578         });
55579       }
55580       function pushPassive(start3, end2, index) {
55581         features.passive.push({
55582           type: "Feature",
55583           id: way.id + "-" + index,
55584           properties: {
55585             target: true,
55586             entity: way,
55587             nodes: [start3.node, end2.node],
55588             index
55589           },
55590           geometry: {
55591             type: "LineString",
55592             coordinates: [start3.node.loc, end2.node.loc]
55593           }
55594         });
55595       }
55596     }
55597   }
55598   function paddedClipExtent(projection2, isArea = false) {
55599     var padding = isArea ? 65 : 5;
55600     var viewport = projection2.clipExtent();
55601     var paddedExtent = [
55602       [viewport[0][0] - padding, viewport[0][1] - padding],
55603       [viewport[1][0] + padding, viewport[1][1] + padding]
55604     ];
55605     return identity_default2().clipExtent(paddedExtent).stream;
55606   }
55607   var init_helpers = __esm({
55608     "modules/svg/helpers.js"() {
55609       "use strict";
55610       init_src2();
55611       init_geo2();
55612     }
55613   });
55614
55615   // modules/svg/tag_classes.js
55616   var tag_classes_exports = {};
55617   __export(tag_classes_exports, {
55618     svgTagClasses: () => svgTagClasses
55619   });
55620   function svgTagClasses() {
55621     var primaries = [
55622       "building",
55623       "highway",
55624       "railway",
55625       "waterway",
55626       "aeroway",
55627       "aerialway",
55628       "piste:type",
55629       "boundary",
55630       "power",
55631       "amenity",
55632       "natural",
55633       "landuse",
55634       "leisure",
55635       "military",
55636       "place",
55637       "man_made",
55638       "route",
55639       "attraction",
55640       "roller_coaster",
55641       "building:part",
55642       "indoor"
55643     ];
55644     var statuses = Object.keys(osmLifecyclePrefixes);
55645     var secondaries = [
55646       "oneway",
55647       "bridge",
55648       "tunnel",
55649       "embankment",
55650       "cutting",
55651       "barrier",
55652       "surface",
55653       "tracktype",
55654       "footway",
55655       "crossing",
55656       "service",
55657       "sport",
55658       "public_transport",
55659       "location",
55660       "parking",
55661       "golf",
55662       "type",
55663       "leisure",
55664       "man_made",
55665       "indoor",
55666       "construction",
55667       "proposed"
55668     ];
55669     var _tags = function(entity) {
55670       return entity.tags;
55671     };
55672     var tagClasses = function(selection2) {
55673       selection2.each(function tagClassesEach(entity) {
55674         var value = this.className;
55675         if (value.baseVal !== void 0) {
55676           value = value.baseVal;
55677         }
55678         var t2 = _tags(entity);
55679         var computed = tagClasses.getClassesString(t2, value);
55680         if (computed !== value) {
55681           select_default2(this).attr("class", computed);
55682         }
55683       });
55684     };
55685     tagClasses.getClassesString = function(t2, value) {
55686       var primary, status;
55687       var i3, j3, k3, v3;
55688       var overrideGeometry;
55689       if (/\bstroke\b/.test(value)) {
55690         if (!!t2.barrier && t2.barrier !== "no") {
55691           overrideGeometry = "line";
55692         }
55693       }
55694       var classes = value.trim().split(/\s+/).filter(function(klass) {
55695         return klass.length && !/^tag-/.test(klass);
55696       }).map(function(klass) {
55697         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
55698       });
55699       for (i3 = 0; i3 < primaries.length; i3++) {
55700         k3 = primaries[i3];
55701         v3 = t2[k3];
55702         if (!v3 || v3 === "no") continue;
55703         if (k3 === "piste:type") {
55704           k3 = "piste";
55705         } else if (k3 === "building:part") {
55706           k3 = "building_part";
55707         }
55708         primary = k3;
55709         if (statuses.indexOf(v3) !== -1) {
55710           status = v3;
55711           classes.push("tag-" + k3);
55712         } else {
55713           classes.push("tag-" + k3);
55714           classes.push("tag-" + k3 + "-" + v3);
55715         }
55716         break;
55717       }
55718       if (!primary) {
55719         for (i3 = 0; i3 < statuses.length; i3++) {
55720           for (j3 = 0; j3 < primaries.length; j3++) {
55721             k3 = statuses[i3] + ":" + primaries[j3];
55722             v3 = t2[k3];
55723             if (!v3 || v3 === "no") continue;
55724             status = statuses[i3];
55725             break;
55726           }
55727         }
55728       }
55729       if (!status) {
55730         for (i3 = 0; i3 < statuses.length; i3++) {
55731           k3 = statuses[i3];
55732           v3 = t2[k3];
55733           if (!v3 || v3 === "no") continue;
55734           if (v3 === "yes") {
55735             status = k3;
55736           } else if (primary && primary === v3) {
55737             status = k3;
55738           } else if (!primary && primaries.indexOf(v3) !== -1) {
55739             status = k3;
55740             primary = v3;
55741             classes.push("tag-" + v3);
55742           }
55743           if (status) break;
55744         }
55745       }
55746       if (status) {
55747         classes.push("tag-status");
55748         classes.push("tag-status-" + status);
55749       }
55750       for (i3 = 0; i3 < secondaries.length; i3++) {
55751         k3 = secondaries[i3];
55752         v3 = t2[k3];
55753         if (!v3 || v3 === "no" || k3 === primary) continue;
55754         classes.push("tag-" + k3);
55755         classes.push("tag-" + k3 + "-" + v3);
55756       }
55757       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
55758         var surface = t2.highway === "track" ? "unpaved" : "paved";
55759         for (k3 in t2) {
55760           v3 = t2[k3];
55761           if (k3 in osmPavedTags) {
55762             surface = osmPavedTags[k3][v3] ? "paved" : "unpaved";
55763           }
55764           if (k3 in osmSemipavedTags && !!osmSemipavedTags[k3][v3]) {
55765             surface = "semipaved";
55766           }
55767         }
55768         classes.push("tag-" + surface);
55769       }
55770       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
55771       if (qid) {
55772         classes.push("tag-wikidata");
55773       }
55774       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
55775     };
55776     tagClasses.tags = function(val) {
55777       if (!arguments.length) return _tags;
55778       _tags = val;
55779       return tagClasses;
55780     };
55781     return tagClasses;
55782   }
55783   var init_tag_classes = __esm({
55784     "modules/svg/tag_classes.js"() {
55785       "use strict";
55786       init_src5();
55787       init_tags();
55788     }
55789   });
55790
55791   // modules/svg/tag_pattern.js
55792   var tag_pattern_exports = {};
55793   __export(tag_pattern_exports, {
55794     svgTagPattern: () => svgTagPattern
55795   });
55796   function svgTagPattern(tags) {
55797     if (tags.building && tags.building !== "no") {
55798       return null;
55799     }
55800     for (var tag in patterns) {
55801       var entityValue = tags[tag];
55802       if (!entityValue) continue;
55803       if (typeof patterns[tag] === "string") {
55804         return "pattern-" + patterns[tag];
55805       } else {
55806         var values = patterns[tag];
55807         for (var value in values) {
55808           if (entityValue !== value) continue;
55809           var rules = values[value];
55810           if (typeof rules === "string") {
55811             return "pattern-" + rules;
55812           }
55813           for (var ruleKey in rules) {
55814             var rule = rules[ruleKey];
55815             var pass = true;
55816             for (var criterion in rule) {
55817               if (criterion !== "pattern") {
55818                 var v3 = tags[criterion];
55819                 if (!v3 || v3 !== rule[criterion]) {
55820                   pass = false;
55821                   break;
55822                 }
55823               }
55824             }
55825             if (pass) {
55826               return "pattern-" + rule.pattern;
55827             }
55828           }
55829         }
55830       }
55831     }
55832     return null;
55833   }
55834   var patterns;
55835   var init_tag_pattern = __esm({
55836     "modules/svg/tag_pattern.js"() {
55837       "use strict";
55838       patterns = {
55839         // tag - pattern name
55840         // -or-
55841         // tag - value - pattern name
55842         // -or-
55843         // tag - value - rules (optional tag-values, pattern name)
55844         // (matches earlier rules first, so fallback should be last entry)
55845         amenity: {
55846           grave_yard: "cemetery",
55847           fountain: "water_standing"
55848         },
55849         landuse: {
55850           cemetery: [
55851             { religion: "christian", pattern: "cemetery_christian" },
55852             { religion: "buddhist", pattern: "cemetery_buddhist" },
55853             { religion: "muslim", pattern: "cemetery_muslim" },
55854             { religion: "jewish", pattern: "cemetery_jewish" },
55855             { pattern: "cemetery" }
55856           ],
55857           construction: "construction",
55858           farmland: "farmland",
55859           farmyard: "farmyard",
55860           forest: [
55861             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
55862             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
55863             { leaf_type: "leafless", pattern: "forest_leafless" },
55864             { pattern: "forest" }
55865             // same as 'leaf_type:mixed'
55866           ],
55867           grave_yard: "cemetery",
55868           grass: "grass",
55869           landfill: "landfill",
55870           meadow: "meadow",
55871           military: "construction",
55872           orchard: "orchard",
55873           quarry: "quarry",
55874           vineyard: "vineyard"
55875         },
55876         leisure: {
55877           horse_riding: "farmyard"
55878         },
55879         natural: {
55880           beach: "beach",
55881           grassland: "grass",
55882           sand: "beach",
55883           scrub: "scrub",
55884           water: [
55885             { water: "pond", pattern: "pond" },
55886             { water: "reservoir", pattern: "water_standing" },
55887             { pattern: "waves" }
55888           ],
55889           wetland: [
55890             { wetland: "marsh", pattern: "wetland_marsh" },
55891             { wetland: "swamp", pattern: "wetland_swamp" },
55892             { wetland: "bog", pattern: "wetland_bog" },
55893             { wetland: "reedbed", pattern: "wetland_reedbed" },
55894             { pattern: "wetland" }
55895           ],
55896           wood: [
55897             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
55898             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
55899             { leaf_type: "leafless", pattern: "forest_leafless" },
55900             { pattern: "forest" }
55901             // same as 'leaf_type:mixed'
55902           ]
55903         },
55904         golf: {
55905           green: "golf_green",
55906           tee: "grass",
55907           fairway: "grass",
55908           rough: "scrub"
55909         },
55910         surface: {
55911           grass: "grass",
55912           sand: "beach"
55913         }
55914       };
55915     }
55916   });
55917
55918   // modules/svg/areas.js
55919   var areas_exports = {};
55920   __export(areas_exports, {
55921     svgAreas: () => svgAreas
55922   });
55923   function svgAreas(projection2, context) {
55924     function getPatternStyle(tags) {
55925       var imageID = svgTagPattern(tags);
55926       if (imageID) {
55927         return 'url("#ideditor-' + imageID + '")';
55928       }
55929       return "";
55930     }
55931     function drawTargets(selection2, graph, entities, filter2) {
55932       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
55933       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
55934       var getPath = svgPath(projection2).geojson;
55935       var activeID = context.activeID();
55936       var base = context.history().base();
55937       var data = { targets: [], nopes: [] };
55938       entities.forEach(function(way) {
55939         var features = svgSegmentWay(way, graph, activeID);
55940         data.targets.push.apply(data.targets, features.passive);
55941         data.nopes.push.apply(data.nopes, features.active);
55942       });
55943       var targetData = data.targets.filter(getPath);
55944       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
55945         return filter2(d2.properties.entity);
55946       }).data(targetData, function key(d2) {
55947         return d2.id;
55948       });
55949       targets.exit().remove();
55950       var segmentWasEdited = function(d2) {
55951         var wayID = d2.properties.entity.id;
55952         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
55953           return false;
55954         }
55955         return d2.properties.nodes.some(function(n3) {
55956           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
55957         });
55958       };
55959       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
55960         return "way area target target-allowed " + targetClass + d2.id;
55961       }).classed("segment-edited", segmentWasEdited);
55962       var nopeData = data.nopes.filter(getPath);
55963       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
55964         return filter2(d2.properties.entity);
55965       }).data(nopeData, function key(d2) {
55966         return d2.id;
55967       });
55968       nopes.exit().remove();
55969       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
55970         return "way area target target-nope " + nopeClass + d2.id;
55971       }).classed("segment-edited", segmentWasEdited);
55972     }
55973     function drawAreas(selection2, graph, entities, filter2) {
55974       var path = svgPath(projection2, graph, true);
55975       var areas = {};
55976       var base = context.history().base();
55977       for (var i3 = 0; i3 < entities.length; i3++) {
55978         var entity = entities[i3];
55979         if (entity.geometry(graph) !== "area") continue;
55980         if (!areas[entity.id]) {
55981           areas[entity.id] = {
55982             entity,
55983             area: Math.abs(entity.area(graph))
55984           };
55985         }
55986       }
55987       var fills = Object.values(areas).filter(function hasPath(a4) {
55988         return path(a4.entity);
55989       });
55990       fills.sort(function areaSort(a4, b3) {
55991         return b3.area - a4.area;
55992       });
55993       fills = fills.map(function(a4) {
55994         return a4.entity;
55995       });
55996       var strokes = fills.filter(function(area) {
55997         return area.type === "way";
55998       });
55999       var data = {
56000         clip: fills,
56001         shadow: strokes,
56002         stroke: strokes,
56003         fill: fills
56004       };
56005       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
56006       clipPaths.exit().remove();
56007       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
56008         return "ideditor-" + entity2.id + "-clippath";
56009       });
56010       clipPathsEnter.append("path");
56011       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
56012       var drawLayer = selection2.selectAll(".layer-osm.areas");
56013       var touchLayer = selection2.selectAll(".layer-touch.areas");
56014       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
56015       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
56016         return "areagroup area-" + d2;
56017       }).merge(areagroup);
56018       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
56019         return data[layer];
56020       }, osmEntity.key);
56021       paths.exit().remove();
56022       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
56023       var bisect = bisector(function(node) {
56024         return -node.__data__.area(graph);
56025       }).left;
56026       function sortedByArea(entity2) {
56027         if (this._parent.__data__ === "fill") {
56028           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
56029         }
56030       }
56031       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
56032         var layer = this.parentNode.__data__;
56033         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
56034         if (layer === "fill") {
56035           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
56036           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
56037         }
56038       }).classed("added", function(d2) {
56039         return !base.entities[d2.id];
56040       }).classed("geometry-edited", function(d2) {
56041         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
56042       }).classed("retagged", function(d2) {
56043         return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
56044       }).call(svgTagClasses()).attr("d", path);
56045       touchLayer.call(drawTargets, graph, data.stroke, filter2);
56046     }
56047     return drawAreas;
56048   }
56049   var import_fast_deep_equal6;
56050   var init_areas = __esm({
56051     "modules/svg/areas.js"() {
56052       "use strict";
56053       import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
56054       init_src();
56055       init_osm();
56056       init_helpers();
56057       init_tag_classes();
56058       init_tag_pattern();
56059     }
56060   });
56061
56062   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
56063   function $2(element, tagName) {
56064     return Array.from(element.getElementsByTagName(tagName));
56065   }
56066   function normalizeId(id2) {
56067     return id2[0] === "#" ? id2 : `#${id2}`;
56068   }
56069   function $ns(element, tagName, ns) {
56070     return Array.from(element.getElementsByTagNameNS(ns, tagName));
56071   }
56072   function nodeVal(node) {
56073     node == null ? void 0 : node.normalize();
56074     return (node == null ? void 0 : node.textContent) || "";
56075   }
56076   function get1(node, tagName, callback) {
56077     const n3 = node.getElementsByTagName(tagName);
56078     const result = n3.length ? n3[0] : null;
56079     if (result && callback)
56080       callback(result);
56081     return result;
56082   }
56083   function get3(node, tagName, callback) {
56084     const properties = {};
56085     if (!node)
56086       return properties;
56087     const n3 = node.getElementsByTagName(tagName);
56088     const result = n3.length ? n3[0] : null;
56089     if (result && callback) {
56090       return callback(result, properties);
56091     }
56092     return properties;
56093   }
56094   function val1(node, tagName, callback) {
56095     const val = nodeVal(get1(node, tagName));
56096     if (val && callback)
56097       return callback(val) || {};
56098     return {};
56099   }
56100   function $num(node, tagName, callback) {
56101     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
56102     if (Number.isNaN(val))
56103       return void 0;
56104     if (val && callback)
56105       return callback(val) || {};
56106     return {};
56107   }
56108   function num1(node, tagName, callback) {
56109     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
56110     if (Number.isNaN(val))
56111       return void 0;
56112     if (callback)
56113       callback(val);
56114     return val;
56115   }
56116   function getMulti(node, propertyNames) {
56117     const properties = {};
56118     for (const property of propertyNames) {
56119       val1(node, property, (val) => {
56120         properties[property] = val;
56121       });
56122     }
56123     return properties;
56124   }
56125   function isElement(node) {
56126     return (node == null ? void 0 : node.nodeType) === 1;
56127   }
56128   function getExtensions(node) {
56129     let values = [];
56130     if (node === null)
56131       return values;
56132     for (const child of Array.from(node.childNodes)) {
56133       if (!isElement(child))
56134         continue;
56135       const name = abbreviateName(child.nodeName);
56136       if (name === "gpxtpx:TrackPointExtension") {
56137         values = values.concat(getExtensions(child));
56138       } else {
56139         const val = nodeVal(child);
56140         values.push([name, parseNumeric(val)]);
56141       }
56142     }
56143     return values;
56144   }
56145   function abbreviateName(name) {
56146     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
56147   }
56148   function parseNumeric(val) {
56149     const num = Number.parseFloat(val);
56150     return Number.isNaN(num) ? val : num;
56151   }
56152   function coordPair$1(node) {
56153     const ll = [
56154       Number.parseFloat(node.getAttribute("lon") || ""),
56155       Number.parseFloat(node.getAttribute("lat") || "")
56156     ];
56157     if (Number.isNaN(ll[0]) || Number.isNaN(ll[1])) {
56158       return null;
56159     }
56160     num1(node, "ele", (val) => {
56161       ll.push(val);
56162     });
56163     const time = get1(node, "time");
56164     return {
56165       coordinates: ll,
56166       time: time ? nodeVal(time) : null,
56167       extendedValues: getExtensions(get1(node, "extensions"))
56168     };
56169   }
56170   function getLineStyle(node) {
56171     return get3(node, "line", (lineStyle) => {
56172       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
56173         return { stroke: `#${color2}` };
56174       }), $num(lineStyle, "opacity", (opacity) => {
56175         return { "stroke-opacity": opacity };
56176       }), $num(lineStyle, "width", (width) => {
56177         return { "stroke-width": width * 96 / 25.4 };
56178       }));
56179       return val;
56180     });
56181   }
56182   function extractProperties(ns, node) {
56183     var _a4;
56184     const properties = getMulti(node, [
56185       "name",
56186       "cmt",
56187       "desc",
56188       "type",
56189       "time",
56190       "keywords"
56191     ]);
56192     for (const [n3, url] of ns) {
56193       for (const child of Array.from(node.getElementsByTagNameNS(url, "*"))) {
56194         properties[child.tagName.replace(":", "_")] = (_a4 = nodeVal(child)) == null ? void 0 : _a4.trim();
56195       }
56196     }
56197     const links = $2(node, "link");
56198     if (links.length) {
56199       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
56200     }
56201     return properties;
56202   }
56203   function getPoints$1(node, pointname) {
56204     const pts = $2(node, pointname);
56205     const line = [];
56206     const times = [];
56207     const extendedValues = {};
56208     for (let i3 = 0; i3 < pts.length; i3++) {
56209       const c2 = coordPair$1(pts[i3]);
56210       if (!c2) {
56211         continue;
56212       }
56213       line.push(c2.coordinates);
56214       if (c2.time)
56215         times.push(c2.time);
56216       for (const [name, val] of c2.extendedValues) {
56217         const plural = name === "heart" ? name : `${name.replace("gpxtpx:", "")}s`;
56218         if (!extendedValues[plural]) {
56219           extendedValues[plural] = Array(pts.length).fill(null);
56220         }
56221         extendedValues[plural][i3] = val;
56222       }
56223     }
56224     if (line.length < 2)
56225       return;
56226     return {
56227       line,
56228       times,
56229       extendedValues
56230     };
56231   }
56232   function getRoute(ns, node) {
56233     const line = getPoints$1(node, "rtept");
56234     if (!line)
56235       return;
56236     return {
56237       type: "Feature",
56238       properties: Object.assign({ _gpxType: "rte" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions"))),
56239       geometry: {
56240         type: "LineString",
56241         coordinates: line.line
56242       }
56243     };
56244   }
56245   function getTrack(ns, node) {
56246     var _a4;
56247     const segments = $2(node, "trkseg");
56248     const track = [];
56249     const times = [];
56250     const extractedLines = [];
56251     for (const segment of segments) {
56252       const line = getPoints$1(segment, "trkpt");
56253       if (line) {
56254         extractedLines.push(line);
56255         if ((_a4 = line.times) == null ? void 0 : _a4.length)
56256           times.push(line.times);
56257       }
56258     }
56259     if (extractedLines.length === 0)
56260       return null;
56261     const multi = extractedLines.length > 1;
56262     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions")), times.length ? {
56263       coordinateProperties: {
56264         times: multi ? times : times[0]
56265       }
56266     } : {});
56267     for (let i3 = 0; i3 < extractedLines.length; i3++) {
56268       const line = extractedLines[i3];
56269       track.push(line.line);
56270       if (!properties.coordinateProperties) {
56271         properties.coordinateProperties = {};
56272       }
56273       const props = properties.coordinateProperties;
56274       for (const [name, val] of Object.entries(line.extendedValues)) {
56275         if (multi) {
56276           if (!props[name]) {
56277             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
56278           }
56279           props[name][i3] = val;
56280         } else {
56281           props[name] = val;
56282         }
56283       }
56284     }
56285     return {
56286       type: "Feature",
56287       properties,
56288       geometry: multi ? {
56289         type: "MultiLineString",
56290         coordinates: track
56291       } : {
56292         type: "LineString",
56293         coordinates: track[0]
56294       }
56295     };
56296   }
56297   function getPoint(ns, node) {
56298     const properties = Object.assign(extractProperties(ns, node), getMulti(node, ["sym"]));
56299     const pair3 = coordPair$1(node);
56300     if (!pair3)
56301       return null;
56302     return {
56303       type: "Feature",
56304       properties,
56305       geometry: {
56306         type: "Point",
56307         coordinates: pair3.coordinates
56308       }
56309     };
56310   }
56311   function* gpxGen(node) {
56312     var _a4, _b2;
56313     const n3 = node;
56314     const GPXX = "gpxx";
56315     const GPXX_URI = "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
56316     const ns = [[GPXX, GPXX_URI]];
56317     const attrs = (_a4 = n3.getElementsByTagName("gpx")[0]) == null ? void 0 : _a4.attributes;
56318     if (attrs) {
56319       for (const attr of Array.from(attrs)) {
56320         if (((_b2 = attr.name) == null ? void 0 : _b2.startsWith("xmlns:")) && attr.value !== GPXX_URI) {
56321           ns.push([attr.name, attr.value]);
56322         }
56323       }
56324     }
56325     for (const track of $2(n3, "trk")) {
56326       const feature3 = getTrack(ns, track);
56327       if (feature3)
56328         yield feature3;
56329     }
56330     for (const route of $2(n3, "rte")) {
56331       const feature3 = getRoute(ns, route);
56332       if (feature3)
56333         yield feature3;
56334     }
56335     for (const waypoint of $2(n3, "wpt")) {
56336       const point = getPoint(ns, waypoint);
56337       if (point)
56338         yield point;
56339     }
56340   }
56341   function gpx(node) {
56342     return {
56343       type: "FeatureCollection",
56344       features: Array.from(gpxGen(node))
56345     };
56346   }
56347   function fixColor(v3, prefix) {
56348     const properties = {};
56349     const colorProp = prefix === "stroke" || prefix === "fill" ? prefix : `${prefix}-color`;
56350     if (v3[0] === "#") {
56351       v3 = v3.substring(1);
56352     }
56353     if (v3.length === 6 || v3.length === 3) {
56354       properties[colorProp] = `#${v3}`;
56355     } else if (v3.length === 8) {
56356       properties[`${prefix}-opacity`] = Number.parseInt(v3.substring(0, 2), 16) / 255;
56357       properties[colorProp] = `#${v3.substring(6, 8)}${v3.substring(4, 6)}${v3.substring(2, 4)}`;
56358     }
56359     return properties;
56360   }
56361   function numericProperty(node, source, target) {
56362     const properties = {};
56363     num1(node, source, (val) => {
56364       properties[target] = val;
56365     });
56366     return properties;
56367   }
56368   function getColor(node, output) {
56369     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
56370   }
56371   function extractIconHref(node) {
56372     return get3(node, "Icon", (icon2, properties) => {
56373       val1(icon2, "href", (href) => {
56374         properties.icon = href;
56375       });
56376       return properties;
56377     });
56378   }
56379   function extractIcon(node) {
56380     return get3(node, "IconStyle", (iconStyle) => {
56381       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
56382         const left = Number.parseFloat(hotspot.getAttribute("x") || "");
56383         const top = Number.parseFloat(hotspot.getAttribute("y") || "");
56384         const xunits = hotspot.getAttribute("xunits") || "";
56385         const yunits = hotspot.getAttribute("yunits") || "";
56386         if (!Number.isNaN(left) && !Number.isNaN(top))
56387           return {
56388             "icon-offset": [left, top],
56389             "icon-offset-units": [xunits, yunits]
56390           };
56391         return {};
56392       }), extractIconHref(iconStyle));
56393     });
56394   }
56395   function extractLabel(node) {
56396     return get3(node, "LabelStyle", (labelStyle) => {
56397       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
56398     });
56399   }
56400   function extractLine(node) {
56401     return get3(node, "LineStyle", (lineStyle) => {
56402       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
56403     });
56404   }
56405   function extractPoly(node) {
56406     return get3(node, "PolyStyle", (polyStyle, properties) => {
56407       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
56408         if (fill === "0")
56409           return { "fill-opacity": 0 };
56410       }), val1(polyStyle, "outline", (outline) => {
56411         if (outline === "0")
56412           return { "stroke-opacity": 0 };
56413       }));
56414     });
56415   }
56416   function extractStyle(node) {
56417     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
56418   }
56419   function coord1(value) {
56420     return value.replace(removeSpace, "").split(",").map(Number.parseFloat).filter((num) => !Number.isNaN(num)).slice(0, 3);
56421   }
56422   function coord(value) {
56423     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
56424       return coord2.length >= 2;
56425     });
56426   }
56427   function gxCoords(node) {
56428     let elems = $2(node, "coord");
56429     if (elems.length === 0) {
56430       elems = $ns(node, "coord", "*");
56431     }
56432     const coordinates = elems.map((elem) => {
56433       return nodeVal(elem).split(" ").map(Number.parseFloat);
56434     });
56435     if (coordinates.length === 0) {
56436       return null;
56437     }
56438     return {
56439       geometry: coordinates.length > 2 ? {
56440         type: "LineString",
56441         coordinates
56442       } : {
56443         type: "Point",
56444         coordinates: coordinates[0]
56445       },
56446       times: $2(node, "when").map((elem) => nodeVal(elem))
56447     };
56448   }
56449   function fixRing(ring) {
56450     if (ring.length === 0)
56451       return ring;
56452     const first = ring[0];
56453     const last2 = ring[ring.length - 1];
56454     let equal = true;
56455     for (let i3 = 0; i3 < Math.max(first.length, last2.length); i3++) {
56456       if (first[i3] !== last2[i3]) {
56457         equal = false;
56458         break;
56459       }
56460     }
56461     if (!equal) {
56462       return ring.concat([ring[0]]);
56463     }
56464     return ring;
56465   }
56466   function getCoordinates(node) {
56467     return nodeVal(get1(node, "coordinates"));
56468   }
56469   function getGeometry(node) {
56470     let geometries = [];
56471     let coordTimes = [];
56472     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
56473       const child = node.childNodes.item(i3);
56474       if (isElement(child)) {
56475         switch (child.tagName) {
56476           case "MultiGeometry":
56477           case "MultiTrack":
56478           case "gx:MultiTrack": {
56479             const childGeometries = getGeometry(child);
56480             geometries = geometries.concat(childGeometries.geometries);
56481             coordTimes = coordTimes.concat(childGeometries.coordTimes);
56482             break;
56483           }
56484           case "Point": {
56485             const coordinates = coord1(getCoordinates(child));
56486             if (coordinates.length >= 2) {
56487               geometries.push({
56488                 type: "Point",
56489                 coordinates
56490               });
56491             }
56492             break;
56493           }
56494           case "LinearRing":
56495           case "LineString": {
56496             const coordinates = coord(getCoordinates(child));
56497             if (coordinates.length >= 2) {
56498               geometries.push({
56499                 type: "LineString",
56500                 coordinates
56501               });
56502             }
56503             break;
56504           }
56505           case "Polygon": {
56506             const coords = [];
56507             for (const linearRing of $2(child, "LinearRing")) {
56508               const ring = fixRing(coord(getCoordinates(linearRing)));
56509               if (ring.length >= 4) {
56510                 coords.push(ring);
56511               }
56512             }
56513             if (coords.length) {
56514               geometries.push({
56515                 type: "Polygon",
56516                 coordinates: coords
56517               });
56518             }
56519             break;
56520           }
56521           case "Track":
56522           case "gx:Track": {
56523             const gx = gxCoords(child);
56524             if (!gx)
56525               break;
56526             const { times, geometry } = gx;
56527             geometries.push(geometry);
56528             if (times.length)
56529               coordTimes.push(times);
56530             break;
56531           }
56532         }
56533       }
56534     }
56535     return {
56536       geometries,
56537       coordTimes
56538     };
56539   }
56540   function extractExtendedData(node, schema) {
56541     return get3(node, "ExtendedData", (extendedData, properties) => {
56542       for (const data of $2(extendedData, "Data")) {
56543         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
56544       }
56545       for (const simpleData of $2(extendedData, "SimpleData")) {
56546         const name = simpleData.getAttribute("name") || "";
56547         const typeConverter = schema[name] || typeConverters.string;
56548         properties[name] = typeConverter(nodeVal(simpleData));
56549       }
56550       return properties;
56551     });
56552   }
56553   function getMaybeHTMLDescription(node) {
56554     const descriptionNode = get1(node, "description");
56555     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
56556       if (c2.nodeType === 4) {
56557         return {
56558           description: {
56559             "@type": "html",
56560             value: nodeVal(c2)
56561           }
56562         };
56563       }
56564     }
56565     return {};
56566   }
56567   function extractTimeSpan(node) {
56568     return get3(node, "TimeSpan", (timeSpan) => {
56569       return {
56570         timespan: {
56571           begin: nodeVal(get1(timeSpan, "begin")),
56572           end: nodeVal(get1(timeSpan, "end"))
56573         }
56574       };
56575     });
56576   }
56577   function extractTimeStamp(node) {
56578     return get3(node, "TimeStamp", (timeStamp) => {
56579       return { timestamp: nodeVal(get1(timeStamp, "when")) };
56580     });
56581   }
56582   function extractCascadedStyle(node, styleMap) {
56583     return val1(node, "styleUrl", (styleUrl) => {
56584       styleUrl = normalizeId(styleUrl);
56585       if (styleMap[styleUrl]) {
56586         return Object.assign({ styleUrl }, styleMap[styleUrl]);
56587       }
56588       return { styleUrl };
56589     });
56590   }
56591   function processAltitudeMode(mode) {
56592     switch (mode == null ? void 0 : mode.textContent) {
56593       case AltitudeMode.ABSOLUTE:
56594         return AltitudeMode.ABSOLUTE;
56595       case AltitudeMode.CLAMP_TO_GROUND:
56596         return AltitudeMode.CLAMP_TO_GROUND;
56597       case AltitudeMode.CLAMP_TO_SEAFLOOR:
56598         return AltitudeMode.CLAMP_TO_SEAFLOOR;
56599       case AltitudeMode.RELATIVE_TO_GROUND:
56600         return AltitudeMode.RELATIVE_TO_GROUND;
56601       case AltitudeMode.RELATIVE_TO_SEAFLOOR:
56602         return AltitudeMode.RELATIVE_TO_SEAFLOOR;
56603     }
56604     return null;
56605   }
56606   function getGroundOverlayBox(node) {
56607     const latLonQuad = get1(node, "gx:LatLonQuad");
56608     if (latLonQuad) {
56609       const ring = fixRing(coord(getCoordinates(node)));
56610       return {
56611         geometry: {
56612           type: "Polygon",
56613           coordinates: [ring]
56614         }
56615       };
56616     }
56617     return getLatLonBox(node);
56618   }
56619   function rotateBox(bbox2, coordinates, rotation) {
56620     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
56621     return [
56622       coordinates[0].map((coordinate) => {
56623         const dy = coordinate[1] - center[1];
56624         const dx = coordinate[0] - center[0];
56625         const distance = Math.sqrt(dy ** 2 + dx ** 2);
56626         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
56627         return [
56628           center[0] + Math.cos(angle2) * distance,
56629           center[1] + Math.sin(angle2) * distance
56630         ];
56631       })
56632     ];
56633   }
56634   function getLatLonBox(node) {
56635     const latLonBox = get1(node, "LatLonBox");
56636     if (latLonBox) {
56637       const north = num1(latLonBox, "north");
56638       const west = num1(latLonBox, "west");
56639       const east = num1(latLonBox, "east");
56640       const south = num1(latLonBox, "south");
56641       const rotation = num1(latLonBox, "rotation");
56642       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
56643         const bbox2 = [west, south, east, north];
56644         let coordinates = [
56645           [
56646             [west, north],
56647             // top left
56648             [east, north],
56649             // top right
56650             [east, south],
56651             // top right
56652             [west, south],
56653             // bottom left
56654             [west, north]
56655             // top left (again)
56656           ]
56657         ];
56658         if (typeof rotation === "number") {
56659           coordinates = rotateBox(bbox2, coordinates, rotation);
56660         }
56661         return {
56662           bbox: bbox2,
56663           geometry: {
56664             type: "Polygon",
56665             coordinates
56666           }
56667         };
56668       }
56669     }
56670     return null;
56671   }
56672   function getGroundOverlay(node, styleMap, schema, options) {
56673     var _a4;
56674     const box = getGroundOverlayBox(node);
56675     const geometry = (box == null ? void 0 : box.geometry) || null;
56676     if (!geometry && options.skipNullGeometry) {
56677       return null;
56678     }
56679     const feature3 = {
56680       type: "Feature",
56681       geometry,
56682       properties: Object.assign(
56683         /**
56684          * Related to
56685          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
56686          */
56687         { "@geometry-type": "groundoverlay" },
56688         getMulti(node, [
56689           "name",
56690           "address",
56691           "visibility",
56692           "open",
56693           "phoneNumber",
56694           "description"
56695         ]),
56696         getMaybeHTMLDescription(node),
56697         extractCascadedStyle(node, styleMap),
56698         extractStyle(node),
56699         extractIconHref(node),
56700         extractExtendedData(node, schema),
56701         extractTimeSpan(node),
56702         extractTimeStamp(node)
56703       )
56704     };
56705     if (box == null ? void 0 : box.bbox) {
56706       feature3.bbox = box.bbox;
56707     }
56708     if (((_a4 = feature3.properties) == null ? void 0 : _a4.visibility) !== void 0) {
56709       feature3.properties.visibility = feature3.properties.visibility !== "0";
56710     }
56711     const id2 = node.getAttribute("id");
56712     if (id2 !== null && id2 !== "")
56713       feature3.id = id2;
56714     return feature3;
56715   }
56716   function getNetworkLinkRegion(node) {
56717     const region = get1(node, "Region");
56718     if (region) {
56719       return {
56720         coordinateBox: getLatLonAltBox(region),
56721         lod: getLod(node)
56722       };
56723     }
56724     return null;
56725   }
56726   function getLod(node) {
56727     var _a4, _b2, _c, _d;
56728     const lod = get1(node, "Lod");
56729     if (lod) {
56730       return [
56731         (_a4 = num1(lod, "minLodPixels")) != null ? _a4 : -1,
56732         (_b2 = num1(lod, "maxLodPixels")) != null ? _b2 : -1,
56733         (_c = num1(lod, "minFadeExtent")) != null ? _c : null,
56734         (_d = num1(lod, "maxFadeExtent")) != null ? _d : null
56735       ];
56736     }
56737     return null;
56738   }
56739   function getLatLonAltBox(node) {
56740     const latLonAltBox = get1(node, "LatLonAltBox");
56741     if (latLonAltBox) {
56742       const north = num1(latLonAltBox, "north");
56743       const west = num1(latLonAltBox, "west");
56744       const east = num1(latLonAltBox, "east");
56745       const south = num1(latLonAltBox, "south");
56746       const altitudeMode = processAltitudeMode(get1(latLonAltBox, "altitudeMode") || get1(latLonAltBox, "gx:altitudeMode"));
56747       if (altitudeMode) {
56748         console.debug("Encountered an unsupported feature of KML for togeojson: please contact developers for support of altitude mode.");
56749       }
56750       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
56751         const bbox2 = [west, south, east, north];
56752         const coordinates = [
56753           [
56754             [west, north],
56755             // top left
56756             [east, north],
56757             // top right
56758             [east, south],
56759             // top right
56760             [west, south],
56761             // bottom left
56762             [west, north]
56763             // top left (again)
56764           ]
56765         ];
56766         return {
56767           bbox: bbox2,
56768           geometry: {
56769             type: "Polygon",
56770             coordinates
56771           }
56772         };
56773       }
56774     }
56775     return null;
56776   }
56777   function getLinkObject(node) {
56778     const linkObj = get1(node, "Link");
56779     if (linkObj) {
56780       return getMulti(linkObj, [
56781         "href",
56782         "refreshMode",
56783         "refreshInterval",
56784         "viewRefreshMode",
56785         "viewRefreshTime",
56786         "viewBoundScale",
56787         "viewFormat",
56788         "httpQuery"
56789       ]);
56790     }
56791     return {};
56792   }
56793   function getNetworkLink(node, styleMap, schema, options) {
56794     var _a4, _b2, _c;
56795     const box = getNetworkLinkRegion(node);
56796     const geometry = ((_a4 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _a4.geometry) || null;
56797     if (!geometry && options.skipNullGeometry) {
56798       return null;
56799     }
56800     const feature3 = {
56801       type: "Feature",
56802       geometry,
56803       properties: Object.assign(
56804         /**
56805          * Related to
56806          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
56807          */
56808         { "@geometry-type": "networklink" },
56809         getMulti(node, [
56810           "name",
56811           "address",
56812           "visibility",
56813           "open",
56814           "phoneNumber",
56815           "styleUrl",
56816           "refreshVisibility",
56817           "flyToView",
56818           "description"
56819         ]),
56820         getMaybeHTMLDescription(node),
56821         extractCascadedStyle(node, styleMap),
56822         extractStyle(node),
56823         extractIconHref(node),
56824         extractExtendedData(node, schema),
56825         extractTimeSpan(node),
56826         extractTimeStamp(node),
56827         getLinkObject(node),
56828         (box == null ? void 0 : box.lod) ? { lod: box.lod } : {}
56829       )
56830     };
56831     if ((_b2 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _b2.bbox) {
56832       feature3.bbox = box.coordinateBox.bbox;
56833     }
56834     if (((_c = feature3.properties) == null ? void 0 : _c.visibility) !== void 0) {
56835       feature3.properties.visibility = feature3.properties.visibility !== "0";
56836     }
56837     const id2 = node.getAttribute("id");
56838     if (id2 !== null && id2 !== "")
56839       feature3.id = id2;
56840     return feature3;
56841   }
56842   function geometryListToGeometry(geometries) {
56843     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
56844       type: "GeometryCollection",
56845       geometries
56846     };
56847   }
56848   function getPlacemark(node, styleMap, schema, options) {
56849     var _a4;
56850     const { coordTimes, geometries } = getGeometry(node);
56851     const geometry = geometryListToGeometry(geometries);
56852     if (!geometry && options.skipNullGeometry) {
56853       return null;
56854     }
56855     const feature3 = {
56856       type: "Feature",
56857       geometry,
56858       properties: Object.assign(getMulti(node, [
56859         "name",
56860         "address",
56861         "visibility",
56862         "open",
56863         "phoneNumber",
56864         "description"
56865       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
56866         coordinateProperties: {
56867           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
56868         }
56869       } : {})
56870     };
56871     if (((_a4 = feature3.properties) == null ? void 0 : _a4.visibility) !== void 0) {
56872       feature3.properties.visibility = feature3.properties.visibility !== "0";
56873     }
56874     const id2 = node.getAttribute("id");
56875     if (id2 !== null && id2 !== "")
56876       feature3.id = id2;
56877     return feature3;
56878   }
56879   function getStyleId(style) {
56880     let id2 = style.getAttribute("id");
56881     const parentNode = style.parentNode;
56882     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
56883       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
56884     }
56885     return normalizeId(id2 || "");
56886   }
56887   function buildStyleMap(node) {
56888     const styleMap = {};
56889     for (const style of $2(node, "Style")) {
56890       styleMap[getStyleId(style)] = extractStyle(style);
56891     }
56892     for (const map2 of $2(node, "StyleMap")) {
56893       const id2 = normalizeId(map2.getAttribute("id") || "");
56894       val1(map2, "styleUrl", (styleUrl) => {
56895         styleUrl = normalizeId(styleUrl);
56896         if (styleMap[styleUrl]) {
56897           styleMap[id2] = styleMap[styleUrl];
56898         }
56899       });
56900     }
56901     return styleMap;
56902   }
56903   function buildSchema(node) {
56904     const schema = {};
56905     for (const field of $2(node, "SimpleField")) {
56906       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters.string;
56907     }
56908     return schema;
56909   }
56910   function* kmlGen(node, options = {
56911     skipNullGeometry: false
56912   }) {
56913     const n3 = node;
56914     const styleMap = buildStyleMap(n3);
56915     const schema = buildSchema(n3);
56916     for (const placemark of $2(n3, "Placemark")) {
56917       const feature3 = getPlacemark(placemark, styleMap, schema, options);
56918       if (feature3)
56919         yield feature3;
56920     }
56921     for (const groundOverlay of $2(n3, "GroundOverlay")) {
56922       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options);
56923       if (feature3)
56924         yield feature3;
56925     }
56926     for (const networkLink of $2(n3, "NetworkLink")) {
56927       const feature3 = getNetworkLink(networkLink, styleMap, schema, options);
56928       if (feature3)
56929         yield feature3;
56930     }
56931   }
56932   function kml(node, options = {
56933     skipNullGeometry: false
56934   }) {
56935     return {
56936       type: "FeatureCollection",
56937       features: Array.from(kmlGen(node, options))
56938     };
56939   }
56940   var removeSpace, trimSpace, splitSpace, toNumber2, typeConverters, AltitudeMode, DEGREES_TO_RADIANS;
56941   var init_togeojson_es = __esm({
56942     "node_modules/@tmcw/togeojson/dist/togeojson.es.mjs"() {
56943       removeSpace = /\s*/g;
56944       trimSpace = /^\s*|\s*$/g;
56945       splitSpace = /\s+/;
56946       toNumber2 = (x2) => Number(x2);
56947       typeConverters = {
56948         string: (x2) => x2,
56949         int: toNumber2,
56950         uint: toNumber2,
56951         short: toNumber2,
56952         ushort: toNumber2,
56953         float: toNumber2,
56954         double: toNumber2,
56955         bool: (x2) => Boolean(x2)
56956       };
56957       (function(AltitudeMode2) {
56958         AltitudeMode2["ABSOLUTE"] = "absolute";
56959         AltitudeMode2["RELATIVE_TO_GROUND"] = "relativeToGround";
56960         AltitudeMode2["CLAMP_TO_GROUND"] = "clampToGround";
56961         AltitudeMode2["CLAMP_TO_SEAFLOOR"] = "clampToSeaFloor";
56962         AltitudeMode2["RELATIVE_TO_SEAFLOOR"] = "relativeToSeaFloor";
56963       })(AltitudeMode || (AltitudeMode = {}));
56964       DEGREES_TO_RADIANS = Math.PI / 180;
56965     }
56966   });
56967
56968   // modules/svg/data.js
56969   var data_exports = {};
56970   __export(data_exports, {
56971     svgData: () => svgData
56972   });
56973   function svgData(projection2, context, dispatch14) {
56974     var throttledRedraw = throttle_default(function() {
56975       dispatch14.call("change");
56976     }, 1e3);
56977     var _showLabels = true;
56978     var detected = utilDetect();
56979     var layer = select_default2(null);
56980     var _vtService;
56981     var _fileList;
56982     var _template;
56983     var _src;
56984     const supportedFormats = [
56985       ".gpx",
56986       ".kml",
56987       ".geojson",
56988       ".json"
56989     ];
56990     function init2() {
56991       if (_initialized) return;
56992       _geojson = {};
56993       _enabled = true;
56994       function over(d3_event) {
56995         d3_event.stopPropagation();
56996         d3_event.preventDefault();
56997         d3_event.dataTransfer.dropEffect = "copy";
56998       }
56999       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
57000         d3_event.stopPropagation();
57001         d3_event.preventDefault();
57002         if (!detected.filedrop) return;
57003         var f2 = d3_event.dataTransfer.files[0];
57004         var extension = getExtension(f2.name);
57005         if (!supportedFormats.includes(extension)) return;
57006         drawData.fileList(d3_event.dataTransfer.files);
57007       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
57008       _initialized = true;
57009     }
57010     function getService() {
57011       if (services.vectorTile && !_vtService) {
57012         _vtService = services.vectorTile;
57013         _vtService.event.on("loadedData", throttledRedraw);
57014       } else if (!services.vectorTile && _vtService) {
57015         _vtService = null;
57016       }
57017       return _vtService;
57018     }
57019     function showLayer() {
57020       layerOn();
57021       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
57022         dispatch14.call("change");
57023       });
57024     }
57025     function hideLayer() {
57026       throttledRedraw.cancel();
57027       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
57028     }
57029     function layerOn() {
57030       layer.style("display", "block");
57031     }
57032     function layerOff() {
57033       layer.selectAll(".viewfield-group").remove();
57034       layer.style("display", "none");
57035     }
57036     function ensureIDs(gj) {
57037       if (!gj) return null;
57038       if (gj.type === "FeatureCollection") {
57039         for (var i3 = 0; i3 < gj.features.length; i3++) {
57040           ensureFeatureID(gj.features[i3]);
57041         }
57042       } else {
57043         ensureFeatureID(gj);
57044       }
57045       return gj;
57046     }
57047     function ensureFeatureID(feature3) {
57048       if (!feature3) return;
57049       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
57050       return feature3;
57051     }
57052     function getFeatures(gj) {
57053       if (!gj) return [];
57054       if (gj.type === "FeatureCollection") {
57055         return gj.features;
57056       } else {
57057         return [gj];
57058       }
57059     }
57060     function featureKey(d2) {
57061       return d2.__featurehash__;
57062     }
57063     function isPolygon(d2) {
57064       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
57065     }
57066     function clipPathID(d2) {
57067       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
57068     }
57069     function featureClasses(d2) {
57070       return [
57071         "data" + d2.__featurehash__,
57072         d2.geometry.type,
57073         isPolygon(d2) ? "area" : "",
57074         d2.__layerID__ || ""
57075       ].filter(Boolean).join(" ");
57076     }
57077     function drawData(selection2) {
57078       var vtService = getService();
57079       var getPath = svgPath(projection2).geojson;
57080       var getAreaPath = svgPath(projection2, null, true).geojson;
57081       var hasData = drawData.hasData();
57082       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
57083       layer.exit().remove();
57084       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
57085       var surface = context.surface();
57086       if (!surface || surface.empty()) return;
57087       var geoData, polygonData;
57088       if (_template && vtService) {
57089         var sourceID = _template;
57090         vtService.loadTiles(sourceID, _template, projection2);
57091         geoData = vtService.data(sourceID, projection2);
57092       } else {
57093         geoData = getFeatures(_geojson);
57094       }
57095       geoData = geoData.filter(getPath);
57096       polygonData = geoData.filter(isPolygon);
57097       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
57098       clipPaths.exit().remove();
57099       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
57100       clipPathsEnter.append("path");
57101       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
57102       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
57103       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
57104         return "datagroup datagroup-" + d2;
57105       }).merge(datagroups);
57106       var pathData = {
57107         fill: polygonData,
57108         shadow: geoData,
57109         stroke: geoData
57110       };
57111       var paths = datagroups.selectAll("path").data(function(layer2) {
57112         return pathData[layer2];
57113       }, featureKey);
57114       paths.exit().remove();
57115       paths = paths.enter().append("path").attr("class", function(d2) {
57116         var datagroup = this.parentNode.__data__;
57117         return "pathdata " + datagroup + " " + featureClasses(d2);
57118       }).attr("clip-path", function(d2) {
57119         var datagroup = this.parentNode.__data__;
57120         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
57121       }).merge(paths).attr("d", function(d2) {
57122         var datagroup = this.parentNode.__data__;
57123         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
57124       });
57125       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
57126       function drawLabels(selection3, textClass, data) {
57127         var labelPath = path_default(projection2);
57128         var labelData = data.filter(function(d2) {
57129           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
57130         });
57131         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
57132         labels.exit().remove();
57133         labels = labels.enter().append("text").attr("class", function(d2) {
57134           return textClass + " " + featureClasses(d2);
57135         }).merge(labels).text(function(d2) {
57136           return d2.properties.desc || d2.properties.name;
57137         }).attr("x", function(d2) {
57138           var centroid = labelPath.centroid(d2);
57139           return centroid[0] + 11;
57140         }).attr("y", function(d2) {
57141           var centroid = labelPath.centroid(d2);
57142           return centroid[1];
57143         });
57144       }
57145     }
57146     function getExtension(fileName) {
57147       if (!fileName) return;
57148       var re4 = /\.(gpx|kml|(geo)?json|png)$/i;
57149       var match = fileName.toLowerCase().match(re4);
57150       return match && match.length && match[0];
57151     }
57152     function xmlToDom(textdata) {
57153       return new DOMParser().parseFromString(textdata, "text/xml");
57154     }
57155     function stringifyGeojsonProperties(feature3) {
57156       const properties = feature3.properties;
57157       for (const key in properties) {
57158         const property = properties[key];
57159         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
57160           properties[key] = property.toString();
57161         } else if (property === null) {
57162           properties[key] = "null";
57163         } else if (typeof property === "object") {
57164           properties[key] = JSON.stringify(property);
57165         }
57166       }
57167     }
57168     drawData.setFile = function(extension, data) {
57169       _template = null;
57170       _fileList = null;
57171       _geojson = null;
57172       _src = null;
57173       var gj;
57174       switch (extension) {
57175         case ".gpx":
57176           gj = gpx(xmlToDom(data));
57177           break;
57178         case ".kml":
57179           gj = kml(xmlToDom(data));
57180           break;
57181         case ".geojson":
57182         case ".json":
57183           gj = JSON.parse(data);
57184           if (gj.type === "FeatureCollection") {
57185             gj.features.forEach(stringifyGeojsonProperties);
57186           } else if (gj.type === "Feature") {
57187             stringifyGeojsonProperties(gj);
57188           }
57189           break;
57190       }
57191       gj = gj || {};
57192       if (Object.keys(gj).length) {
57193         _geojson = ensureIDs(gj);
57194         _src = extension + " data file";
57195         this.fitZoom();
57196       }
57197       dispatch14.call("change");
57198       return this;
57199     };
57200     drawData.showLabels = function(val) {
57201       if (!arguments.length) return _showLabels;
57202       _showLabels = val;
57203       return this;
57204     };
57205     drawData.enabled = function(val) {
57206       if (!arguments.length) return _enabled;
57207       _enabled = val;
57208       if (_enabled) {
57209         showLayer();
57210       } else {
57211         hideLayer();
57212       }
57213       dispatch14.call("change");
57214       return this;
57215     };
57216     drawData.hasData = function() {
57217       var gj = _geojson || {};
57218       return !!(_template || Object.keys(gj).length);
57219     };
57220     drawData.template = function(val, src) {
57221       if (!arguments.length) return _template;
57222       var osm = context.connection();
57223       if (osm) {
57224         var blocklists = osm.imageryBlocklists();
57225         var fail = false;
57226         var tested = 0;
57227         var regex;
57228         for (var i3 = 0; i3 < blocklists.length; i3++) {
57229           regex = blocklists[i3];
57230           fail = regex.test(val);
57231           tested++;
57232           if (fail) break;
57233         }
57234         if (!tested) {
57235           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
57236           fail = regex.test(val);
57237         }
57238       }
57239       _template = val;
57240       _fileList = null;
57241       _geojson = null;
57242       _src = src || "vectortile:" + val.split(/[?#]/)[0];
57243       dispatch14.call("change");
57244       return this;
57245     };
57246     drawData.geojson = function(gj, src) {
57247       if (!arguments.length) return _geojson;
57248       _template = null;
57249       _fileList = null;
57250       _geojson = null;
57251       _src = null;
57252       gj = gj || {};
57253       if (Object.keys(gj).length) {
57254         _geojson = ensureIDs(gj);
57255         _src = src || "unknown.geojson";
57256       }
57257       dispatch14.call("change");
57258       return this;
57259     };
57260     drawData.fileList = function(fileList) {
57261       if (!arguments.length) return _fileList;
57262       _template = null;
57263       _geojson = null;
57264       _src = null;
57265       _fileList = fileList;
57266       if (!fileList || !fileList.length) return this;
57267       var f2 = fileList[0];
57268       var extension = getExtension(f2.name);
57269       var reader = new FileReader();
57270       reader.onload = /* @__PURE__ */ function() {
57271         return function(e3) {
57272           drawData.setFile(extension, e3.target.result);
57273         };
57274       }(f2);
57275       reader.readAsText(f2);
57276       return this;
57277     };
57278     drawData.url = function(url, defaultExtension) {
57279       _template = null;
57280       _fileList = null;
57281       _geojson = null;
57282       _src = null;
57283       var testUrl = url.split(/[?#]/)[0];
57284       var extension = getExtension(testUrl) || defaultExtension;
57285       if (extension) {
57286         _template = null;
57287         text_default3(url).then(function(data) {
57288           drawData.setFile(extension, data);
57289         }).catch(function() {
57290         });
57291       } else {
57292         drawData.template(url);
57293       }
57294       return this;
57295     };
57296     drawData.getSrc = function() {
57297       return _src || "";
57298     };
57299     drawData.fitZoom = function() {
57300       var features = getFeatures(_geojson);
57301       if (!features.length) return;
57302       var map2 = context.map();
57303       var viewport = map2.trimmedExtent().polygon();
57304       var coords = features.reduce(function(coords2, feature3) {
57305         var geom = feature3.geometry;
57306         if (!geom) return coords2;
57307         var c2 = geom.coordinates;
57308         switch (geom.type) {
57309           case "Point":
57310             c2 = [c2];
57311           case "MultiPoint":
57312           case "LineString":
57313             break;
57314           case "MultiPolygon":
57315             c2 = utilArrayFlatten(c2);
57316           case "Polygon":
57317           case "MultiLineString":
57318             c2 = utilArrayFlatten(c2);
57319             break;
57320         }
57321         return utilArrayUnion(coords2, c2);
57322       }, []);
57323       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
57324         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
57325         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
57326       }
57327       return this;
57328     };
57329     init2();
57330     return drawData;
57331   }
57332   var import_fast_json_stable_stringify2, _initialized, _enabled, _geojson;
57333   var init_data2 = __esm({
57334     "modules/svg/data.js"() {
57335       "use strict";
57336       init_throttle();
57337       init_src2();
57338       init_src18();
57339       init_src5();
57340       import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
57341       init_togeojson_es();
57342       init_geo2();
57343       init_services();
57344       init_helpers();
57345       init_detect();
57346       init_util();
57347       _initialized = false;
57348       _enabled = false;
57349     }
57350   });
57351
57352   // modules/svg/debug.js
57353   var debug_exports = {};
57354   __export(debug_exports, {
57355     svgDebug: () => svgDebug
57356   });
57357   function svgDebug(projection2, context) {
57358     function drawDebug(selection2) {
57359       const showTile = context.getDebug("tile");
57360       const showCollision = context.getDebug("collision");
57361       const showImagery = context.getDebug("imagery");
57362       const showTouchTargets = context.getDebug("target");
57363       const showDownloaded = context.getDebug("downloaded");
57364       let debugData = [];
57365       if (showTile) {
57366         debugData.push({ class: "red", label: "tile" });
57367       }
57368       if (showCollision) {
57369         debugData.push({ class: "yellow", label: "collision" });
57370       }
57371       if (showImagery) {
57372         debugData.push({ class: "orange", label: "imagery" });
57373       }
57374       if (showTouchTargets) {
57375         debugData.push({ class: "pink", label: "touchTargets" });
57376       }
57377       if (showDownloaded) {
57378         debugData.push({ class: "purple", label: "downloaded" });
57379       }
57380       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
57381       legend.exit().remove();
57382       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
57383       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
57384       legendItems.exit().remove();
57385       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
57386       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
57387       layer.exit().remove();
57388       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
57389       const extent = context.map().extent();
57390       _mainFileFetcher.get("imagery").then((d2) => {
57391         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
57392         const features = hits.map((d4) => d4.features[d4.id]);
57393         let imagery = layer.selectAll("path.debug-imagery").data(features);
57394         imagery.exit().remove();
57395         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
57396       }).catch(() => {
57397       });
57398       const osm = context.connection();
57399       let dataDownloaded = [];
57400       if (osm && showDownloaded) {
57401         const rtree = osm.caches("get").tile.rtree;
57402         dataDownloaded = rtree.all().map((bbox2) => {
57403           return {
57404             type: "Feature",
57405             properties: { id: bbox2.id },
57406             geometry: {
57407               type: "Polygon",
57408               coordinates: [[
57409                 [bbox2.minX, bbox2.minY],
57410                 [bbox2.minX, bbox2.maxY],
57411                 [bbox2.maxX, bbox2.maxY],
57412                 [bbox2.maxX, bbox2.minY],
57413                 [bbox2.minX, bbox2.minY]
57414               ]]
57415             }
57416           };
57417         });
57418       }
57419       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
57420       downloaded.exit().remove();
57421       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
57422       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
57423     }
57424     drawDebug.enabled = function() {
57425       if (!arguments.length) {
57426         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
57427       } else {
57428         return this;
57429       }
57430     };
57431     return drawDebug;
57432   }
57433   var init_debug = __esm({
57434     "modules/svg/debug.js"() {
57435       "use strict";
57436       init_file_fetcher();
57437       init_helpers();
57438     }
57439   });
57440
57441   // modules/svg/defs.js
57442   var defs_exports = {};
57443   __export(defs_exports, {
57444     svgDefs: () => svgDefs
57445   });
57446   function svgDefs(context) {
57447     var _defsSelection = select_default2(null);
57448     var _spritesheetIds = [
57449       "iD-sprite",
57450       "maki-sprite",
57451       "temaki-sprite",
57452       "fa-sprite",
57453       "roentgen-sprite",
57454       "community-sprite"
57455     ];
57456     function drawDefs(selection2) {
57457       _defsSelection = selection2.append("defs");
57458       function addOnewayMarker(name, colour) {
57459         _defsSelection.append("marker").attr("id", `ideditor-oneway-marker-${name}`).attr("viewBox", "0 0 10 5").attr("refX", 4).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 6,3 L 0,3 L 0,2 L 6,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", colour).attr("opacity", "1");
57460       }
57461       addOnewayMarker("black", "#333");
57462       addOnewayMarker("white", "#fff");
57463       addOnewayMarker("gray", "#eee");
57464       function addSidedMarker(name, color2, offset) {
57465         _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);
57466       }
57467       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
57468       addSidedMarker("coastline", "#77dede", 1);
57469       addSidedMarker("waterway", "#77dede", 1);
57470       addSidedMarker("barrier", "#ddd", 1);
57471       addSidedMarker("man_made", "#fff", 0);
57472       _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");
57473       _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");
57474       var patterns2 = _defsSelection.selectAll("pattern").data([
57475         // pattern name, pattern image name
57476         ["beach", "dots"],
57477         ["construction", "construction"],
57478         ["cemetery", "cemetery"],
57479         ["cemetery_christian", "cemetery_christian"],
57480         ["cemetery_buddhist", "cemetery_buddhist"],
57481         ["cemetery_muslim", "cemetery_muslim"],
57482         ["cemetery_jewish", "cemetery_jewish"],
57483         ["farmland", "farmland"],
57484         ["farmyard", "farmyard"],
57485         ["forest", "forest"],
57486         ["forest_broadleaved", "forest_broadleaved"],
57487         ["forest_needleleaved", "forest_needleleaved"],
57488         ["forest_leafless", "forest_leafless"],
57489         ["golf_green", "grass"],
57490         ["grass", "grass"],
57491         ["landfill", "landfill"],
57492         ["meadow", "grass"],
57493         ["orchard", "orchard"],
57494         ["pond", "pond"],
57495         ["quarry", "quarry"],
57496         ["scrub", "bushes"],
57497         ["vineyard", "vineyard"],
57498         ["water_standing", "lines"],
57499         ["waves", "waves"],
57500         ["wetland", "wetland"],
57501         ["wetland_marsh", "wetland_marsh"],
57502         ["wetland_swamp", "wetland_swamp"],
57503         ["wetland_bog", "wetland_bog"],
57504         ["wetland_reedbed", "wetland_reedbed"]
57505       ]).enter().append("pattern").attr("id", function(d2) {
57506         return "ideditor-pattern-" + d2[0];
57507       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
57508       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
57509         return "pattern-color-" + d2[0];
57510       });
57511       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
57512         return context.imagePath("pattern/" + d2[1] + ".png");
57513       });
57514       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
57515         return "ideditor-clip-square-" + d2;
57516       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
57517         return d2;
57518       }).attr("height", function(d2) {
57519         return d2;
57520       });
57521       const filters = _defsSelection.selectAll("filter").data(["alpha-slope5"]).enter().append("filter").attr("id", (d2) => d2);
57522       const alphaSlope5 = filters.filter("#alpha-slope5").append("feComponentTransfer");
57523       alphaSlope5.append("feFuncR").attr("type", "identity");
57524       alphaSlope5.append("feFuncG").attr("type", "identity");
57525       alphaSlope5.append("feFuncB").attr("type", "identity");
57526       alphaSlope5.append("feFuncA").attr("type", "linear").attr("slope", 5);
57527       addSprites(_spritesheetIds, true);
57528     }
57529     function addSprites(ids, overrideColors) {
57530       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
57531       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
57532       spritesheets.enter().append("g").attr("class", function(d2) {
57533         return "spritesheet spritesheet-" + d2;
57534       }).each(function(d2) {
57535         var url = context.imagePath(d2 + ".svg");
57536         var node = select_default2(this).node();
57537         svg(url).then(function(svg2) {
57538           node.appendChild(
57539             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
57540           );
57541           if (overrideColors && d2 !== "iD-sprite") {
57542             select_default2(node).selectAll("path").attr("fill", "currentColor");
57543           }
57544         }).catch(function() {
57545         });
57546       });
57547       spritesheets.exit().remove();
57548     }
57549     drawDefs.addSprites = addSprites;
57550     return drawDefs;
57551   }
57552   var init_defs = __esm({
57553     "modules/svg/defs.js"() {
57554       "use strict";
57555       init_src18();
57556       init_src5();
57557       init_util();
57558     }
57559   });
57560
57561   // modules/svg/keepRight.js
57562   var keepRight_exports2 = {};
57563   __export(keepRight_exports2, {
57564     svgKeepRight: () => svgKeepRight
57565   });
57566   function svgKeepRight(projection2, context, dispatch14) {
57567     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
57568     const minZoom5 = 12;
57569     let touchLayer = select_default2(null);
57570     let drawLayer = select_default2(null);
57571     let layerVisible = false;
57572     function markerPath(selection2, klass) {
57573       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");
57574     }
57575     function getService() {
57576       if (services.keepRight && !_qaService) {
57577         _qaService = services.keepRight;
57578         _qaService.on("loaded", throttledRedraw);
57579       } else if (!services.keepRight && _qaService) {
57580         _qaService = null;
57581       }
57582       return _qaService;
57583     }
57584     function editOn() {
57585       if (!layerVisible) {
57586         layerVisible = true;
57587         drawLayer.style("display", "block");
57588       }
57589     }
57590     function editOff() {
57591       if (layerVisible) {
57592         layerVisible = false;
57593         drawLayer.style("display", "none");
57594         drawLayer.selectAll(".qaItem.keepRight").remove();
57595         touchLayer.selectAll(".qaItem.keepRight").remove();
57596       }
57597     }
57598     function layerOn() {
57599       editOn();
57600       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
57601     }
57602     function layerOff() {
57603       throttledRedraw.cancel();
57604       drawLayer.interrupt();
57605       touchLayer.selectAll(".qaItem.keepRight").remove();
57606       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
57607         editOff();
57608         dispatch14.call("change");
57609       });
57610     }
57611     function updateMarkers() {
57612       if (!layerVisible || !_layerEnabled) return;
57613       const service = getService();
57614       const selectedID = context.selectedErrorID();
57615       const data = service ? service.getItems(projection2) : [];
57616       const getTransform = svgPointTransform(projection2);
57617       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
57618       markers.exit().remove();
57619       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
57620       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
57621       markersEnter.append("path").call(markerPath, "shadow");
57622       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");
57623       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
57624       if (touchLayer.empty()) return;
57625       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57626       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
57627       targets.exit().remove();
57628       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
57629       function sortY(a4, b3) {
57630         return a4.id === selectedID ? 1 : b3.id === selectedID ? -1 : a4.severity === "error" && b3.severity !== "error" ? 1 : b3.severity === "error" && a4.severity !== "error" ? -1 : b3.loc[1] - a4.loc[1];
57631       }
57632     }
57633     function drawKeepRight(selection2) {
57634       const service = getService();
57635       const surface = context.surface();
57636       if (surface && !surface.empty()) {
57637         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
57638       }
57639       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
57640       drawLayer.exit().remove();
57641       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
57642       if (_layerEnabled) {
57643         if (service && ~~context.map().zoom() >= minZoom5) {
57644           editOn();
57645           service.loadIssues(projection2);
57646           updateMarkers();
57647         } else {
57648           editOff();
57649         }
57650       }
57651     }
57652     drawKeepRight.enabled = function(val) {
57653       if (!arguments.length) return _layerEnabled;
57654       _layerEnabled = val;
57655       if (_layerEnabled) {
57656         layerOn();
57657       } else {
57658         layerOff();
57659         if (context.selectedErrorID()) {
57660           context.enter(modeBrowse(context));
57661         }
57662       }
57663       dispatch14.call("change");
57664       return this;
57665     };
57666     drawKeepRight.supported = () => !!getService();
57667     return drawKeepRight;
57668   }
57669   var _layerEnabled, _qaService;
57670   var init_keepRight2 = __esm({
57671     "modules/svg/keepRight.js"() {
57672       "use strict";
57673       init_throttle();
57674       init_src5();
57675       init_browse();
57676       init_helpers();
57677       init_services();
57678       _layerEnabled = false;
57679     }
57680   });
57681
57682   // modules/svg/geolocate.js
57683   var geolocate_exports = {};
57684   __export(geolocate_exports, {
57685     svgGeolocate: () => svgGeolocate
57686   });
57687   function svgGeolocate(projection2) {
57688     var layer = select_default2(null);
57689     var _position;
57690     function init2() {
57691       if (svgGeolocate.initialized) return;
57692       svgGeolocate.enabled = false;
57693       svgGeolocate.initialized = true;
57694     }
57695     function showLayer() {
57696       layer.style("display", "block");
57697     }
57698     function hideLayer() {
57699       layer.transition().duration(250).style("opacity", 0);
57700     }
57701     function layerOn() {
57702       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
57703     }
57704     function layerOff() {
57705       layer.style("display", "none");
57706     }
57707     function transform2(d2) {
57708       return svgPointTransform(projection2)(d2);
57709     }
57710     function accuracy(accuracy2, loc) {
57711       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
57712       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
57713     }
57714     function update() {
57715       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
57716       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
57717       groups.exit().remove();
57718       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
57719       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");
57720       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");
57721       groups.merge(pointsEnter).attr("transform", transform2);
57722       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
57723     }
57724     function drawLocation(selection2) {
57725       var enabled = svgGeolocate.enabled;
57726       layer = selection2.selectAll(".layer-geolocate").data([0]);
57727       layer.exit().remove();
57728       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
57729       layerEnter.append("g").attr("class", "geolocations");
57730       layer = layerEnter.merge(layer);
57731       if (enabled) {
57732         update();
57733       } else {
57734         layerOff();
57735       }
57736     }
57737     drawLocation.enabled = function(position, enabled) {
57738       if (!arguments.length) return svgGeolocate.enabled;
57739       _position = position;
57740       svgGeolocate.enabled = enabled;
57741       if (svgGeolocate.enabled) {
57742         showLayer();
57743         layerOn();
57744       } else {
57745         hideLayer();
57746       }
57747       return this;
57748     };
57749     init2();
57750     return drawLocation;
57751   }
57752   var init_geolocate = __esm({
57753     "modules/svg/geolocate.js"() {
57754       "use strict";
57755       init_src5();
57756       init_helpers();
57757       init_geo2();
57758     }
57759   });
57760
57761   // modules/svg/labels.js
57762   var labels_exports = {};
57763   __export(labels_exports, {
57764     isAddressPoint: () => isAddressPoint,
57765     svgLabels: () => svgLabels,
57766     textWidth: () => textWidth
57767   });
57768   function svgLabels(projection2, context) {
57769     var path = path_default(projection2);
57770     var detected = utilDetect();
57771     var baselineHack = detected.browser.toLowerCase() === "safari";
57772     var _rdrawn = new RBush();
57773     var _rskipped = new RBush();
57774     var _entitybboxes = {};
57775     const labelStack = [
57776       ["line", "aeroway", "*", 12],
57777       ["line", "highway", "motorway", 12],
57778       ["line", "highway", "trunk", 12],
57779       ["line", "highway", "primary", 12],
57780       ["line", "highway", "secondary", 12],
57781       ["line", "highway", "tertiary", 12],
57782       ["line", "highway", "*", 12],
57783       ["line", "railway", "*", 12],
57784       ["line", "waterway", "*", 12],
57785       ["area", "aeroway", "*", 12],
57786       ["area", "amenity", "*", 12],
57787       ["area", "building", "*", 12],
57788       ["area", "historic", "*", 12],
57789       ["area", "leisure", "*", 12],
57790       ["area", "man_made", "*", 12],
57791       ["area", "natural", "*", 12],
57792       ["area", "shop", "*", 12],
57793       ["area", "tourism", "*", 12],
57794       ["area", "camp_site", "*", 12],
57795       ["point", "aeroway", "*", 10],
57796       ["point", "amenity", "*", 10],
57797       ["point", "building", "*", 10],
57798       ["point", "historic", "*", 10],
57799       ["point", "leisure", "*", 10],
57800       ["point", "man_made", "*", 10],
57801       ["point", "natural", "*", 10],
57802       ["point", "shop", "*", 10],
57803       ["point", "tourism", "*", 10],
57804       ["point", "camp_site", "*", 10],
57805       ["line", "ref", "*", 12],
57806       ["area", "ref", "*", 12],
57807       ["point", "ref", "*", 10],
57808       ["line", "name", "*", 12],
57809       ["area", "name", "*", 12],
57810       ["point", "name", "*", 10],
57811       ["point", "addr:housenumber", "*", 10],
57812       ["point", "addr:housename", "*", 10]
57813     ];
57814     function shouldSkipIcon(preset) {
57815       var noIcons = ["building", "landuse", "natural"];
57816       return noIcons.some(function(s2) {
57817         return preset.id.indexOf(s2) >= 0;
57818       });
57819     }
57820     function drawLinePaths(selection2, labels, filter2, classes) {
57821       var paths = selection2.selectAll("path:not(.debug)").filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57822       paths.exit().remove();
57823       paths.enter().append("path").style("stroke-width", (d2) => d2.position["font-size"]).attr("id", (d2) => "ideditor-labelpath-" + d2.entity.id).attr("class", classes).merge(paths).attr("d", (d2) => d2.position.lineString);
57824     }
57825     function drawLineLabels(selection2, labels, filter2, classes) {
57826       var texts = selection2.selectAll("text." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57827       texts.exit().remove();
57828       texts.enter().append("text").attr("class", (d2) => classes + " " + d2.position.classes + " " + d2.entity.id).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
57829       selection2.selectAll("text." + classes).selectAll(".textpath").filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity)).attr("startOffset", "50%").attr("xlink:href", function(d2) {
57830         return "#ideditor-labelpath-" + d2.entity.id;
57831       }).text((d2) => d2.name);
57832     }
57833     function drawPointLabels(selection2, labels, filter2, classes) {
57834       if (classes.includes("pointlabel-halo")) {
57835         labels = labels.filter((d2) => !d2.position.isAddr);
57836       }
57837       var texts = selection2.selectAll("text." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57838       texts.exit().remove();
57839       texts.enter().append("text").attr("class", (d2) => classes + " " + d2.position.classes + " " + d2.entity.id).style("text-anchor", (d2) => d2.position.textAnchor).text((d2) => d2.name).merge(texts).attr("x", (d2) => d2.position.x).attr("y", (d2) => d2.position.y);
57840     }
57841     function drawAreaLabels(selection2, labels, filter2, classes) {
57842       labels = labels.filter(hasText);
57843       drawPointLabels(selection2, labels, filter2, classes);
57844       function hasText(d2) {
57845         return d2.position.hasOwnProperty("x") && d2.position.hasOwnProperty("y");
57846       }
57847     }
57848     function drawAreaIcons(selection2, labels, filter2, classes) {
57849       var icons = selection2.selectAll("use." + classes).filter((d2) => filter2(d2.entity)).data(labels, (d2) => osmEntity.key(d2.entity));
57850       icons.exit().remove();
57851       icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", (d2) => d2.position.transform).attr("xlink:href", function(d2) {
57852         var preset = _mainPresetIndex.match(d2.entity, context.graph());
57853         var picon = preset && preset.icon;
57854         return picon ? "#" + picon : "";
57855       });
57856     }
57857     function drawCollisionBoxes(selection2, rtree, which) {
57858       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
57859       var gj = [];
57860       if (context.getDebug("collision")) {
57861         gj = rtree.all().map(function(d2) {
57862           return { type: "Polygon", coordinates: [[
57863             [d2.minX, d2.minY],
57864             [d2.maxX, d2.minY],
57865             [d2.maxX, d2.maxY],
57866             [d2.minX, d2.maxY],
57867             [d2.minX, d2.minY]
57868           ]] };
57869         });
57870       }
57871       var boxes = selection2.selectAll("." + which).data(gj);
57872       boxes.exit().remove();
57873       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
57874     }
57875     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
57876       var wireframe = context.surface().classed("fill-wireframe");
57877       var zoom = geoScaleToZoom(projection2.scale());
57878       var labelable = [];
57879       var renderNodeAs = {};
57880       var i3, j3, k3, entity, geometry;
57881       for (i3 = 0; i3 < labelStack.length; i3++) {
57882         labelable.push([]);
57883       }
57884       if (fullRedraw) {
57885         _rdrawn.clear();
57886         _rskipped.clear();
57887         _entitybboxes = {};
57888       } else {
57889         for (i3 = 0; i3 < entities.length; i3++) {
57890           entity = entities[i3];
57891           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
57892           for (j3 = 0; j3 < toRemove.length; j3++) {
57893             _rdrawn.remove(toRemove[j3]);
57894             _rskipped.remove(toRemove[j3]);
57895           }
57896         }
57897       }
57898       for (i3 = 0; i3 < entities.length; i3++) {
57899         entity = entities[i3];
57900         geometry = entity.geometry(graph);
57901         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
57902           const isAddr = isAddressPoint(entity.tags);
57903           var hasDirections = entity.directions(graph, projection2).length;
57904           var markerPadding = 0;
57905           if (wireframe) {
57906             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57907           } else if (geometry === "vertex") {
57908             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57909           } else if (zoom >= 18 && hasDirections) {
57910             renderNodeAs[entity.id] = { geometry: "vertex", isAddr };
57911           } else {
57912             renderNodeAs[entity.id] = { geometry: "point", isAddr };
57913             markerPadding = 20;
57914           }
57915           if (isAddr) {
57916             undoInsert(entity.id + "P");
57917           } else {
57918             var coord2 = projection2(entity.loc);
57919             var nodePadding = 10;
57920             var bbox2 = {
57921               minX: coord2[0] - nodePadding,
57922               minY: coord2[1] - nodePadding - markerPadding,
57923               maxX: coord2[0] + nodePadding,
57924               maxY: coord2[1] + nodePadding
57925             };
57926             doInsert(bbox2, entity.id + "P");
57927           }
57928         }
57929         if (geometry === "vertex") {
57930           geometry = "point";
57931         }
57932         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
57933         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
57934         if (!icon2 && !utilDisplayName(entity)) continue;
57935         for (k3 = 0; k3 < labelStack.length; k3++) {
57936           var matchGeom = labelStack[k3][0];
57937           var matchKey = labelStack[k3][1];
57938           var matchVal = labelStack[k3][2];
57939           var hasVal = entity.tags[matchKey];
57940           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
57941             labelable[k3].push(entity);
57942             break;
57943           }
57944         }
57945       }
57946       var labelled = {
57947         point: [],
57948         line: [],
57949         area: []
57950       };
57951       for (k3 = 0; k3 < labelable.length; k3++) {
57952         var fontSize = labelStack[k3][3];
57953         for (i3 = 0; i3 < labelable[k3].length; i3++) {
57954           entity = labelable[k3][i3];
57955           geometry = entity.geometry(graph);
57956           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
57957           var name = getName(entity);
57958           var width = name && textWidth(name, fontSize, selection2.select("g.layer-osm.labels").node());
57959           var p2 = null;
57960           if (geometry === "point" || geometry === "vertex") {
57961             if (wireframe) continue;
57962             var renderAs = renderNodeAs[entity.id];
57963             if (renderAs.geometry === "vertex" && zoom < 17) continue;
57964             while (renderAs.isAddr && width > 36) {
57965               name = `${name.substring(0, name.replace(/…$/, "").length - 1)}\u2026`;
57966               width = textWidth(name, fontSize, selection2.select("g.layer-osm.labels").node());
57967             }
57968             p2 = getPointLabel(entity, width, fontSize, renderAs);
57969           } else if (geometry === "line") {
57970             p2 = getLineLabel(entity, width, fontSize);
57971           } else if (geometry === "area") {
57972             p2 = getAreaLabel(entity, width, fontSize);
57973           }
57974           if (p2) {
57975             if (geometry === "vertex") {
57976               geometry = "point";
57977             }
57978             p2.classes = geometry + " tag-" + labelStack[k3][1];
57979             labelled[geometry].push({
57980               entity,
57981               name,
57982               position: p2
57983             });
57984           }
57985         }
57986       }
57987       function isInterestingVertex(entity2) {
57988         var selectedIDs = context.selectedIDs();
57989         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent2) {
57990           return selectedIDs.indexOf(parent2.id) !== -1;
57991         });
57992       }
57993       function getPointLabel(entity2, width2, height, style) {
57994         var y2 = style.geometry === "point" ? -12 : 0;
57995         var pointOffsets = {
57996           ltr: [15, y2, "start"],
57997           rtl: [-15, y2, "end"]
57998         };
57999         const isAddrMarker = style.isAddr && style.geometry !== "vertex";
58000         var textDirection = _mainLocalizer.textDirection();
58001         var coord3 = projection2(entity2.loc);
58002         var textPadding = 2;
58003         var offset = pointOffsets[textDirection];
58004         if (isAddrMarker) offset = [0, 1, "middle"];
58005         var p3 = {
58006           height,
58007           width: width2,
58008           x: coord3[0] + offset[0],
58009           y: coord3[1] + offset[1],
58010           textAnchor: offset[2]
58011         };
58012         let bbox3;
58013         if (isAddrMarker) {
58014           bbox3 = {
58015             minX: p3.x - width2 / 2 - textPadding,
58016             minY: p3.y - height / 2 - textPadding,
58017             maxX: p3.x + width2 / 2 + textPadding,
58018             maxY: p3.y + height / 2 + textPadding
58019           };
58020         } else if (textDirection === "rtl") {
58021           bbox3 = {
58022             minX: p3.x - width2 - textPadding,
58023             minY: p3.y - height / 2 - textPadding,
58024             maxX: p3.x + textPadding,
58025             maxY: p3.y + height / 2 + textPadding
58026           };
58027         } else {
58028           bbox3 = {
58029             minX: p3.x - textPadding,
58030             minY: p3.y - height / 2 - textPadding,
58031             maxX: p3.x + width2 + textPadding,
58032             maxY: p3.y + height / 2 + textPadding
58033           };
58034         }
58035         if (tryInsert([bbox3], entity2.id, true)) {
58036           return p3;
58037         }
58038       }
58039       function getLineLabel(entity2, width2, height) {
58040         var viewport = geoExtent(context.projection.clipExtent()).polygon();
58041         var points = graph.childNodes(entity2).map(function(node) {
58042           return projection2(node.loc);
58043         });
58044         var length2 = geoPathLength(points);
58045         if (length2 < width2 + 20) return;
58046         var lineOffsets = [
58047           50,
58048           45,
58049           55,
58050           40,
58051           60,
58052           35,
58053           65,
58054           30,
58055           70,
58056           25,
58057           75,
58058           20,
58059           80,
58060           15,
58061           95,
58062           10,
58063           90,
58064           5,
58065           95
58066         ];
58067         var padding = 3;
58068         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
58069           var offset = lineOffsets[i4];
58070           var middle = offset / 100 * length2;
58071           var start2 = middle - width2 / 2;
58072           if (start2 < 0 || start2 + width2 > length2) continue;
58073           var sub = subpath(points, start2, start2 + width2);
58074           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
58075             continue;
58076           }
58077           var isReverse = reverse(sub);
58078           if (isReverse) {
58079             sub = sub.reverse();
58080           }
58081           var bboxes = [];
58082           var boxsize = (height + 2) / 2;
58083           for (var j4 = 0; j4 < sub.length - 1; j4++) {
58084             var a4 = sub[j4];
58085             var b3 = sub[j4 + 1];
58086             var num = Math.max(1, Math.floor(geoVecLength(a4, b3) / boxsize / 2));
58087             for (var box = 0; box < num; box++) {
58088               var p3 = geoVecInterp(a4, b3, box / num);
58089               var x05 = p3[0] - boxsize - padding;
58090               var y05 = p3[1] - boxsize - padding;
58091               var x12 = p3[0] + boxsize + padding;
58092               var y12 = p3[1] + boxsize + padding;
58093               bboxes.push({
58094                 minX: Math.min(x05, x12),
58095                 minY: Math.min(y05, y12),
58096                 maxX: Math.max(x05, x12),
58097                 maxY: Math.max(y05, y12)
58098               });
58099             }
58100           }
58101           if (tryInsert(bboxes, entity2.id, false)) {
58102             return {
58103               "font-size": height + 2,
58104               lineString: lineString2(sub),
58105               startOffset: offset + "%"
58106             };
58107           }
58108         }
58109         function reverse(p4) {
58110           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
58111           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
58112         }
58113         function lineString2(points2) {
58114           return "M" + points2.join("L");
58115         }
58116         function subpath(points2, from, to) {
58117           var sofar = 0;
58118           var start3, end, i0, i1;
58119           for (var i5 = 0; i5 < points2.length - 1; i5++) {
58120             var a5 = points2[i5];
58121             var b4 = points2[i5 + 1];
58122             var current = geoVecLength(a5, b4);
58123             var portion;
58124             if (!start3 && sofar + current >= from) {
58125               portion = (from - sofar) / current;
58126               start3 = [
58127                 a5[0] + portion * (b4[0] - a5[0]),
58128                 a5[1] + portion * (b4[1] - a5[1])
58129               ];
58130               i0 = i5 + 1;
58131             }
58132             if (!end && sofar + current >= to) {
58133               portion = (to - sofar) / current;
58134               end = [
58135                 a5[0] + portion * (b4[0] - a5[0]),
58136                 a5[1] + portion * (b4[1] - a5[1])
58137               ];
58138               i1 = i5 + 1;
58139             }
58140             sofar += current;
58141           }
58142           var result = points2.slice(i0, i1);
58143           result.unshift(start3);
58144           result.push(end);
58145           return result;
58146         }
58147       }
58148       function getAreaLabel(entity2, width2, height) {
58149         var centroid = path.centroid(entity2.asGeoJSON(graph));
58150         var extent = entity2.extent(graph);
58151         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
58152         if (isNaN(centroid[0]) || areaWidth < 20) return;
58153         var preset2 = _mainPresetIndex.match(entity2, context.graph());
58154         var picon = preset2 && preset2.icon;
58155         var iconSize = 17;
58156         var padding = 2;
58157         var p3 = {};
58158         if (picon && !shouldSkipIcon(preset2)) {
58159           if (addIcon()) {
58160             addLabel(iconSize + padding);
58161             return p3;
58162           }
58163         } else {
58164           if (addLabel(0)) {
58165             return p3;
58166           }
58167         }
58168         function addIcon() {
58169           var iconX = centroid[0] - iconSize / 2;
58170           var iconY = centroid[1] - iconSize / 2;
58171           var bbox3 = {
58172             minX: iconX,
58173             minY: iconY,
58174             maxX: iconX + iconSize,
58175             maxY: iconY + iconSize
58176           };
58177           if (tryInsert([bbox3], entity2.id + "I", true)) {
58178             p3.transform = "translate(" + iconX + "," + iconY + ")";
58179             return true;
58180           }
58181           return false;
58182         }
58183         function addLabel(yOffset) {
58184           if (width2 && areaWidth >= width2 + 20) {
58185             var labelX = centroid[0];
58186             var labelY = centroid[1] + yOffset;
58187             var bbox3 = {
58188               minX: labelX - width2 / 2 - padding,
58189               minY: labelY - height / 2 - padding,
58190               maxX: labelX + width2 / 2 + padding,
58191               maxY: labelY + height / 2 + padding
58192             };
58193             if (tryInsert([bbox3], entity2.id, true)) {
58194               p3.x = labelX;
58195               p3.y = labelY;
58196               p3.textAnchor = "middle";
58197               p3.height = height;
58198               return true;
58199             }
58200           }
58201           return false;
58202         }
58203       }
58204       function doInsert(bbox3, id2) {
58205         bbox3.id = id2;
58206         var oldbox = _entitybboxes[id2];
58207         if (oldbox) {
58208           _rdrawn.remove(oldbox);
58209         }
58210         _entitybboxes[id2] = bbox3;
58211         _rdrawn.insert(bbox3);
58212       }
58213       function undoInsert(id2) {
58214         var oldbox = _entitybboxes[id2];
58215         if (oldbox) {
58216           _rdrawn.remove(oldbox);
58217         }
58218         delete _entitybboxes[id2];
58219       }
58220       function tryInsert(bboxes, id2, saveSkipped) {
58221         var skipped = false;
58222         for (var i4 = 0; i4 < bboxes.length; i4++) {
58223           var bbox3 = bboxes[i4];
58224           bbox3.id = id2;
58225           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
58226             skipped = true;
58227             break;
58228           }
58229           if (_rdrawn.collides(bbox3)) {
58230             skipped = true;
58231             break;
58232           }
58233         }
58234         _entitybboxes[id2] = bboxes;
58235         if (skipped) {
58236           if (saveSkipped) {
58237             _rskipped.load(bboxes);
58238           }
58239         } else {
58240           _rdrawn.load(bboxes);
58241         }
58242         return !skipped;
58243       }
58244       var layer = selection2.selectAll(".layer-osm.labels");
58245       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
58246         return "labels-group " + d2;
58247       });
58248       var halo = layer.selectAll(".labels-group.halo");
58249       var label = layer.selectAll(".labels-group.label");
58250       var debug2 = layer.selectAll(".labels-group.debug");
58251       drawPointLabels(label, labelled.point, filter2, "pointlabel");
58252       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo");
58253       drawLinePaths(layer, labelled.line, filter2, "");
58254       drawLineLabels(label, labelled.line, filter2, "linelabel");
58255       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo");
58256       drawAreaLabels(label, labelled.area, filter2, "arealabel");
58257       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo");
58258       drawAreaIcons(label, labelled.area, filter2, "areaicon");
58259       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo");
58260       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
58261       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
58262       layer.call(filterLabels);
58263     }
58264     function filterLabels(selection2) {
58265       var _a4, _b2;
58266       var drawLayer = selection2.selectAll(".layer-osm.labels");
58267       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
58268       layers.selectAll(".nolabel").classed("nolabel", false);
58269       var mouse = context.map().mouse();
58270       var ids = [];
58271       var pad3, bbox2;
58272       if (mouse && context.mode().id !== "browse" && context.mode().id !== "select") {
58273         pad3 = 20;
58274         bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
58275         var nearMouse = _rdrawn.search(bbox2).map(function(entity) {
58276           return entity.id;
58277         });
58278         ids.push.apply(ids, nearMouse);
58279       }
58280       ids = utilArrayDifference(ids, ((_b2 = (_a4 = context.mode()) == null ? void 0 : _a4.selectedIDs) == null ? void 0 : _b2.call(_a4)) || []);
58281       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
58282       var debug2 = selection2.selectAll(".labels-group.debug");
58283       var gj = [];
58284       if (context.getDebug("collision")) {
58285         gj = bbox2 ? [{
58286           type: "Polygon",
58287           coordinates: [[
58288             [bbox2.minX, bbox2.minY],
58289             [bbox2.maxX, bbox2.minY],
58290             [bbox2.maxX, bbox2.maxY],
58291             [bbox2.minX, bbox2.maxY],
58292             [bbox2.minX, bbox2.minY]
58293           ]]
58294         }] : [];
58295       }
58296       var box = debug2.selectAll(".debug-mouse").data(gj);
58297       box.exit().remove();
58298       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
58299     }
58300     var throttleFilterLabels = throttle_default(filterLabels, 100);
58301     drawLabels.observe = function(selection2) {
58302       var listener = function() {
58303         throttleFilterLabels(selection2);
58304       };
58305       selection2.on("mousemove.hidelabels", listener);
58306       context.on("enter.hidelabels", listener);
58307     };
58308     drawLabels.off = function(selection2) {
58309       throttleFilterLabels.cancel();
58310       selection2.on("mousemove.hidelabels", null);
58311       context.on("enter.hidelabels", null);
58312     };
58313     return drawLabels;
58314   }
58315   function textWidth(text, size, container) {
58316     let c2 = _textWidthCache[size];
58317     if (!c2) c2 = _textWidthCache[size] = {};
58318     if (c2[text]) {
58319       return c2[text];
58320     }
58321     const elem = document.createElementNS("http://www.w3.org/2000/svg", "text");
58322     elem.style.fontSize = `${size}px`;
58323     elem.textContent = text;
58324     container.appendChild(elem);
58325     c2[text] = elem.getComputedTextLength();
58326     elem.remove();
58327     return c2[text];
58328   }
58329   function isAddressPoint(tags) {
58330     const keys2 = Object.keys(tags).filter(
58331       (key) => osmIsInterestingTag(key) && !nonPrimaryKeys.has(key) && !nonPrimaryKeysRegex.test(key)
58332     );
58333     return keys2.length > 0 && keys2.every(
58334       (key) => key.startsWith("addr:")
58335     );
58336   }
58337   var _textWidthCache, nonPrimaryKeys, nonPrimaryKeysRegex;
58338   var init_labels = __esm({
58339     "modules/svg/labels.js"() {
58340       "use strict";
58341       init_throttle();
58342       init_src2();
58343       init_rbush();
58344       init_localizer();
58345       init_geo2();
58346       init_presets();
58347       init_osm();
58348       init_detect();
58349       init_util();
58350       _textWidthCache = {};
58351       nonPrimaryKeys = /* @__PURE__ */ new Set([
58352         "check_date",
58353         "fixme",
58354         "layer",
58355         "level",
58356         "level:ref",
58357         "note"
58358       ]);
58359       nonPrimaryKeysRegex = /^(ref|survey|note):/;
58360     }
58361   });
58362
58363   // node_modules/exifr/dist/full.esm.mjs
58364   function l(e3, t2 = o) {
58365     if (n2) try {
58366       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
58367         /* webpackIgnore: true */
58368         e3
58369       ).then(t2);
58370     } catch (t3) {
58371       console.warn(`Couldn't load ${e3}`);
58372     }
58373   }
58374   function c(e3, t2, i3) {
58375     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
58376   }
58377   function p(e3) {
58378     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
58379   }
58380   function g2(e3) {
58381     let t2 = new Error(e3);
58382     throw delete t2.stack, t2;
58383   }
58384   function m2(e3) {
58385     return "" === (e3 = function(e4) {
58386       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
58387       return e4;
58388     }(e3).trim()) ? void 0 : e3;
58389   }
58390   function S2(e3) {
58391     let t2 = function(e4) {
58392       let t3 = 0;
58393       return e4.ifd0.enabled && (t3 += 1024), e4.exif.enabled && (t3 += 2048), e4.makerNote && (t3 += 2048), e4.userComment && (t3 += 1024), e4.gps.enabled && (t3 += 512), e4.interop.enabled && (t3 += 100), e4.ifd1.enabled && (t3 += 1024), t3 + 2048;
58394     }(e3);
58395     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
58396   }
58397   function b2(e3) {
58398     return y ? y.decode(e3) : a3 ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C2(e3)));
58399   }
58400   function P2(e3, t2) {
58401     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
58402   }
58403   function D2(e3, n3) {
58404     return "string" == typeof e3 ? O2(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O2(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I2(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R2) : void g2("Invalid input argument");
58405   }
58406   function O2(e3, i3) {
58407     return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v2(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M2) : n2 ? v2(e3, i3, "fs") : t ? x(e3, i3, "url", M2) : void g2("Invalid input argument");
58408     var s2;
58409   }
58410   async function x(e3, t2, i3, n3) {
58411     return A2.has(i3) ? v2(e3, t2, i3) : n3 ? async function(e4, t3) {
58412       let i4 = await t3(e4);
58413       return new I2(i4);
58414     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
58415   }
58416   async function v2(e3, t2, i3) {
58417     let n3 = new (A2.get(i3))(e3, t2);
58418     return await n3.read(), n3;
58419   }
58420   function U2(e3, t2, i3) {
58421     let n3 = new L2();
58422     for (let [e4, t3] of i3) n3.set(e4, t3);
58423     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
58424     else e3.set(t2, n3);
58425     return n3;
58426   }
58427   function F2(e3, t2, i3) {
58428     let n3, s2 = e3.get(t2);
58429     for (n3 of i3) s2.set(n3[0], n3[1]);
58430   }
58431   function Q2(e3, t2) {
58432     let i3, n3, s2, r2, a4 = [];
58433     for (s2 of t2) {
58434       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
58435       n3.length && a4.push([s2, n3]);
58436     }
58437     return a4;
58438   }
58439   function Z(e3, t2) {
58440     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
58441   }
58442   function ee(e3, t2) {
58443     for (let i3 of t2) e3.add(i3);
58444   }
58445   async function ie2(e3, t2) {
58446     let i3 = new te(t2);
58447     return await i3.read(e3), i3.parse();
58448   }
58449   function ae2(e3) {
58450     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
58451   }
58452   function oe2(e3) {
58453     return e3 >= 224 && e3 <= 239;
58454   }
58455   function le2(e3, t2, i3) {
58456     for (let [n3, s2] of T2) if (s2.canHandle(e3, t2, i3)) return n3;
58457   }
58458   function de2(e3, t2, i3, n3) {
58459     var s2 = e3 + t2 / 60 + i3 / 3600;
58460     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
58461   }
58462   async function Se2(e3) {
58463     let t2 = new te(me);
58464     await t2.read(e3);
58465     let i3 = await t2.parse();
58466     if (i3 && i3.gps) {
58467       let { latitude: e4, longitude: t3 } = i3.gps;
58468       return { latitude: e4, longitude: t3 };
58469     }
58470   }
58471   async function ye2(e3) {
58472     let t2 = new te(Ce2);
58473     await t2.read(e3);
58474     let i3 = await t2.extractThumbnail();
58475     return i3 && a3 ? s.from(i3) : i3;
58476   }
58477   async function be2(e3) {
58478     let t2 = await this.thumbnail(e3);
58479     if (void 0 !== t2) {
58480       let e4 = new Blob([t2]);
58481       return URL.createObjectURL(e4);
58482     }
58483   }
58484   async function Pe2(e3) {
58485     let t2 = new te(Ie2);
58486     await t2.read(e3);
58487     let i3 = await t2.parse();
58488     if (i3 && i3.ifd0) return i3.ifd0[274];
58489   }
58490   async function Ae2(e3) {
58491     let t2 = await Pe2(e3);
58492     return Object.assign({ canvas: we2, css: Te2 }, ke2[t2]);
58493   }
58494   function xe2(e3, t2, i3) {
58495     return e3 <= t2 && t2 <= i3;
58496   }
58497   function Ge2(e3) {
58498     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
58499   }
58500   function Ve(e3) {
58501     let t2 = Array.from(e3).slice(1);
58502     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
58503   }
58504   function ze2(e3) {
58505     if ("string" == typeof e3) {
58506       var [t2, i3, n3, s2, r2, a4] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
58507       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a4) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a4)), Number.isNaN(+o2) ? e3 : o2;
58508     }
58509   }
58510   function He2(e3) {
58511     if ("string" == typeof e3) return e3;
58512     let t2 = [];
58513     if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je2(e3[i3 + 1], e3[i3]));
58514     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je2(e3[i3], e3[i3 + 1]));
58515     return m2(String.fromCodePoint(...t2));
58516   }
58517   function je2(e3, t2) {
58518     return e3 << 8 | t2;
58519   }
58520   function _e2(e3, t2) {
58521     let i3 = e3.serialize();
58522     void 0 !== i3 && (t2[e3.name] = i3);
58523   }
58524   function qe2(e3, t2) {
58525     let i3, n3 = [];
58526     if (!e3) return n3;
58527     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
58528     return n3;
58529   }
58530   function Qe2(e3) {
58531     if (function(e4) {
58532       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
58533     }(e3)) return;
58534     let t2 = Number(e3);
58535     if (!Number.isNaN(t2)) return t2;
58536     let i3 = e3.toLowerCase();
58537     return "true" === i3 || "false" !== i3 && e3.trim();
58538   }
58539   function mt(e3, t2) {
58540     return m2(e3.getString(t2, 4));
58541   }
58542   var e, t, i2, n2, s, r, a3, o, h2, u, f, d, C2, y, I2, k2, w2, T2, A2, M2, R2, L2, E, B2, N2, G, V2, z2, H2, j2, W2, K2, X3, _2, Y, $3, J2, q2, te, ne, se2, re3, he2, ue2, ce2, fe2, pe2, ge2, me, Ce2, Ie2, ke2, we2, Te2, De2, Oe2, ve2, Me2, Re2, Le2, Ue2, Fe2, Ee2, Be2, Ne2, We2, Ke2, Xe2, Ye, $e2, Je2, Ze2, et, tt, at, ot, lt, ht, ut, ct, ft, dt, pt, gt, St, Ct, yt, full_esm_default;
58543   var init_full_esm = __esm({
58544     "node_modules/exifr/dist/full.esm.mjs"() {
58545       e = "undefined" != typeof self ? self : global;
58546       t = "undefined" != typeof navigator;
58547       i2 = t && "undefined" == typeof HTMLImageElement;
58548       n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
58549       s = e.Buffer;
58550       r = e.BigInt;
58551       a3 = !!s;
58552       o = (e3) => e3;
58553       h2 = e.fetch;
58554       u = (e3) => h2 = e3;
58555       if (!e.fetch) {
58556         const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a4) => {
58557           let { port: o2, hostname: l2, pathname: h3, protocol: u2, search: c2 } = new URL(n3);
58558           const f2 = { method: "GET", hostname: l2, path: encodeURI(h3) + c2, headers: s2 };
58559           "" !== o2 && (f2.port = Number(o2));
58560           const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
58561             if (301 === e4.statusCode || 302 === e4.statusCode) {
58562               let t3 = new URL(e4.headers.location, n3).toString();
58563               return i3(t3, { headers: s2 }).then(r2).catch(a4);
58564             }
58565             r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
58566               let i4 = [];
58567               e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
58568             }) });
58569           });
58570           d2.on("error", a4), d2.end();
58571         });
58572         u(i3);
58573       }
58574       f = (e3) => p(e3) ? void 0 : e3;
58575       d = (e3) => void 0 !== e3;
58576       C2 = (e3) => String.fromCharCode.apply(null, e3);
58577       y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
58578       I2 = class _I {
58579         static from(e3, t2) {
58580           return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
58581         }
58582         constructor(e3, t2 = 0, i3, n3) {
58583           if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
58584           else if (e3 instanceof ArrayBuffer) {
58585             void 0 === i3 && (i3 = e3.byteLength - t2);
58586             let n4 = new DataView(e3, t2, i3);
58587             this._swapDataView(n4);
58588           } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
58589             void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
58590             let n4 = new DataView(e3.buffer, t2, i3);
58591             this._swapDataView(n4);
58592           } else if ("number" == typeof e3) {
58593             let t3 = new DataView(new ArrayBuffer(e3));
58594             this._swapDataView(t3);
58595           } else g2("Invalid input argument for BufferView: " + e3);
58596         }
58597         _swapArrayBuffer(e3) {
58598           this._swapDataView(new DataView(e3));
58599         }
58600         _swapBuffer(e3) {
58601           this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
58602         }
58603         _swapDataView(e3) {
58604           this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
58605         }
58606         _lengthToEnd(e3) {
58607           return this.byteLength - e3;
58608         }
58609         set(e3, t2, i3 = _I) {
58610           return e3 instanceof DataView || e3 instanceof _I ? e3 = new Uint8Array(e3.buffer, e3.byteOffset, e3.byteLength) : e3 instanceof ArrayBuffer && (e3 = new Uint8Array(e3)), e3 instanceof Uint8Array || g2("BufferView.set(): Invalid data argument."), this.toUint8().set(e3, t2), new i3(this, t2, e3.byteLength);
58611         }
58612         subarray(e3, t2) {
58613           return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
58614         }
58615         toUint8() {
58616           return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
58617         }
58618         getUint8Array(e3, t2) {
58619           return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
58620         }
58621         getString(e3 = 0, t2 = this.byteLength) {
58622           return b2(this.getUint8Array(e3, t2));
58623         }
58624         getLatin1String(e3 = 0, t2 = this.byteLength) {
58625           let i3 = this.getUint8Array(e3, t2);
58626           return C2(i3);
58627         }
58628         getUnicodeString(e3 = 0, t2 = this.byteLength) {
58629           const i3 = [];
58630           for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
58631           return C2(i3);
58632         }
58633         getInt8(e3) {
58634           return this.dataView.getInt8(e3);
58635         }
58636         getUint8(e3) {
58637           return this.dataView.getUint8(e3);
58638         }
58639         getInt16(e3, t2 = this.le) {
58640           return this.dataView.getInt16(e3, t2);
58641         }
58642         getInt32(e3, t2 = this.le) {
58643           return this.dataView.getInt32(e3, t2);
58644         }
58645         getUint16(e3, t2 = this.le) {
58646           return this.dataView.getUint16(e3, t2);
58647         }
58648         getUint32(e3, t2 = this.le) {
58649           return this.dataView.getUint32(e3, t2);
58650         }
58651         getFloat32(e3, t2 = this.le) {
58652           return this.dataView.getFloat32(e3, t2);
58653         }
58654         getFloat64(e3, t2 = this.le) {
58655           return this.dataView.getFloat64(e3, t2);
58656         }
58657         getFloat(e3, t2 = this.le) {
58658           return this.dataView.getFloat32(e3, t2);
58659         }
58660         getDouble(e3, t2 = this.le) {
58661           return this.dataView.getFloat64(e3, t2);
58662         }
58663         getUintBytes(e3, t2, i3) {
58664           switch (t2) {
58665             case 1:
58666               return this.getUint8(e3, i3);
58667             case 2:
58668               return this.getUint16(e3, i3);
58669             case 4:
58670               return this.getUint32(e3, i3);
58671             case 8:
58672               return this.getUint64 && this.getUint64(e3, i3);
58673           }
58674         }
58675         getUint(e3, t2, i3) {
58676           switch (t2) {
58677             case 8:
58678               return this.getUint8(e3, i3);
58679             case 16:
58680               return this.getUint16(e3, i3);
58681             case 32:
58682               return this.getUint32(e3, i3);
58683             case 64:
58684               return this.getUint64 && this.getUint64(e3, i3);
58685           }
58686         }
58687         toString(e3) {
58688           return this.dataView.toString(e3, this.constructor.name);
58689         }
58690         ensureChunk() {
58691         }
58692       };
58693       k2 = class extends Map {
58694         constructor(e3) {
58695           super(), this.kind = e3;
58696         }
58697         get(e3, t2) {
58698           return this.has(e3) || P2(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
58699             g2(`Unknown ${e4} '${t3}'.`);
58700           }(this.kind, e3), t2[e3].enabled || P2(this.kind, e3)), super.get(e3);
58701         }
58702         keyList() {
58703           return Array.from(this.keys());
58704         }
58705       };
58706       w2 = new k2("file parser");
58707       T2 = new k2("segment parser");
58708       A2 = new k2("file reader");
58709       M2 = (e3) => h2(e3).then((e4) => e4.arrayBuffer());
58710       R2 = (e3) => new Promise((t2, i3) => {
58711         let n3 = new FileReader();
58712         n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
58713       });
58714       L2 = class extends Map {
58715         get tagKeys() {
58716           return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
58717         }
58718         get tagValues() {
58719           return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
58720         }
58721       };
58722       E = /* @__PURE__ */ new Map();
58723       B2 = /* @__PURE__ */ new Map();
58724       N2 = /* @__PURE__ */ new Map();
58725       G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
58726       V2 = ["jfif", "xmp", "icc", "iptc", "ihdr"];
58727       z2 = ["tiff", ...V2];
58728       H2 = ["ifd0", "ifd1", "exif", "gps", "interop"];
58729       j2 = [...z2, ...H2];
58730       W2 = ["makerNote", "userComment"];
58731       K2 = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
58732       X3 = [...K2, "sanitize", "mergeOutput", "silentErrors"];
58733       _2 = class {
58734         get translate() {
58735           return this.translateKeys || this.translateValues || this.reviveValues;
58736         }
58737       };
58738       Y = class extends _2 {
58739         get needed() {
58740           return this.enabled || this.deps.size > 0;
58741         }
58742         constructor(e3, t2, i3, n3) {
58743           if (super(), c(this, "enabled", false), c(this, "skip", /* @__PURE__ */ new Set()), c(this, "pick", /* @__PURE__ */ new Set()), c(this, "deps", /* @__PURE__ */ new Set()), c(this, "translateKeys", false), c(this, "translateValues", false), c(this, "reviveValues", false), this.key = e3, this.enabled = t2, this.parse = this.enabled, this.applyInheritables(n3), this.canBeFiltered = H2.includes(e3), this.canBeFiltered && (this.dict = E.get(e3)), void 0 !== i3) if (Array.isArray(i3)) this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
58744           else if ("object" == typeof i3) {
58745             if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
58746               let { pick: e4, skip: t3 } = i3;
58747               e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
58748             }
58749             this.applyInheritables(i3);
58750           } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
58751         }
58752         applyInheritables(e3) {
58753           let t2, i3;
58754           for (t2 of K2) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
58755         }
58756         translateTagSet(e3, t2) {
58757           if (this.dict) {
58758             let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
58759             for (i3 of e3) "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
58760           } else for (let i3 of e3) t2.add(i3);
58761         }
58762         finalizeFilters() {
58763           !this.enabled && this.deps.size > 0 ? (this.enabled = true, ee(this.pick, this.deps)) : this.enabled && this.pick.size > 0 && ee(this.pick, this.deps);
58764         }
58765       };
58766       $3 = { jfif: false, tiff: true, xmp: false, icc: false, iptc: false, ifd0: true, ifd1: false, exif: true, gps: true, interop: false, ihdr: void 0, makerNote: false, userComment: false, multiSegment: false, skip: [], pick: [], translateKeys: true, translateValues: true, reviveValues: true, sanitize: true, mergeOutput: true, silentErrors: true, chunked: true, firstChunkSize: void 0, firstChunkSizeNode: 512, firstChunkSizeBrowser: 65536, chunkSize: 65536, chunkLimit: 5 };
58767       J2 = /* @__PURE__ */ new Map();
58768       q2 = class extends _2 {
58769         static useCached(e3) {
58770           let t2 = J2.get(e3);
58771           return void 0 !== t2 || (t2 = new this(e3), J2.set(e3, t2)), t2;
58772         }
58773         constructor(e3) {
58774           super(), true === e3 ? this.setupFromTrue() : void 0 === e3 ? this.setupFromUndefined() : Array.isArray(e3) ? this.setupFromArray(e3) : "object" == typeof e3 ? this.setupFromObject(e3) : g2(`Invalid options argument ${e3}`), void 0 === this.firstChunkSize && (this.firstChunkSize = t ? this.firstChunkSizeBrowser : this.firstChunkSizeNode), this.mergeOutput && (this.ifd1.enabled = false), this.filterNestedSegmentTags(), this.traverseTiffDependencyTree(), this.checkLoadedPlugins();
58775         }
58776         setupFromUndefined() {
58777           let e3;
58778           for (e3 of G) this[e3] = $3[e3];
58779           for (e3 of X3) this[e3] = $3[e3];
58780           for (e3 of W2) this[e3] = $3[e3];
58781           for (e3 of j2) this[e3] = new Y(e3, $3[e3], void 0, this);
58782         }
58783         setupFromTrue() {
58784           let e3;
58785           for (e3 of G) this[e3] = $3[e3];
58786           for (e3 of X3) this[e3] = $3[e3];
58787           for (e3 of W2) this[e3] = true;
58788           for (e3 of j2) this[e3] = new Y(e3, true, void 0, this);
58789         }
58790         setupFromArray(e3) {
58791           let t2;
58792           for (t2 of G) this[t2] = $3[t2];
58793           for (t2 of X3) this[t2] = $3[t2];
58794           for (t2 of W2) this[t2] = $3[t2];
58795           for (t2 of j2) this[t2] = new Y(t2, false, void 0, this);
58796           this.setupGlobalFilters(e3, void 0, H2);
58797         }
58798         setupFromObject(e3) {
58799           let t2;
58800           for (t2 of (H2.ifd0 = H2.ifd0 || H2.image, H2.ifd1 = H2.ifd1 || H2.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $3[t2]);
58801           for (t2 of X3) this[t2] = Z(e3[t2], $3[t2]);
58802           for (t2 of W2) this[t2] = Z(e3[t2], $3[t2]);
58803           for (t2 of z2) this[t2] = new Y(t2, $3[t2], e3[t2], this);
58804           for (t2 of H2) this[t2] = new Y(t2, $3[t2], e3[t2], this.tiff);
58805           this.setupGlobalFilters(e3.pick, e3.skip, H2, j2), true === e3.tiff ? this.batchEnableWithBool(H2, true) : false === e3.tiff ? this.batchEnableWithUserValue(H2, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H2) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H2);
58806         }
58807         batchEnableWithBool(e3, t2) {
58808           for (let i3 of e3) this[i3].enabled = t2;
58809         }
58810         batchEnableWithUserValue(e3, t2) {
58811           for (let i3 of e3) {
58812             let e4 = t2[i3];
58813             this[i3].enabled = false !== e4 && void 0 !== e4;
58814           }
58815         }
58816         setupGlobalFilters(e3, t2, i3, n3 = i3) {
58817           if (e3 && e3.length) {
58818             for (let e4 of n3) this[e4].enabled = false;
58819             let t3 = Q2(e3, i3);
58820             for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
58821           } else if (t2 && t2.length) {
58822             let e4 = Q2(t2, i3);
58823             for (let [t3, i4] of e4) ee(this[t3].skip, i4);
58824           }
58825         }
58826         filterNestedSegmentTags() {
58827           let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
58828           this.makerNote ? t2.deps.add(37500) : t2.skip.add(37500), this.userComment ? t2.deps.add(37510) : t2.skip.add(37510), i3.enabled || e3.skip.add(700), n3.enabled || e3.skip.add(33723), s2.enabled || e3.skip.add(34675);
58829         }
58830         traverseTiffDependencyTree() {
58831           let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
58832           n3.needed && (t2.deps.add(40965), e3.deps.add(40965)), t2.needed && e3.deps.add(34665), i3.needed && e3.deps.add(34853), this.tiff.enabled = H2.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
58833           for (let e4 of H2) this[e4].finalizeFilters();
58834         }
58835         get onlyTiff() {
58836           return !V2.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
58837         }
58838         checkLoadedPlugins() {
58839           for (let e3 of z2) this[e3].enabled && !T2.has(e3) && P2("segment parser", e3);
58840         }
58841       };
58842       c(q2, "default", $3);
58843       te = class {
58844         constructor(e3) {
58845           c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q2.useCached(e3);
58846         }
58847         async read(e3) {
58848           this.file = await D2(e3, this.options);
58849         }
58850         setup() {
58851           if (this.fileParser) return;
58852           let { file: e3 } = this, t2 = e3.getUint16(0);
58853           for (let [i3, n3] of w2) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
58854           this.file.close && this.file.close(), g2("Unknown file format");
58855         }
58856         async parse() {
58857           let { output: e3, errors: t2 } = this;
58858           return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f(e3);
58859         }
58860         async executeParsers() {
58861           let { output: e3 } = this;
58862           await this.fileParser.parse();
58863           let t2 = Object.values(this.parsers).map(async (t3) => {
58864             let i3 = await t3.parse();
58865             t3.assignToOutput(e3, i3);
58866           });
58867           this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
58868         }
58869         async extractThumbnail() {
58870           this.setup();
58871           let { options: e3, file: t2 } = this, i3 = T2.get("tiff", e3);
58872           var n3;
58873           if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
58874           let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a4 = await r2.extractThumbnail();
58875           return t2.close && t2.close(), a4;
58876         }
58877       };
58878       ne = Object.freeze({ __proto__: null, parse: ie2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2 });
58879       se2 = class {
58880         constructor(e3, t2, i3) {
58881           c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
58882             let t3 = e4.start, i4 = e4.size || 65536;
58883             if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
58884             else try {
58885               e4.chunk = await this.file.readChunk(t3, i4);
58886             } catch (t4) {
58887               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
58888             }
58889             else this.file.byteLength > t3 + i4 ? e4.chunk = this.file.subarray(t3, i4) : void 0 === e4.size ? e4.chunk = this.file.subarray(t3) : g2("Segment unreachable: " + JSON.stringify(e4));
58890             return e4.chunk;
58891           }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
58892         }
58893         injectSegment(e3, t2) {
58894           this.options[e3].enabled && this.createParser(e3, t2);
58895         }
58896         createParser(e3, t2) {
58897           let i3 = new (T2.get(e3))(t2, this.options, this.file);
58898           return this.parsers[e3] = i3;
58899         }
58900         createParsers(e3) {
58901           for (let t2 of e3) {
58902             let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
58903             if (n3 && n3.enabled) {
58904               let t3 = this.parsers[e4];
58905               t3 && t3.append || t3 || this.createParser(e4, i3);
58906             }
58907           }
58908         }
58909         async readSegments(e3) {
58910           let t2 = e3.map(this.ensureSegmentChunk);
58911           await Promise.all(t2);
58912         }
58913       };
58914       re3 = class {
58915         static findPosition(e3, t2) {
58916           let i3 = e3.getUint16(t2 + 2) + 2, n3 = "function" == typeof this.headerLength ? this.headerLength(e3, t2, i3) : this.headerLength, s2 = t2 + n3, r2 = i3 - n3;
58917           return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
58918         }
58919         static parse(e3, t2 = {}) {
58920           return new this(e3, new q2({ [this.type]: t2 }), e3).parse();
58921         }
58922         normalizeInput(e3) {
58923           return e3 instanceof I2 ? e3 : new I2(e3);
58924         }
58925         constructor(e3, t2 = {}, i3) {
58926           c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
58927             if (!this.options.silentErrors) throw e4;
58928             this.errors.push(e4.message);
58929           }), this.chunk = this.normalizeInput(e3), this.file = i3, this.type = this.constructor.type, this.globalOptions = this.options = t2, this.localOptions = t2[this.type], this.canTranslate = this.localOptions && this.localOptions.translate;
58930         }
58931         translate() {
58932           this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
58933         }
58934         get output() {
58935           return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
58936         }
58937         translateBlock(e3, t2) {
58938           let i3 = N2.get(t2), n3 = B2.get(t2), s2 = E.get(t2), r2 = this.options[t2], a4 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h3 = {};
58939           for (let [t3, r3] of e3) a4 && i3.has(t3) ? r3 = i3.get(t3)(r3) : o2 && n3.has(t3) && (r3 = this.translateValue(r3, n3.get(t3))), l2 && s2.has(t3) && (t3 = s2.get(t3) || t3), h3[t3] = r3;
58940           return h3;
58941         }
58942         translateValue(e3, t2) {
58943           return t2[e3] || t2.DEFAULT || e3;
58944         }
58945         assignToOutput(e3, t2) {
58946           this.assignObjectToOutput(e3, this.constructor.type, t2);
58947         }
58948         assignObjectToOutput(e3, t2, i3) {
58949           if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
58950           e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
58951         }
58952       };
58953       c(re3, "headerLength", 4), c(re3, "type", void 0), c(re3, "multiSegment", false), c(re3, "canHandle", () => false);
58954       he2 = class extends se2 {
58955         constructor(...e3) {
58956           super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
58957         }
58958         static canHandle(e3, t2) {
58959           return 65496 === t2;
58960         }
58961         async parse() {
58962           await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
58963         }
58964         setupSegmentFinderArgs(e3) {
58965           true === e3 ? (this.findAll = true, this.wanted = new Set(T2.keyList())) : (e3 = void 0 === e3 ? T2.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T2.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
58966         }
58967         async findAppSegments(e3 = 0, t2) {
58968           this.setupSegmentFinderArgs(t2);
58969           let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
58970           if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
58971             let t3 = T2.get(e4), i4 = this.options[e4];
58972             return t3.multiSegment && i4.multiSegment;
58973           }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
58974             let t3 = false;
58975             for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
58976               let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
58977               if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
58978             }
58979           }
58980         }
58981         findAppSegmentsInRange(e3, t2) {
58982           t2 -= 2;
58983           let i3, n3, s2, r2, a4, o2, { file: l2, findAll: h3, wanted: u2, remaining: c2, options: f2 } = this;
58984           for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
58985             if (i3 = l2.getUint8(e3 + 1), oe2(i3)) {
58986               if (n3 = l2.getUint16(e3 + 2), s2 = le2(l2, e3, n3), s2 && u2.has(s2) && (r2 = T2.get(s2), a4 = r2.findPosition(l2, e3), o2 = f2[s2], a4.type = s2, this.appSegments.push(a4), !h3 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a4.chunkNumber < a4.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size))) break;
58987               f2.recordUnknownSegments && (a4 = re3.findPosition(l2, e3), a4.marker = i3, this.unknownSegments.push(a4)), e3 += n3 + 1;
58988             } else if (ae2(i3)) {
58989               if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
58990               f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
58991             }
58992           }
58993           return e3;
58994         }
58995         mergeMultiSegments() {
58996           if (!this.appSegments.some((e4) => e4.multiSegment)) return;
58997           let e3 = function(e4, t2) {
58998             let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
58999             for (let a4 = 0; a4 < e4.length; a4++) i3 = e4[a4], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
59000             return Array.from(r2);
59001           }(this.appSegments, "type");
59002           this.mergedAppSegments = e3.map(([e4, t2]) => {
59003             let i3 = T2.get(e4, this.options);
59004             if (i3.handleMultiSegments) {
59005               return { type: e4, chunk: i3.handleMultiSegments(t2) };
59006             }
59007             return t2[0];
59008           });
59009         }
59010         getSegment(e3) {
59011           return this.appSegments.find((t2) => t2.type === e3);
59012         }
59013         async getOrFindSegment(e3) {
59014           let t2 = this.getSegment(e3);
59015           return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
59016         }
59017       };
59018       c(he2, "type", "jpeg"), w2.set("jpeg", he2);
59019       ue2 = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
59020       ce2 = class extends re3 {
59021         parseHeader() {
59022           var e3 = this.chunk.getUint16();
59023           18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
59024         }
59025         parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
59026           let { pick: n3, skip: s2 } = this.options[t2];
59027           n3 = new Set(n3);
59028           let r2 = n3.size > 0, a4 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
59029           e3 += 2;
59030           for (let l2 = 0; l2 < o2; l2++) {
59031             let o3 = this.chunk.getUint16(e3);
59032             if (r2) {
59033               if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
59034             } else !a4 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
59035             e3 += 12;
59036           }
59037           return i3;
59038         }
59039         parseTag(e3, t2, i3) {
59040           let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a4 = ue2[s2];
59041           if (a4 * r2 <= 4 ? e3 += 8 : e3 = n3.getUint32(e3 + 8), (s2 < 1 || s2 > 13) && g2(`Invalid TIFF value type. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3}`), e3 > n3.byteLength && g2(`Invalid TIFF value offset. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3} is outside of chunk size ${n3.byteLength}`), 1 === s2) return n3.getUint8Array(e3, r2);
59042           if (2 === s2) return m2(n3.getString(e3, r2));
59043           if (7 === s2) return n3.getUint8Array(e3, r2);
59044           if (1 === r2) return this.parseTagValue(s2, e3);
59045           {
59046             let t3 = new (function(e4) {
59047               switch (e4) {
59048                 case 1:
59049                   return Uint8Array;
59050                 case 3:
59051                   return Uint16Array;
59052                 case 4:
59053                   return Uint32Array;
59054                 case 5:
59055                   return Array;
59056                 case 6:
59057                   return Int8Array;
59058                 case 8:
59059                   return Int16Array;
59060                 case 9:
59061                   return Int32Array;
59062                 case 10:
59063                   return Array;
59064                 case 11:
59065                   return Float32Array;
59066                 case 12:
59067                   return Float64Array;
59068                 default:
59069                   return Array;
59070               }
59071             }(s2))(r2), i4 = a4;
59072             for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
59073             return t3;
59074           }
59075         }
59076         parseTagValue(e3, t2) {
59077           let { chunk: i3 } = this;
59078           switch (e3) {
59079             case 1:
59080               return i3.getUint8(t2);
59081             case 3:
59082               return i3.getUint16(t2);
59083             case 4:
59084               return i3.getUint32(t2);
59085             case 5:
59086               return i3.getUint32(t2) / i3.getUint32(t2 + 4);
59087             case 6:
59088               return i3.getInt8(t2);
59089             case 8:
59090               return i3.getInt16(t2);
59091             case 9:
59092               return i3.getInt32(t2);
59093             case 10:
59094               return i3.getInt32(t2) / i3.getInt32(t2 + 4);
59095             case 11:
59096               return i3.getFloat(t2);
59097             case 12:
59098               return i3.getDouble(t2);
59099             case 13:
59100               return i3.getUint32(t2);
59101             default:
59102               g2(`Invalid tiff type ${e3}`);
59103           }
59104         }
59105       };
59106       fe2 = class extends ce2 {
59107         static canHandle(e3, t2) {
59108           return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
59109         }
59110         async parse() {
59111           this.parseHeader();
59112           let { options: e3 } = this;
59113           return e3.ifd0.enabled && await this.parseIfd0Block(), e3.exif.enabled && await this.safeParse("parseExifBlock"), e3.gps.enabled && await this.safeParse("parseGpsBlock"), e3.interop.enabled && await this.safeParse("parseInteropBlock"), e3.ifd1.enabled && await this.safeParse("parseThumbnailBlock"), this.createOutput();
59114         }
59115         safeParse(e3) {
59116           let t2 = this[e3]();
59117           return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
59118         }
59119         findIfd0Offset() {
59120           void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
59121         }
59122         findIfd1Offset() {
59123           if (void 0 === this.ifd1Offset) {
59124             this.findIfd0Offset();
59125             let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
59126             this.ifd1Offset = this.chunk.getUint32(t2);
59127           }
59128         }
59129         parseBlock(e3, t2) {
59130           let i3 = /* @__PURE__ */ new Map();
59131           return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
59132         }
59133         async parseIfd0Block() {
59134           if (this.ifd0) return;
59135           let { file: e3 } = this;
59136           this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
59137 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S2(this.options));
59138           let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
59139           return 0 !== t2.size ? (this.exifOffset = t2.get(34665), this.interopOffset = t2.get(40965), this.gpsOffset = t2.get(34853), this.xmp = t2.get(700), this.iptc = t2.get(33723), this.icc = t2.get(34675), this.options.sanitize && (t2.delete(34665), t2.delete(40965), t2.delete(34853), t2.delete(700), t2.delete(33723), t2.delete(34675)), t2) : void 0;
59140         }
59141         async parseExifBlock() {
59142           if (this.exif) return;
59143           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
59144           this.file.tiff && await this.file.ensureChunk(this.exifOffset, S2(this.options));
59145           let e3 = this.parseBlock(this.exifOffset, "exif");
59146           return this.interopOffset || (this.interopOffset = e3.get(40965)), this.makerNote = e3.get(37500), this.userComment = e3.get(37510), this.options.sanitize && (e3.delete(40965), e3.delete(37500), e3.delete(37510)), this.unpack(e3, 41728), this.unpack(e3, 41729), e3;
59147         }
59148         unpack(e3, t2) {
59149           let i3 = e3.get(t2);
59150           i3 && 1 === i3.length && e3.set(t2, i3[0]);
59151         }
59152         async parseGpsBlock() {
59153           if (this.gps) return;
59154           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
59155           let e3 = this.parseBlock(this.gpsOffset, "gps");
59156           return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de2(...e3.get(2), e3.get(1))), e3.set("longitude", de2(...e3.get(4), e3.get(3)))), e3;
59157         }
59158         async parseInteropBlock() {
59159           if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset)) return this.parseBlock(this.interopOffset, "interop");
59160         }
59161         async parseThumbnailBlock(e3 = false) {
59162           if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3)) return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
59163         }
59164         async extractThumbnail() {
59165           if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
59166           let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
59167           return this.chunk.getUint8Array(e3, t2);
59168         }
59169         get image() {
59170           return this.ifd0;
59171         }
59172         get thumbnail() {
59173           return this.ifd1;
59174         }
59175         createOutput() {
59176           let e3, t2, i3, n3 = {};
59177           for (t2 of H2) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
59178             if ("ifd1" === t2) continue;
59179             Object.assign(n3, i3);
59180           } else n3[t2] = i3;
59181           return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
59182         }
59183         assignToOutput(e3, t2) {
59184           if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
59185           else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
59186         }
59187       };
59188       c(fe2, "type", "tiff"), c(fe2, "headerLength", 10), T2.set("tiff", fe2);
59189       pe2 = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2 });
59190       ge2 = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
59191       me = Object.assign({}, ge2, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
59192       Ce2 = Object.assign({}, ge2, { tiff: false, ifd1: true, mergeOutput: false });
59193       Ie2 = Object.assign({}, ge2, { firstChunkSize: 4e4, ifd0: [274] });
59194       ke2 = Object.freeze({ 1: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 0, rad: 0 }, 2: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 0, rad: 0 }, 3: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 4: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 5: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 90, rad: 90 * Math.PI / 180 }, 6: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 90, rad: 90 * Math.PI / 180 }, 7: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 270, rad: 270 * Math.PI / 180 }, 8: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 270, rad: 270 * Math.PI / 180 } });
59195       we2 = true;
59196       Te2 = true;
59197       if ("object" == typeof navigator) {
59198         let e3 = navigator.userAgent;
59199         if (e3.includes("iPad") || e3.includes("iPhone")) {
59200           let t2 = e3.match(/OS (\d+)_(\d+)/);
59201           if (t2) {
59202             let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
59203             we2 = n3 < 13.4, Te2 = false;
59204           }
59205         } else if (e3.includes("OS X 10")) {
59206           let [, t2] = e3.match(/OS X 10[_.](\d+)/);
59207           we2 = Te2 = Number(t2) < 15;
59208         }
59209         if (e3.includes("Chrome/")) {
59210           let [, t2] = e3.match(/Chrome\/(\d+)/);
59211           we2 = Te2 = Number(t2) < 81;
59212         } else if (e3.includes("Firefox/")) {
59213           let [, t2] = e3.match(/Firefox\/(\d+)/);
59214           we2 = Te2 = Number(t2) < 77;
59215         }
59216       }
59217       De2 = class extends I2 {
59218         constructor(...e3) {
59219           super(...e3), c(this, "ranges", new Oe2()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
59220         }
59221         _tryExtend(e3, t2, i3) {
59222           if (0 === e3 && 0 === this.byteLength && i3) {
59223             let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
59224             this._swapDataView(e4);
59225           } else {
59226             let i4 = e3 + t2;
59227             if (i4 > this.byteLength) {
59228               let { dataView: e4 } = this._extend(i4);
59229               this._swapDataView(e4);
59230             }
59231           }
59232         }
59233         _extend(e3) {
59234           let t2;
59235           t2 = a3 ? s.allocUnsafe(e3) : new Uint8Array(e3);
59236           let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
59237           return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
59238         }
59239         subarray(e3, t2, i3 = false) {
59240           return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
59241         }
59242         set(e3, t2, i3 = false) {
59243           i3 && this._tryExtend(t2, e3.byteLength, e3);
59244           let n3 = super.set(e3, t2);
59245           return this.ranges.add(t2, n3.byteLength), n3;
59246         }
59247         async ensureChunk(e3, t2) {
59248           this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
59249         }
59250         available(e3, t2) {
59251           return this.ranges.available(e3, t2);
59252         }
59253       };
59254       Oe2 = class {
59255         constructor() {
59256           c(this, "list", []);
59257         }
59258         get length() {
59259           return this.list.length;
59260         }
59261         add(e3, t2, i3 = 0) {
59262           let n3 = e3 + t2, s2 = this.list.filter((t3) => xe2(e3, t3.offset, n3) || xe2(e3, t3.end, n3));
59263           if (s2.length > 0) {
59264             e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
59265             let i4 = s2.shift();
59266             i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
59267           } else this.list.push({ offset: e3, length: t2, end: n3 });
59268         }
59269         available(e3, t2) {
59270           let i3 = e3 + t2;
59271           return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
59272         }
59273       };
59274       ve2 = class extends De2 {
59275         constructor(e3, t2) {
59276           super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
59277         }
59278         async readWhole() {
59279           this.chunked = false, await this.readChunk(this.nextChunkOffset);
59280         }
59281         async readChunked() {
59282           this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
59283         }
59284         async readNextChunk(e3 = this.nextChunkOffset) {
59285           if (this.fullyRead) return this.chunksRead++, false;
59286           let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
59287           return !!i3 && i3.byteLength === t2;
59288         }
59289         async readChunk(e3, t2) {
59290           if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
59291         }
59292         safeWrapAddress(e3, t2) {
59293           return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
59294         }
59295         get nextChunkOffset() {
59296           if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
59297         }
59298         get canReadNextChunk() {
59299           return this.chunksRead < this.options.chunkLimit;
59300         }
59301         get fullyRead() {
59302           return void 0 !== this.size && this.nextChunkOffset === this.size;
59303         }
59304         read() {
59305           return this.options.chunked ? this.readChunked() : this.readWhole();
59306         }
59307         close() {
59308         }
59309       };
59310       A2.set("blob", class extends ve2 {
59311         async readWhole() {
59312           this.chunked = false;
59313           let e3 = await R2(this.input);
59314           this._swapArrayBuffer(e3);
59315         }
59316         readChunked() {
59317           return this.chunked = true, this.size = this.input.size, super.readChunked();
59318         }
59319         async _readChunk(e3, t2) {
59320           let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R2(n3);
59321           return this.set(s2, e3, true);
59322         }
59323       });
59324       Me2 = Object.freeze({ __proto__: null, default: pe2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2, gpsOnlyOptions: me, gps: Se2, thumbnailOnlyOptions: Ce2, thumbnail: ye2, thumbnailUrl: be2, orientationOnlyOptions: Ie2, orientation: Pe2, rotations: ke2, get rotateCanvas() {
59325         return we2;
59326       }, get rotateCss() {
59327         return Te2;
59328       }, rotation: Ae2 });
59329       A2.set("url", class extends ve2 {
59330         async readWhole() {
59331           this.chunked = false;
59332           let e3 = await M2(this.input);
59333           e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
59334         }
59335         async _readChunk(e3, t2) {
59336           let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
59337           (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
59338           let s2 = await h2(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a4 = r2.byteLength;
59339           if (416 !== s2.status) return a4 !== t2 && (this.size = e3 + a4), this.set(r2, e3, true);
59340         }
59341       });
59342       I2.prototype.getUint64 = function(e3) {
59343         let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
59344         return t2 < 1048575 ? t2 << 32 | i3 : void 0 !== typeof r ? (console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."), r(t2) << r(32) | r(i3)) : void g2("Trying to read 64b value but JS can only handle 53b numbers.");
59345       };
59346       Re2 = class extends se2 {
59347         parseBoxes(e3 = 0) {
59348           let t2 = [];
59349           for (; e3 < this.file.byteLength - 4; ) {
59350             let i3 = this.parseBoxHead(e3);
59351             if (t2.push(i3), 0 === i3.length) break;
59352             e3 += i3.length;
59353           }
59354           return t2;
59355         }
59356         parseSubBoxes(e3) {
59357           e3.boxes = this.parseBoxes(e3.start);
59358         }
59359         findBox(e3, t2) {
59360           return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
59361         }
59362         parseBoxHead(e3) {
59363           let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
59364           return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
59365         }
59366         parseBoxFullHead(e3) {
59367           if (void 0 !== e3.version) return;
59368           let t2 = this.file.getUint32(e3.start);
59369           e3.version = t2 >> 24, e3.start += 4;
59370         }
59371       };
59372       Le2 = class extends Re2 {
59373         static canHandle(e3, t2) {
59374           if (0 !== t2) return false;
59375           let i3 = e3.getUint16(2);
59376           if (i3 > 50) return false;
59377           let n3 = 16, s2 = [];
59378           for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
59379           return s2.includes(this.type);
59380         }
59381         async parse() {
59382           let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
59383           for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
59384           await this.file.ensureChunk(t2.offset, t2.length), this.parseBoxFullHead(t2), this.parseSubBoxes(t2), this.options.icc.enabled && await this.findIcc(t2), this.options.tiff.enabled && await this.findExif(t2);
59385         }
59386         async registerSegment(e3, t2, i3) {
59387           await this.file.ensureChunk(t2, i3);
59388           let n3 = this.file.subarray(t2, i3);
59389           this.createParser(e3, n3);
59390         }
59391         async findIcc(e3) {
59392           let t2 = this.findBox(e3, "iprp");
59393           if (void 0 === t2) return;
59394           let i3 = this.findBox(t2, "ipco");
59395           if (void 0 === i3) return;
59396           let n3 = this.findBox(i3, "colr");
59397           void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
59398         }
59399         async findExif(e3) {
59400           let t2 = this.findBox(e3, "iinf");
59401           if (void 0 === t2) return;
59402           let i3 = this.findBox(e3, "iloc");
59403           if (void 0 === i3) return;
59404           let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
59405           if (void 0 === s2) return;
59406           let [r2, a4] = s2;
59407           await this.file.ensureChunk(r2, a4);
59408           let o2 = 4 + this.file.getUint32(r2);
59409           r2 += o2, a4 -= o2, await this.registerSegment("tiff", r2, a4);
59410         }
59411         findExifLocIdInIinf(e3) {
59412           this.parseBoxFullHead(e3);
59413           let t2, i3, n3, s2, r2 = e3.start, a4 = this.file.getUint16(r2);
59414           for (r2 += 2; a4--; ) {
59415             if (t2 = this.parseBoxHead(r2), this.parseBoxFullHead(t2), i3 = t2.start, t2.version >= 2 && (n3 = 3 === t2.version ? 4 : 2, s2 = this.file.getString(i3 + n3 + 2, 4), "Exif" === s2)) return this.file.getUintBytes(i3, n3);
59416             r2 += t2.length;
59417           }
59418         }
59419         get8bits(e3) {
59420           let t2 = this.file.getUint8(e3);
59421           return [t2 >> 4, 15 & t2];
59422         }
59423         findExtentInIloc(e3, t2) {
59424           this.parseBoxFullHead(e3);
59425           let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a4] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h3 = a4 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
59426           for (i3 += u2; c2--; ) {
59427             let e4 = this.file.getUintBytes(i3, o2);
59428             i3 += o2 + l2 + 2 + r2;
59429             let u3 = this.file.getUint16(i3);
59430             if (i3 += 2, e4 === t2) return u3 > 1 && console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"), [this.file.getUintBytes(i3 + a4, n3), this.file.getUintBytes(i3 + a4 + n3, s2)];
59431             i3 += u3 * h3;
59432           }
59433         }
59434       };
59435       Ue2 = class extends Le2 {
59436       };
59437       c(Ue2, "type", "heic");
59438       Fe2 = class extends Le2 {
59439       };
59440       c(Fe2, "type", "avif"), w2.set("heic", Ue2), w2.set("avif", Fe2), U2(E, ["ifd0", "ifd1"], [[256, "ImageWidth"], [257, "ImageHeight"], [258, "BitsPerSample"], [259, "Compression"], [262, "PhotometricInterpretation"], [270, "ImageDescription"], [271, "Make"], [272, "Model"], [273, "StripOffsets"], [274, "Orientation"], [277, "SamplesPerPixel"], [278, "RowsPerStrip"], [279, "StripByteCounts"], [282, "XResolution"], [283, "YResolution"], [284, "PlanarConfiguration"], [296, "ResolutionUnit"], [301, "TransferFunction"], [305, "Software"], [306, "ModifyDate"], [315, "Artist"], [316, "HostComputer"], [317, "Predictor"], [318, "WhitePoint"], [319, "PrimaryChromaticities"], [513, "ThumbnailOffset"], [514, "ThumbnailLength"], [529, "YCbCrCoefficients"], [530, "YCbCrSubSampling"], [531, "YCbCrPositioning"], [532, "ReferenceBlackWhite"], [700, "ApplicationNotes"], [33432, "Copyright"], [33723, "IPTC"], [34665, "ExifIFD"], [34675, "ICC"], [34853, "GpsIFD"], [330, "SubIFD"], [40965, "InteropIFD"], [40091, "XPTitle"], [40092, "XPComment"], [40093, "XPAuthor"], [40094, "XPKeywords"], [40095, "XPSubject"]]), U2(E, "exif", [[33434, "ExposureTime"], [33437, "FNumber"], [34850, "ExposureProgram"], [34852, "SpectralSensitivity"], [34855, "ISO"], [34858, "TimeZoneOffset"], [34859, "SelfTimerMode"], [34864, "SensitivityType"], [34865, "StandardOutputSensitivity"], [34866, "RecommendedExposureIndex"], [34867, "ISOSpeed"], [34868, "ISOSpeedLatitudeyyy"], [34869, "ISOSpeedLatitudezzz"], [36864, "ExifVersion"], [36867, "DateTimeOriginal"], [36868, "CreateDate"], [36873, "GooglePlusUploadCode"], [36880, "OffsetTime"], [36881, "OffsetTimeOriginal"], [36882, "OffsetTimeDigitized"], [37121, "ComponentsConfiguration"], [37122, "CompressedBitsPerPixel"], [37377, "ShutterSpeedValue"], [37378, "ApertureValue"], [37379, "BrightnessValue"], [37380, "ExposureCompensation"], [37381, "MaxApertureValue"], [37382, "SubjectDistance"], [37383, "MeteringMode"], [37384, "LightSource"], [37385, "Flash"], [37386, "FocalLength"], [37393, "ImageNumber"], [37394, "SecurityClassification"], [37395, "ImageHistory"], [37396, "SubjectArea"], [37500, "MakerNote"], [37510, "UserComment"], [37520, "SubSecTime"], [37521, "SubSecTimeOriginal"], [37522, "SubSecTimeDigitized"], [37888, "AmbientTemperature"], [37889, "Humidity"], [37890, "Pressure"], [37891, "WaterDepth"], [37892, "Acceleration"], [37893, "CameraElevationAngle"], [40960, "FlashpixVersion"], [40961, "ColorSpace"], [40962, "ExifImageWidth"], [40963, "ExifImageHeight"], [40964, "RelatedSoundFile"], [41483, "FlashEnergy"], [41486, "FocalPlaneXResolution"], [41487, "FocalPlaneYResolution"], [41488, "FocalPlaneResolutionUnit"], [41492, "SubjectLocation"], [41493, "ExposureIndex"], [41495, "SensingMethod"], [41728, "FileSource"], [41729, "SceneType"], [41730, "CFAPattern"], [41985, "CustomRendered"], [41986, "ExposureMode"], [41987, "WhiteBalance"], [41988, "DigitalZoomRatio"], [41989, "FocalLengthIn35mmFormat"], [41990, "SceneCaptureType"], [41991, "GainControl"], [41992, "Contrast"], [41993, "Saturation"], [41994, "Sharpness"], [41996, "SubjectDistanceRange"], [42016, "ImageUniqueID"], [42032, "OwnerName"], [42033, "SerialNumber"], [42034, "LensInfo"], [42035, "LensMake"], [42036, "LensModel"], [42037, "LensSerialNumber"], [42080, "CompositeImage"], [42081, "CompositeImageCount"], [42082, "CompositeImageExposureTimes"], [42240, "Gamma"], [59932, "Padding"], [59933, "OffsetSchema"], [65e3, "OwnerName"], [65001, "SerialNumber"], [65002, "Lens"], [65100, "RawFile"], [65101, "Converter"], [65102, "WhiteBalance"], [65105, "Exposure"], [65106, "Shadows"], [65107, "Brightness"], [65108, "Contrast"], [65109, "Saturation"], [65110, "Sharpness"], [65111, "Smoothness"], [65112, "MoireFilter"], [40965, "InteropIFD"]]), U2(E, "gps", [[0, "GPSVersionID"], [1, "GPSLatitudeRef"], [2, "GPSLatitude"], [3, "GPSLongitudeRef"], [4, "GPSLongitude"], [5, "GPSAltitudeRef"], [6, "GPSAltitude"], [7, "GPSTimeStamp"], [8, "GPSSatellites"], [9, "GPSStatus"], [10, "GPSMeasureMode"], [11, "GPSDOP"], [12, "GPSSpeedRef"], [13, "GPSSpeed"], [14, "GPSTrackRef"], [15, "GPSTrack"], [16, "GPSImgDirectionRef"], [17, "GPSImgDirection"], [18, "GPSMapDatum"], [19, "GPSDestLatitudeRef"], [20, "GPSDestLatitude"], [21, "GPSDestLongitudeRef"], [22, "GPSDestLongitude"], [23, "GPSDestBearingRef"], [24, "GPSDestBearing"], [25, "GPSDestDistanceRef"], [26, "GPSDestDistance"], [27, "GPSProcessingMethod"], [28, "GPSAreaInformation"], [29, "GPSDateStamp"], [30, "GPSDifferential"], [31, "GPSHPositioningError"]]), U2(B2, ["ifd0", "ifd1"], [[274, { 1: "Horizontal (normal)", 2: "Mirror horizontal", 3: "Rotate 180", 4: "Mirror vertical", 5: "Mirror horizontal and rotate 270 CW", 6: "Rotate 90 CW", 7: "Mirror horizontal and rotate 90 CW", 8: "Rotate 270 CW" }], [296, { 1: "None", 2: "inches", 3: "cm" }]]);
59441       Ee2 = U2(B2, "exif", [[34850, { 0: "Not defined", 1: "Manual", 2: "Normal program", 3: "Aperture priority", 4: "Shutter priority", 5: "Creative program", 6: "Action program", 7: "Portrait mode", 8: "Landscape mode" }], [37121, { 0: "-", 1: "Y", 2: "Cb", 3: "Cr", 4: "R", 5: "G", 6: "B" }], [37383, { 0: "Unknown", 1: "Average", 2: "CenterWeightedAverage", 3: "Spot", 4: "MultiSpot", 5: "Pattern", 6: "Partial", 255: "Other" }], [37384, { 0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten", 255: "Other" }], [37385, { 0: "Flash did not fire", 1: "Flash fired", 5: "Strobe return light not detected", 7: "Strobe return light detected", 9: "Flash fired, compulsory flash mode", 13: "Flash fired, compulsory flash mode, return light not detected", 15: "Flash fired, compulsory flash mode, return light detected", 16: "Flash did not fire, compulsory flash mode", 24: "Flash did not fire, auto mode", 25: "Flash fired, auto mode", 29: "Flash fired, auto mode, return light not detected", 31: "Flash fired, auto mode, return light detected", 32: "No flash function", 65: "Flash fired, red-eye reduction mode", 69: "Flash fired, red-eye reduction mode, return light not detected", 71: "Flash fired, red-eye reduction mode, return light detected", 73: "Flash fired, compulsory flash mode, red-eye reduction mode", 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", 89: "Flash fired, auto mode, red-eye reduction mode", 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode", 95: "Flash fired, auto mode, return light detected, red-eye reduction mode" }], [41495, { 1: "Not defined", 2: "One-chip color area sensor", 3: "Two-chip color area sensor", 4: "Three-chip color area sensor", 5: "Color sequential area sensor", 7: "Trilinear sensor", 8: "Color sequential linear sensor" }], [41728, { 1: "Film Scanner", 2: "Reflection Print Scanner", 3: "Digital Camera" }], [41729, { 1: "Directly photographed" }], [41985, { 0: "Normal", 1: "Custom", 2: "HDR (no original saved)", 3: "HDR (original saved)", 4: "Original (for HDR)", 6: "Panorama", 7: "Portrait HDR", 8: "Portrait" }], [41986, { 0: "Auto", 1: "Manual", 2: "Auto bracket" }], [41987, { 0: "Auto", 1: "Manual" }], [41990, { 0: "Standard", 1: "Landscape", 2: "Portrait", 3: "Night", 4: "Other" }], [41991, { 0: "None", 1: "Low gain up", 2: "High gain up", 3: "Low gain down", 4: "High gain down" }], [41996, { 0: "Unknown", 1: "Macro", 2: "Close", 3: "Distant" }], [42080, { 0: "Unknown", 1: "Not a Composite Image", 2: "General Composite Image", 3: "Composite Image Captured While Shooting" }]]);
59442       Be2 = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
59443       Ee2.set(37392, Be2), Ee2.set(41488, Be2);
59444       Ne2 = { 0: "Normal", 1: "Low", 2: "High" };
59445       Ee2.set(41992, Ne2), Ee2.set(41993, Ne2), Ee2.set(41994, Ne2), U2(N2, ["ifd0", "ifd1"], [[50827, function(e3) {
59446         return "string" != typeof e3 ? b2(e3) : e3;
59447       }], [306, ze2], [40091, He2], [40092, He2], [40093, He2], [40094, He2], [40095, He2]]), U2(N2, "exif", [[40960, Ve], [36864, Ve], [36867, ze2], [36868, ze2], [40962, Ge2], [40963, Ge2]]), U2(N2, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
59448       We2 = class extends re3 {
59449         static canHandle(e3, t2) {
59450           return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
59451         }
59452         static headerLength(e3, t2) {
59453           return "http://ns.adobe.com/xmp/extension/" === e3.getString(t2 + 4, "http://ns.adobe.com/xmp/extension/".length) ? 79 : 4 + "http://ns.adobe.com/xap/1.0/".length + 1;
59454         }
59455         static findPosition(e3, t2) {
59456           let i3 = super.findPosition(e3, t2);
59457           return i3.multiSegment = i3.extended = 79 === i3.headerLength, i3.multiSegment ? (i3.chunkCount = e3.getUint8(t2 + 72), i3.chunkNumber = e3.getUint8(t2 + 76), 0 !== e3.getUint8(t2 + 77) && i3.chunkNumber++) : (i3.chunkCount = 1 / 0, i3.chunkNumber = -1), i3;
59458         }
59459         static handleMultiSegments(e3) {
59460           return e3.map((e4) => e4.chunk.getString()).join("");
59461         }
59462         normalizeInput(e3) {
59463           return "string" == typeof e3 ? e3 : I2.from(e3).getString();
59464         }
59465         parse(e3 = this.chunk) {
59466           if (!this.localOptions.parse) return e3;
59467           e3 = function(e4) {
59468             let t3 = {}, i4 = {};
59469             for (let e6 of Ze2) t3[e6] = [], i4[e6] = 0;
59470             return e4.replace(et, (e6, n4, s2) => {
59471               if ("<" === n4) {
59472                 let n5 = ++i4[s2];
59473                 return t3[s2].push(n5), `${e6}#${n5}`;
59474               }
59475               return `${e6}#${t3[s2].pop()}`;
59476             });
59477           }(e3);
59478           let t2 = Xe2.findAll(e3, "rdf", "Description");
59479           0 === t2.length && t2.push(new Xe2("rdf", "Description", void 0, e3));
59480           let i3, n3 = {};
59481           for (let e4 of t2) for (let t3 of e4.properties) i3 = Je2(t3.ns, n3), _e2(t3, i3);
59482           return function(e4) {
59483             let t3;
59484             for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
59485             return f(e4);
59486           }(n3);
59487         }
59488         assignToOutput(e3, t2) {
59489           if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
59490             case "tiff":
59491               this.assignObjectToOutput(e3, "ifd0", n3);
59492               break;
59493             case "exif":
59494               this.assignObjectToOutput(e3, "exif", n3);
59495               break;
59496             case "xmlns":
59497               break;
59498             default:
59499               this.assignObjectToOutput(e3, i3, n3);
59500           }
59501           else e3.xmp = t2;
59502         }
59503       };
59504       c(We2, "type", "xmp"), c(We2, "multiSegment", true), T2.set("xmp", We2);
59505       Ke2 = class _Ke {
59506         static findAll(e3) {
59507           return qe2(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
59508         }
59509         static unpackMatch(e3) {
59510           let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
59511           return n3 = Qe2(n3), new _Ke(t2, i3, n3);
59512         }
59513         constructor(e3, t2, i3) {
59514           this.ns = e3, this.name = t2, this.value = i3;
59515         }
59516         serialize() {
59517           return this.value;
59518         }
59519       };
59520       Xe2 = class _Xe {
59521         static findAll(e3, t2, i3) {
59522           if (void 0 !== t2 || void 0 !== i3) {
59523             t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
59524             var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
59525           } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
59526           return qe2(e3, n3).map(_Xe.unpackMatch);
59527         }
59528         static unpackMatch(e3) {
59529           let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
59530           return new _Xe(t2, i3, n3, s2);
59531         }
59532         constructor(e3, t2, i3, n3) {
59533           this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke2.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe2(n3) : void 0, this.properties = [...this.attrs, ...this.children];
59534         }
59535         get isPrimitive() {
59536           return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
59537         }
59538         get isListContainer() {
59539           return 1 === this.children.length && this.children[0].isList;
59540         }
59541         get isList() {
59542           let { ns: e3, name: t2 } = this;
59543           return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
59544         }
59545         get isListItem() {
59546           return "rdf" === this.ns && "li" === this.name;
59547         }
59548         serialize() {
59549           if (0 === this.properties.length && void 0 === this.value) return;
59550           if (this.isPrimitive) return this.value;
59551           if (this.isListContainer) return this.children[0].serialize();
59552           if (this.isList) return $e2(this.children.map(Ye));
59553           if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
59554           let e3 = {};
59555           for (let t2 of this.properties) _e2(t2, e3);
59556           return void 0 !== this.value && (e3.value = this.value), f(e3);
59557         }
59558       };
59559       Ye = (e3) => e3.serialize();
59560       $e2 = (e3) => 1 === e3.length ? e3[0] : e3;
59561       Je2 = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
59562       Ze2 = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
59563       et = new RegExp(`(<|\\/)(${Ze2.join("|")})`, "g");
59564       tt = Object.freeze({ __proto__: null, default: Me2, Exifr: te, fileParsers: w2, segmentParsers: T2, fileReaders: A2, tagKeys: E, tagValues: B2, tagRevivers: N2, createDictionary: U2, extendDictionary: F2, fetchUrlAsArrayBuffer: M2, readBlobAsArrayBuffer: R2, chunkedProps: G, otherSegments: V2, segments: z2, tiffBlocks: H2, segmentsAndBlocks: j2, tiffExtractables: W2, inheritables: K2, allFormatters: X3, Options: q2, parse: ie2, gpsOnlyOptions: me, gps: Se2, thumbnailOnlyOptions: Ce2, thumbnail: ye2, thumbnailUrl: be2, orientationOnlyOptions: Ie2, orientation: Pe2, rotations: ke2, get rotateCanvas() {
59565         return we2;
59566       }, get rotateCss() {
59567         return Te2;
59568       }, rotation: Ae2 });
59569       at = l("fs", (e3) => e3.promises);
59570       A2.set("fs", class extends ve2 {
59571         async readWhole() {
59572           this.chunked = false, this.fs = await at;
59573           let e3 = await this.fs.readFile(this.input);
59574           this._swapBuffer(e3);
59575         }
59576         async readChunked() {
59577           this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
59578         }
59579         async open() {
59580           void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
59581         }
59582         async _readChunk(e3, t2) {
59583           void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
59584           var i3 = this.subarray(e3, t2, true);
59585           return await this.fh.read(i3.dataView, 0, t2, e3), i3;
59586         }
59587         async close() {
59588           if (this.fh) {
59589             let e3 = this.fh;
59590             this.fh = void 0, await e3.close();
59591           }
59592         }
59593       });
59594       A2.set("base64", class extends ve2 {
59595         constructor(...e3) {
59596           super(...e3), this.input = this.input.replace(/^data:([^;]+);base64,/gim, ""), this.size = this.input.length / 4 * 3, this.input.endsWith("==") ? this.size -= 2 : this.input.endsWith("=") && (this.size -= 1);
59597         }
59598         async _readChunk(e3, t2) {
59599           let i3, n3, r2 = this.input;
59600           void 0 === e3 ? (e3 = 0, i3 = 0, n3 = 0) : (i3 = 4 * Math.floor(e3 / 3), n3 = e3 - i3 / 4 * 3), void 0 === t2 && (t2 = this.size);
59601           let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
59602           r2 = r2.slice(i3, l2);
59603           let h3 = Math.min(t2, this.size - e3);
59604           if (a3) {
59605             let t3 = s.from(r2, "base64").slice(n3, n3 + h3);
59606             return this.set(t3, e3, true);
59607           }
59608           {
59609             let t3 = this.subarray(e3, h3, true), i4 = atob(r2), s2 = t3.toUint8();
59610             for (let e4 = 0; e4 < h3; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
59611             return t3;
59612           }
59613         }
59614       });
59615       ot = class extends se2 {
59616         static canHandle(e3, t2) {
59617           return 18761 === t2 || 19789 === t2;
59618         }
59619         extendOptions(e3) {
59620           let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
59621           i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
59622         }
59623         async parse() {
59624           let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
59625           if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
59626             let e4 = Math.max(S2(this.options), this.options.chunkSize);
59627             await this.file.ensureChunk(0, e4), this.createParser("tiff", this.file), this.parsers.tiff.parseHeader(), await this.parsers.tiff.parseIfd0Block(), this.adaptTiffPropAsSegment("xmp"), this.adaptTiffPropAsSegment("iptc"), this.adaptTiffPropAsSegment("icc");
59628           }
59629         }
59630         adaptTiffPropAsSegment(e3) {
59631           if (this.parsers.tiff[e3]) {
59632             let t2 = this.parsers.tiff[e3];
59633             this.injectSegment(e3, t2);
59634           }
59635         }
59636       };
59637       c(ot, "type", "tiff"), w2.set("tiff", ot);
59638       lt = l("zlib");
59639       ht = ["ihdr", "iccp", "text", "itxt", "exif"];
59640       ut = class extends se2 {
59641         constructor(...e3) {
59642           super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
59643         }
59644         static canHandle(e3, t2) {
59645           return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
59646         }
59647         async parse() {
59648           let { file: e3 } = this;
59649           await this.findPngChunksInRange("\x89PNG\r\n\1a\n".length, e3.byteLength), await this.readSegments(this.metaChunks), this.findIhdr(), this.parseTextChunks(), await this.findExif().catch(this.catchError), await this.findXmp().catch(this.catchError), await this.findIcc().catch(this.catchError);
59650         }
59651         async findPngChunksInRange(e3, t2) {
59652           let { file: i3 } = this;
59653           for (; e3 < t2; ) {
59654             let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a4 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
59655             ht.includes(s2) ? this.metaChunks.push(a4) : this.unknownChunks.push(a4), e3 += r2;
59656           }
59657         }
59658         parseTextChunks() {
59659           let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
59660           for (let t2 of e3) {
59661             let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
59662             this.injectKeyValToIhdr(e4, i3);
59663           }
59664         }
59665         injectKeyValToIhdr(e3, t2) {
59666           let i3 = this.parsers.ihdr;
59667           i3 && i3.raw.set(e3, t2);
59668         }
59669         findIhdr() {
59670           let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
59671           e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
59672         }
59673         async findExif() {
59674           let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
59675           e3 && this.injectSegment("tiff", e3.chunk);
59676         }
59677         async findXmp() {
59678           let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
59679           for (let t2 of e3) {
59680             "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
59681           }
59682         }
59683         async findIcc() {
59684           let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
59685           if (!e3) return;
59686           let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
59687           for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
59688           let r2 = s2 + 2, a4 = t2.getString(0, s2);
59689           if (this.injectKeyValToIhdr("ProfileName", a4), n2) {
59690             let e4 = await lt, i4 = t2.getUint8Array(r2);
59691             i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
59692           }
59693         }
59694       };
59695       c(ut, "type", "png"), w2.set("png", ut), U2(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F2(E, "ifd0", [[11, "ProcessingSoftware"], [254, "SubfileType"], [255, "OldSubfileType"], [263, "Thresholding"], [264, "CellWidth"], [265, "CellLength"], [266, "FillOrder"], [269, "DocumentName"], [280, "MinSampleValue"], [281, "MaxSampleValue"], [285, "PageName"], [286, "XPosition"], [287, "YPosition"], [290, "GrayResponseUnit"], [297, "PageNumber"], [321, "HalftoneHints"], [322, "TileWidth"], [323, "TileLength"], [332, "InkSet"], [337, "TargetPrinter"], [18246, "Rating"], [18249, "RatingPercent"], [33550, "PixelScale"], [34264, "ModelTransform"], [34377, "PhotoshopSettings"], [50706, "DNGVersion"], [50707, "DNGBackwardVersion"], [50708, "UniqueCameraModel"], [50709, "LocalizedCameraModel"], [50736, "DNGLensInfo"], [50739, "ShadowScale"], [50740, "DNGPrivateData"], [33920, "IntergraphMatrix"], [33922, "ModelTiePoint"], [34118, "SEMInfo"], [34735, "GeoTiffDirectory"], [34736, "GeoTiffDoubleParams"], [34737, "GeoTiffAsciiParams"], [50341, "PrintIM"], [50721, "ColorMatrix1"], [50722, "ColorMatrix2"], [50723, "CameraCalibration1"], [50724, "CameraCalibration2"], [50725, "ReductionMatrix1"], [50726, "ReductionMatrix2"], [50727, "AnalogBalance"], [50728, "AsShotNeutral"], [50729, "AsShotWhiteXY"], [50730, "BaselineExposure"], [50731, "BaselineNoise"], [50732, "BaselineSharpness"], [50734, "LinearResponseLimit"], [50735, "CameraSerialNumber"], [50741, "MakerNoteSafety"], [50778, "CalibrationIlluminant1"], [50779, "CalibrationIlluminant2"], [50781, "RawDataUniqueID"], [50827, "OriginalRawFileName"], [50828, "OriginalRawFileData"], [50831, "AsShotICCProfile"], [50832, "AsShotPreProfileMatrix"], [50833, "CurrentICCProfile"], [50834, "CurrentPreProfileMatrix"], [50879, "ColorimetricReference"], [50885, "SRawType"], [50898, "PanasonicTitle"], [50899, "PanasonicTitle2"], [50931, "CameraCalibrationSig"], [50932, "ProfileCalibrationSig"], [50933, "ProfileIFD"], [50934, "AsShotProfileName"], [50936, "ProfileName"], [50937, "ProfileHueSatMapDims"], [50938, "ProfileHueSatMapData1"], [50939, "ProfileHueSatMapData2"], [50940, "ProfileToneCurve"], [50941, "ProfileEmbedPolicy"], [50942, "ProfileCopyright"], [50964, "ForwardMatrix1"], [50965, "ForwardMatrix2"], [50966, "PreviewApplicationName"], [50967, "PreviewApplicationVersion"], [50968, "PreviewSettingsName"], [50969, "PreviewSettingsDigest"], [50970, "PreviewColorSpace"], [50971, "PreviewDateTime"], [50972, "RawImageDigest"], [50973, "OriginalRawFileDigest"], [50981, "ProfileLookTableDims"], [50982, "ProfileLookTableData"], [51043, "TimeCodes"], [51044, "FrameRate"], [51058, "TStop"], [51081, "ReelName"], [51089, "OriginalDefaultFinalSize"], [51090, "OriginalBestQualitySize"], [51091, "OriginalDefaultCropSize"], [51105, "CameraLabel"], [51107, "ProfileHueSatMapEncoding"], [51108, "ProfileLookTableEncoding"], [51109, "BaselineExposureOffset"], [51110, "DefaultBlackRender"], [51111, "NewRawImageDigest"], [51112, "RawToPreviewGain"]]);
59696       ct = [[273, "StripOffsets"], [279, "StripByteCounts"], [288, "FreeOffsets"], [289, "FreeByteCounts"], [291, "GrayResponseCurve"], [292, "T4Options"], [293, "T6Options"], [300, "ColorResponseUnit"], [320, "ColorMap"], [324, "TileOffsets"], [325, "TileByteCounts"], [326, "BadFaxLines"], [327, "CleanFaxData"], [328, "ConsecutiveBadFaxLines"], [330, "SubIFD"], [333, "InkNames"], [334, "NumberofInks"], [336, "DotRange"], [338, "ExtraSamples"], [339, "SampleFormat"], [340, "SMinSampleValue"], [341, "SMaxSampleValue"], [342, "TransferRange"], [343, "ClipPath"], [344, "XClipPathUnits"], [345, "YClipPathUnits"], [346, "Indexed"], [347, "JPEGTables"], [351, "OPIProxy"], [400, "GlobalParametersIFD"], [401, "ProfileType"], [402, "FaxProfile"], [403, "CodingMethods"], [404, "VersionYear"], [405, "ModeNumber"], [433, "Decode"], [434, "DefaultImageColor"], [435, "T82Options"], [437, "JPEGTables"], [512, "JPEGProc"], [515, "JPEGRestartInterval"], [517, "JPEGLosslessPredictors"], [518, "JPEGPointTransforms"], [519, "JPEGQTables"], [520, "JPEGDCTables"], [521, "JPEGACTables"], [559, "StripRowCounts"], [999, "USPTOMiscellaneous"], [18247, "XP_DIP_XML"], [18248, "StitchInfo"], [28672, "SonyRawFileType"], [28688, "SonyToneCurve"], [28721, "VignettingCorrection"], [28722, "VignettingCorrParams"], [28724, "ChromaticAberrationCorrection"], [28725, "ChromaticAberrationCorrParams"], [28726, "DistortionCorrection"], [28727, "DistortionCorrParams"], [29895, "SonyCropTopLeft"], [29896, "SonyCropSize"], [32781, "ImageID"], [32931, "WangTag1"], [32932, "WangAnnotation"], [32933, "WangTag3"], [32934, "WangTag4"], [32953, "ImageReferencePoints"], [32954, "RegionXformTackPoint"], [32955, "WarpQuadrilateral"], [32956, "AffineTransformMat"], [32995, "Matteing"], [32996, "DataType"], [32997, "ImageDepth"], [32998, "TileDepth"], [33300, "ImageFullWidth"], [33301, "ImageFullHeight"], [33302, "TextureFormat"], [33303, "WrapModes"], [33304, "FovCot"], [33305, "MatrixWorldToScreen"], [33306, "MatrixWorldToCamera"], [33405, "Model2"], [33421, "CFARepeatPatternDim"], [33422, "CFAPattern2"], [33423, "BatteryLevel"], [33424, "KodakIFD"], [33445, "MDFileTag"], [33446, "MDScalePixel"], [33447, "MDColorTable"], [33448, "MDLabName"], [33449, "MDSampleInfo"], [33450, "MDPrepDate"], [33451, "MDPrepTime"], [33452, "MDFileUnits"], [33589, "AdventScale"], [33590, "AdventRevision"], [33628, "UIC1Tag"], [33629, "UIC2Tag"], [33630, "UIC3Tag"], [33631, "UIC4Tag"], [33918, "IntergraphPacketData"], [33919, "IntergraphFlagRegisters"], [33921, "INGRReserved"], [34016, "Site"], [34017, "ColorSequence"], [34018, "IT8Header"], [34019, "RasterPadding"], [34020, "BitsPerRunLength"], [34021, "BitsPerExtendedRunLength"], [34022, "ColorTable"], [34023, "ImageColorIndicator"], [34024, "BackgroundColorIndicator"], [34025, "ImageColorValue"], [34026, "BackgroundColorValue"], [34027, "PixelIntensityRange"], [34028, "TransparencyIndicator"], [34029, "ColorCharacterization"], [34030, "HCUsage"], [34031, "TrapIndicator"], [34032, "CMYKEquivalent"], [34152, "AFCP_IPTC"], [34232, "PixelMagicJBIGOptions"], [34263, "JPLCartoIFD"], [34306, "WB_GRGBLevels"], [34310, "LeafData"], [34687, "TIFF_FXExtensions"], [34688, "MultiProfiles"], [34689, "SharedData"], [34690, "T88Options"], [34732, "ImageLayer"], [34750, "JBIGOptions"], [34856, "Opto-ElectricConvFactor"], [34857, "Interlace"], [34908, "FaxRecvParams"], [34909, "FaxSubAddress"], [34910, "FaxRecvTime"], [34929, "FedexEDR"], [34954, "LeafSubIFD"], [37387, "FlashEnergy"], [37388, "SpatialFrequencyResponse"], [37389, "Noise"], [37390, "FocalPlaneXResolution"], [37391, "FocalPlaneYResolution"], [37392, "FocalPlaneResolutionUnit"], [37397, "ExposureIndex"], [37398, "TIFF-EPStandardID"], [37399, "SensingMethod"], [37434, "CIP3DataFile"], [37435, "CIP3Sheet"], [37436, "CIP3Side"], [37439, "StoNits"], [37679, "MSDocumentText"], [37680, "MSPropertySetStorage"], [37681, "MSDocumentTextPosition"], [37724, "ImageSourceData"], [40965, "InteropIFD"], [40976, "SamsungRawPointersOffset"], [40977, "SamsungRawPointersLength"], [41217, "SamsungRawByteOrder"], [41218, "SamsungRawUnknown"], [41484, "SpatialFrequencyResponse"], [41485, "Noise"], [41489, "ImageNumber"], [41490, "SecurityClassification"], [41491, "ImageHistory"], [41494, "TIFF-EPStandardID"], [41995, "DeviceSettingDescription"], [42112, "GDALMetadata"], [42113, "GDALNoData"], [44992, "ExpandSoftware"], [44993, "ExpandLens"], [44994, "ExpandFilm"], [44995, "ExpandFilterLens"], [44996, "ExpandScanner"], [44997, "ExpandFlashLamp"], [46275, "HasselbladRawImage"], [48129, "PixelFormat"], [48130, "Transformation"], [48131, "Uncompressed"], [48132, "ImageType"], [48256, "ImageWidth"], [48257, "ImageHeight"], [48258, "WidthResolution"], [48259, "HeightResolution"], [48320, "ImageOffset"], [48321, "ImageByteCount"], [48322, "AlphaOffset"], [48323, "AlphaByteCount"], [48324, "ImageDataDiscard"], [48325, "AlphaDataDiscard"], [50215, "OceScanjobDesc"], [50216, "OceApplicationSelector"], [50217, "OceIDNumber"], [50218, "OceImageLogic"], [50255, "Annotations"], [50459, "HasselbladExif"], [50547, "OriginalFileName"], [50560, "USPTOOriginalContentType"], [50656, "CR2CFAPattern"], [50710, "CFAPlaneColor"], [50711, "CFALayout"], [50712, "LinearizationTable"], [50713, "BlackLevelRepeatDim"], [50714, "BlackLevel"], [50715, "BlackLevelDeltaH"], [50716, "BlackLevelDeltaV"], [50717, "WhiteLevel"], [50718, "DefaultScale"], [50719, "DefaultCropOrigin"], [50720, "DefaultCropSize"], [50733, "BayerGreenSplit"], [50737, "ChromaBlurRadius"], [50738, "AntiAliasStrength"], [50752, "RawImageSegmentation"], [50780, "BestQualityScale"], [50784, "AliasLayerMetadata"], [50829, "ActiveArea"], [50830, "MaskedAreas"], [50935, "NoiseReductionApplied"], [50974, "SubTileBlockSize"], [50975, "RowInterleaveFactor"], [51008, "OpcodeList1"], [51009, "OpcodeList2"], [51022, "OpcodeList3"], [51041, "NoiseProfile"], [51114, "CacheVersion"], [51125, "DefaultUserCrop"], [51157, "NikonNEFInfo"], [65024, "KdcIFD"]];
59697       F2(E, "ifd0", ct), F2(E, "exif", ct), U2(B2, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
59698       ft = class extends re3 {
59699         static canHandle(e3, t2) {
59700           return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
59701         }
59702         parse() {
59703           return this.parseTags(), this.translate(), this.output;
59704         }
59705         parseTags() {
59706           this.raw = /* @__PURE__ */ new Map([[0, this.chunk.getUint16(0)], [2, this.chunk.getUint8(2)], [3, this.chunk.getUint16(3)], [5, this.chunk.getUint16(5)], [7, this.chunk.getUint8(7)], [8, this.chunk.getUint8(8)]]);
59707         }
59708       };
59709       c(ft, "type", "jfif"), c(ft, "headerLength", 9), T2.set("jfif", ft), U2(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
59710       dt = class extends re3 {
59711         parse() {
59712           return this.parseTags(), this.translate(), this.output;
59713         }
59714         parseTags() {
59715           this.raw = new Map([[0, this.chunk.getUint32(0)], [4, this.chunk.getUint32(4)], [8, this.chunk.getUint8(8)], [9, this.chunk.getUint8(9)], [10, this.chunk.getUint8(10)], [11, this.chunk.getUint8(11)], [12, this.chunk.getUint8(12)], ...Array.from(this.raw)]);
59716         }
59717       };
59718       c(dt, "type", "ihdr"), T2.set("ihdr", dt), U2(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U2(B2, "ihdr", [[9, { 0: "Grayscale", 2: "RGB", 3: "Palette", 4: "Grayscale with Alpha", 6: "RGB with Alpha", DEFAULT: "Unknown" }], [10, { 0: "Deflate/Inflate", DEFAULT: "Unknown" }], [11, { 0: "Adaptive", DEFAULT: "Unknown" }], [12, { 0: "Noninterlaced", 1: "Adam7 Interlace", DEFAULT: "Unknown" }]]);
59719       pt = class extends re3 {
59720         static canHandle(e3, t2) {
59721           return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
59722         }
59723         static findPosition(e3, t2) {
59724           let i3 = super.findPosition(e3, t2);
59725           return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
59726         }
59727         static handleMultiSegments(e3) {
59728           return function(e4) {
59729             let t2 = function(e6) {
59730               let t3 = e6[0].constructor, i3 = 0;
59731               for (let t4 of e6) i3 += t4.length;
59732               let n3 = new t3(i3), s2 = 0;
59733               for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
59734               return n3;
59735             }(e4.map((e6) => e6.chunk.toUint8()));
59736             return new I2(t2);
59737           }(e3);
59738         }
59739         parse() {
59740           return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
59741         }
59742         parseHeader() {
59743           let { raw: e3 } = this;
59744           this.chunk.byteLength < 84 && g2("ICC header is too short");
59745           for (let [t2, i3] of Object.entries(gt)) {
59746             t2 = parseInt(t2, 10);
59747             let n3 = i3(this.chunk, t2);
59748             "\0\0\0\0" !== n3 && e3.set(t2, n3);
59749           }
59750         }
59751         parseTags() {
59752           let e3, t2, i3, n3, s2, { raw: r2 } = this, a4 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
59753           for (; a4--; ) {
59754             if (e3 = this.chunk.getString(o2, 4), t2 = this.chunk.getUint32(o2 + 4), i3 = this.chunk.getUint32(o2 + 8), n3 = this.chunk.getString(t2, 4), t2 + i3 > l2) return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
59755             s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
59756           }
59757         }
59758         parseTag(e3, t2, i3) {
59759           switch (e3) {
59760             case "desc":
59761               return this.parseDesc(t2);
59762             case "mluc":
59763               return this.parseMluc(t2);
59764             case "text":
59765               return this.parseText(t2, i3);
59766             case "sig ":
59767               return this.parseSig(t2);
59768           }
59769           if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
59770         }
59771         parseDesc(e3) {
59772           let t2 = this.chunk.getUint32(e3 + 8) - 1;
59773           return m2(this.chunk.getString(e3 + 12, t2));
59774         }
59775         parseText(e3, t2) {
59776           return m2(this.chunk.getString(e3 + 8, t2 - 8));
59777         }
59778         parseSig(e3) {
59779           return m2(this.chunk.getString(e3 + 8, 4));
59780         }
59781         parseMluc(e3) {
59782           let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
59783           for (let a4 = 0; a4 < i3; a4++) {
59784             let i4 = t2.getString(s2 + 0, 2), a5 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h3 = m2(t2.getUnicodeString(l2, o2));
59785             r2.push({ lang: i4, country: a5, text: h3 }), s2 += n3;
59786           }
59787           return 1 === i3 ? r2[0].text : r2;
59788         }
59789         translateValue(e3, t2) {
59790           return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
59791         }
59792       };
59793       c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
59794       gt = { 4: mt, 8: function(e3, t2) {
59795         return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
59796       }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
59797         const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a4 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
59798         return new Date(Date.UTC(i3, n3, s2, r2, a4, o2));
59799       }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
59800       T2.set("icc", pt), U2(E, "icc", [[4, "ProfileCMMType"], [8, "ProfileVersion"], [12, "ProfileClass"], [16, "ColorSpaceData"], [20, "ProfileConnectionSpace"], [24, "ProfileDateTime"], [36, "ProfileFileSignature"], [40, "PrimaryPlatform"], [44, "CMMFlags"], [48, "DeviceManufacturer"], [52, "DeviceModel"], [56, "DeviceAttributes"], [64, "RenderingIntent"], [68, "ConnectionSpaceIlluminant"], [80, "ProfileCreator"], [84, "ProfileID"], ["Header", "ProfileHeader"], ["MS00", "WCSProfiles"], ["bTRC", "BlueTRC"], ["bXYZ", "BlueMatrixColumn"], ["bfd", "UCRBG"], ["bkpt", "MediaBlackPoint"], ["calt", "CalibrationDateTime"], ["chad", "ChromaticAdaptation"], ["chrm", "Chromaticity"], ["ciis", "ColorimetricIntentImageState"], ["clot", "ColorantTableOut"], ["clro", "ColorantOrder"], ["clrt", "ColorantTable"], ["cprt", "ProfileCopyright"], ["crdi", "CRDInfo"], ["desc", "ProfileDescription"], ["devs", "DeviceSettings"], ["dmdd", "DeviceModelDesc"], ["dmnd", "DeviceMfgDesc"], ["dscm", "ProfileDescriptionML"], ["fpce", "FocalPlaneColorimetryEstimates"], ["gTRC", "GreenTRC"], ["gXYZ", "GreenMatrixColumn"], ["gamt", "Gamut"], ["kTRC", "GrayTRC"], ["lumi", "Luminance"], ["meas", "Measurement"], ["meta", "Metadata"], ["mmod", "MakeAndModel"], ["ncl2", "NamedColor2"], ["ncol", "NamedColor"], ["ndin", "NativeDisplayInfo"], ["pre0", "Preview0"], ["pre1", "Preview1"], ["pre2", "Preview2"], ["ps2i", "PS2RenderingIntent"], ["ps2s", "PostScript2CSA"], ["psd0", "PostScript2CRD0"], ["psd1", "PostScript2CRD1"], ["psd2", "PostScript2CRD2"], ["psd3", "PostScript2CRD3"], ["pseq", "ProfileSequenceDesc"], ["psid", "ProfileSequenceIdentifier"], ["psvm", "PS2CRDVMSize"], ["rTRC", "RedTRC"], ["rXYZ", "RedMatrixColumn"], ["resp", "OutputResponse"], ["rhoc", "ReflectionHardcopyOrigColorimetry"], ["rig0", "PerceptualRenderingIntentGamut"], ["rig2", "SaturationRenderingIntentGamut"], ["rpoc", "ReflectionPrintOutputColorimetry"], ["sape", "SceneAppearanceEstimates"], ["scoe", "SceneColorimetryEstimates"], ["scrd", "ScreeningDesc"], ["scrn", "Screening"], ["targ", "CharTarget"], ["tech", "Technology"], ["vcgt", "VideoCardGamma"], ["view", "ViewingConditions"], ["vued", "ViewingCondDesc"], ["wtpt", "MediaWhitePoint"]]);
59801       St = { "4d2p": "Erdt Systems", AAMA: "Aamazing Technologies", ACER: "Acer", ACLT: "Acolyte Color Research", ACTI: "Actix Sytems", ADAR: "Adara Technology", ADBE: "Adobe", ADI: "ADI Systems", AGFA: "Agfa Graphics", ALMD: "Alps Electric", ALPS: "Alps Electric", ALWN: "Alwan Color Expertise", AMTI: "Amiable Technologies", AOC: "AOC International", APAG: "Apago", APPL: "Apple Computer", AST: "AST", "AT&T": "AT&T", BAEL: "BARBIERI electronic", BRCO: "Barco NV", BRKP: "Breakpoint", BROT: "Brother", BULL: "Bull", BUS: "Bus Computer Systems", "C-IT": "C-Itoh", CAMR: "Intel", CANO: "Canon", CARR: "Carroll Touch", CASI: "Casio", CBUS: "Colorbus PL", CEL: "Crossfield", CELx: "Crossfield", CGS: "CGS Publishing Technologies International", CHM: "Rochester Robotics", CIGL: "Colour Imaging Group, London", CITI: "Citizen", CL00: "Candela", CLIQ: "Color IQ", CMCO: "Chromaco", CMiX: "CHROMiX", COLO: "Colorgraphic Communications", COMP: "Compaq", COMp: "Compeq/Focus Technology", CONR: "Conrac Display Products", CORD: "Cordata Technologies", CPQ: "Compaq", CPRO: "ColorPro", CRN: "Cornerstone", CTX: "CTX International", CVIS: "ColorVision", CWC: "Fujitsu Laboratories", DARI: "Darius Technology", DATA: "Dataproducts", DCP: "Dry Creek Photo", DCRC: "Digital Contents Resource Center, Chung-Ang University", DELL: "Dell Computer", DIC: "Dainippon Ink and Chemicals", DICO: "Diconix", DIGI: "Digital", "DL&C": "Digital Light & Color", DPLG: "Doppelganger", DS: "Dainippon Screen", DSOL: "DOOSOL", DUPN: "DuPont", EPSO: "Epson", ESKO: "Esko-Graphics", ETRI: "Electronics and Telecommunications Research Institute", EVER: "Everex Systems", EXAC: "ExactCODE", Eizo: "Eizo", FALC: "Falco Data Products", FF: "Fuji Photo Film", FFEI: "FujiFilm Electronic Imaging", FNRD: "Fnord Software", FORA: "Fora", FORE: "Forefront Technology", FP: "Fujitsu", FPA: "WayTech Development", FUJI: "Fujitsu", FX: "Fuji Xerox", GCC: "GCC Technologies", GGSL: "Global Graphics Software", GMB: "Gretagmacbeth", GMG: "GMG", GOLD: "GoldStar Technology", GOOG: "Google", GPRT: "Giantprint", GTMB: "Gretagmacbeth", GVC: "WayTech Development", GW2K: "Sony", HCI: "HCI", HDM: "Heidelberger Druckmaschinen", HERM: "Hermes", HITA: "Hitachi America", HP: "Hewlett-Packard", HTC: "Hitachi", HiTi: "HiTi Digital", IBM: "IBM", IDNT: "Scitex", IEC: "Hewlett-Packard", IIYA: "Iiyama North America", IKEG: "Ikegami Electronics", IMAG: "Image Systems", IMI: "Ingram Micro", INTC: "Intel", INTL: "N/A (INTL)", INTR: "Intra Electronics", IOCO: "Iocomm International Technology", IPS: "InfoPrint Solutions Company", IRIS: "Scitex", ISL: "Ichikawa Soft Laboratory", ITNL: "N/A (ITNL)", IVM: "IVM", IWAT: "Iwatsu Electric", Idnt: "Scitex", Inca: "Inca Digital Printers", Iris: "Scitex", JPEG: "Joint Photographic Experts Group", JSFT: "Jetsoft Development", JVC: "JVC Information Products", KART: "Scitex", KFC: "KFC Computek Components", KLH: "KLH Computers", KMHD: "Konica Minolta", KNCA: "Konica", KODA: "Kodak", KYOC: "Kyocera", Kart: "Scitex", LCAG: "Leica", LCCD: "Leeds Colour", LDAK: "Left Dakota", LEAD: "Leading Technology", LEXM: "Lexmark International", LINK: "Link Computer", LINO: "Linotronic", LITE: "Lite-On", Leaf: "Leaf", Lino: "Linotronic", MAGC: "Mag Computronic", MAGI: "MAG Innovision", MANN: "Mannesmann", MICN: "Micron Technology", MICR: "Microtek", MICV: "Microvitec", MINO: "Minolta", MITS: "Mitsubishi Electronics America", MITs: "Mitsuba", MNLT: "Minolta", MODG: "Modgraph", MONI: "Monitronix", MONS: "Monaco Systems", MORS: "Morse Technology", MOTI: "Motive Systems", MSFT: "Microsoft", MUTO: "MUTOH INDUSTRIES", Mits: "Mitsubishi Electric", NANA: "NANAO", NEC: "NEC", NEXP: "NexPress Solutions", NISS: "Nissei Sangyo America", NKON: "Nikon", NONE: "none", OCE: "Oce Technologies", OCEC: "OceColor", OKI: "Oki", OKID: "Okidata", OKIP: "Okidata", OLIV: "Olivetti", OLYM: "Olympus", ONYX: "Onyx Graphics", OPTI: "Optiquest", PACK: "Packard Bell", PANA: "Matsushita Electric Industrial", PANT: "Pantone", PBN: "Packard Bell", PFU: "PFU", PHIL: "Philips Consumer Electronics", PNTX: "HOYA", POne: "Phase One A/S", PREM: "Premier Computer Innovations", PRIN: "Princeton Graphic Systems", PRIP: "Princeton Publishing Labs", QLUX: "Hong Kong", QMS: "QMS", QPCD: "QPcard AB", QUAD: "QuadLaser", QUME: "Qume", RADI: "Radius", RDDx: "Integrated Color Solutions", RDG: "Roland DG", REDM: "REDMS Group", RELI: "Relisys", RGMS: "Rolf Gierling Multitools", RICO: "Ricoh", RNLD: "Edmund Ronald", ROYA: "Royal", RPC: "Ricoh Printing Systems", RTL: "Royal Information Electronics", SAMP: "Sampo", SAMS: "Samsung", SANT: "Jaime Santana Pomares", SCIT: "Scitex", SCRN: "Dainippon Screen", SDP: "Scitex", SEC: "Samsung", SEIK: "Seiko Instruments", SEIk: "Seikosha", SGUY: "ScanGuy.com", SHAR: "Sharp Laboratories", SICC: "International Color Consortium", SONY: "Sony", SPCL: "SpectraCal", STAR: "Star", STC: "Sampo Technology", Scit: "Scitex", Sdp: "Scitex", Sony: "Sony", TALO: "Talon Technology", TAND: "Tandy", TATU: "Tatung", TAXA: "TAXAN America", TDS: "Tokyo Denshi Sekei", TECO: "TECO Information Systems", TEGR: "Tegra", TEKT: "Tektronix", TI: "Texas Instruments", TMKR: "TypeMaker", TOSB: "Toshiba", TOSH: "Toshiba", TOTK: "TOTOKU ELECTRIC", TRIU: "Triumph", TSBT: "Toshiba", TTX: "TTX Computer Products", TVM: "TVM Professional Monitor", TW: "TW Casper", ULSX: "Ulead Systems", UNIS: "Unisys", UTZF: "Utz Fehlau & Sohn", VARI: "Varityper", VIEW: "Viewsonic", VISL: "Visual communication", VIVO: "Vivo Mobile Communication", WANG: "Wang", WLBR: "Wilbur Imaging", WTG2: "Ware To Go", WYSE: "WYSE Technology", XERX: "Xerox", XRIT: "X-Rite", ZRAN: "Zoran", Zebr: "Zebra Technologies", appl: "Apple Computer", bICC: "basICColor", berg: "bergdesign", ceyd: "Integrated Color Solutions", clsp: "MacDermid ColorSpan", ds: "Dainippon Screen", dupn: "DuPont", ffei: "FujiFilm Electronic Imaging", flux: "FluxData", iris: "Scitex", kart: "Scitex", lcms: "Little CMS", lino: "Linotronic", none: "none", ob4d: "Erdt Systems", obic: "Medigraph", quby: "Qubyx Sarl", scit: "Scitex", scrn: "Dainippon Screen", sdp: "Scitex", siwi: "SIWI GRAFIKA", yxym: "YxyMaster" };
59802       Ct = { scnr: "Scanner", mntr: "Monitor", prtr: "Printer", link: "Device Link", abst: "Abstract", spac: "Color Space Conversion Profile", nmcl: "Named Color", cenc: "ColorEncodingSpace profile", mid: "MultiplexIdentification profile", mlnk: "MultiplexLink profile", mvis: "MultiplexVisualization profile", nkpf: "Nikon Input Device Profile (NON-STANDARD!)" };
59803       U2(B2, "icc", [[4, St], [12, Ct], [40, Object.assign({}, St, Ct)], [48, St], [80, St], [64, { 0: "Perceptual", 1: "Relative Colorimetric", 2: "Saturation", 3: "Absolute Colorimetric" }], ["tech", { amd: "Active Matrix Display", crt: "Cathode Ray Tube Display", kpcd: "Photo CD", pmd: "Passive Matrix Display", dcam: "Digital Camera", dcpj: "Digital Cinema Projector", dmpc: "Digital Motion Picture Camera", dsub: "Dye Sublimation Printer", epho: "Electrophotographic Printer", esta: "Electrostatic Printer", flex: "Flexography", fprn: "Film Writer", fscn: "Film Scanner", grav: "Gravure", ijet: "Ink Jet Printer", imgs: "Photo Image Setter", mpfr: "Motion Picture Film Recorder", mpfs: "Motion Picture Film Scanner", offs: "Offset Lithography", pjtv: "Projection Television", rpho: "Photographic Paper Printer", rscn: "Reflective Scanner", silk: "Silkscreen", twax: "Thermal Wax Printer", vidc: "Video Camera", vidm: "Video Monitor" }]]);
59804       yt = class extends re3 {
59805         static canHandle(e3, t2, i3) {
59806           return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
59807         }
59808         static headerLength(e3, t2, i3) {
59809           let n3, s2 = this.containsIptc8bim(e3, t2, i3);
59810           if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
59811         }
59812         static containsIptc8bim(e3, t2, i3) {
59813           for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
59814         }
59815         static isIptcSegmentHead(e3, t2) {
59816           return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
59817         }
59818         parse() {
59819           let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
59820           for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
59821             i3 = true;
59822             let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
59823             e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
59824           } else if (i3) break;
59825           return this.translate(), this.output;
59826         }
59827         pluralizeValue(e3, t2) {
59828           return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
59829         }
59830       };
59831       c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T2.set("iptc", yt), U2(E, "iptc", [[0, "ApplicationRecordVersion"], [3, "ObjectTypeReference"], [4, "ObjectAttributeReference"], [5, "ObjectName"], [7, "EditStatus"], [8, "EditorialUpdate"], [10, "Urgency"], [12, "SubjectReference"], [15, "Category"], [20, "SupplementalCategories"], [22, "FixtureIdentifier"], [25, "Keywords"], [26, "ContentLocationCode"], [27, "ContentLocationName"], [30, "ReleaseDate"], [35, "ReleaseTime"], [37, "ExpirationDate"], [38, "ExpirationTime"], [40, "SpecialInstructions"], [42, "ActionAdvised"], [45, "ReferenceService"], [47, "ReferenceDate"], [50, "ReferenceNumber"], [55, "DateCreated"], [60, "TimeCreated"], [62, "DigitalCreationDate"], [63, "DigitalCreationTime"], [65, "OriginatingProgram"], [70, "ProgramVersion"], [75, "ObjectCycle"], [80, "Byline"], [85, "BylineTitle"], [90, "City"], [92, "Sublocation"], [95, "State"], [100, "CountryCode"], [101, "Country"], [103, "OriginalTransmissionReference"], [105, "Headline"], [110, "Credit"], [115, "Source"], [116, "CopyrightNotice"], [118, "Contact"], [120, "Caption"], [121, "LocalCaption"], [122, "Writer"], [125, "RasterizedCaption"], [130, "ImageType"], [131, "ImageOrientation"], [135, "LanguageIdentifier"], [150, "AudioType"], [151, "AudioSamplingRate"], [152, "AudioSamplingResolution"], [153, "AudioDuration"], [154, "AudioOutcue"], [184, "JobID"], [185, "MasterDocumentID"], [186, "ShortDocumentID"], [187, "UniqueDocumentID"], [188, "OwnerID"], [200, "ObjectPreviewFileFormat"], [201, "ObjectPreviewFileVersion"], [202, "ObjectPreviewData"], [221, "Prefs"], [225, "ClassifyState"], [228, "SimilarityIndex"], [230, "DocumentNotes"], [231, "DocumentHistory"], [232, "ExifCameraInfo"], [255, "CatalogSets"]]), U2(B2, "iptc", [[10, { 0: "0 (reserved)", 1: "1 (most urgent)", 2: "2", 3: "3", 4: "4", 5: "5 (normal urgency)", 6: "6", 7: "7", 8: "8 (least urgent)", 9: "9 (user-defined priority)" }], [75, { a: "Morning", b: "Both Morning and Evening", p: "Evening" }], [131, { L: "Landscape", P: "Portrait", S: "Square" }]]);
59832       full_esm_default = tt;
59833     }
59834   });
59835
59836   // modules/svg/local_photos.js
59837   var local_photos_exports = {};
59838   __export(local_photos_exports, {
59839     svgLocalPhotos: () => svgLocalPhotos
59840   });
59841   function svgLocalPhotos(projection2, context, dispatch14) {
59842     const detected = utilDetect();
59843     let layer = select_default2(null);
59844     let _fileList;
59845     let _photos = [];
59846     let _idAutoinc = 0;
59847     let _photoFrame;
59848     let _activePhotoIdx;
59849     function init2() {
59850       if (_initialized2) return;
59851       _enabled2 = true;
59852       function over(d3_event) {
59853         d3_event.stopPropagation();
59854         d3_event.preventDefault();
59855         d3_event.dataTransfer.dropEffect = "copy";
59856       }
59857       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
59858         d3_event.stopPropagation();
59859         d3_event.preventDefault();
59860         if (!detected.filedrop) return;
59861         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
59862           if (loaded.length > 0) {
59863             drawPhotos.fitZoom(false);
59864           }
59865         });
59866       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
59867       _initialized2 = true;
59868     }
59869     function ensureViewerLoaded(context2) {
59870       if (_photoFrame) {
59871         return Promise.resolve(_photoFrame);
59872       }
59873       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
59874       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
59875       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
59876       const controlsEnter = viewerEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-local");
59877       controlsEnter.append("button").classed("back", true).on("click.back", () => stepPhotos(-1)).text("\u25C0");
59878       controlsEnter.append("button").classed("forward", true).on("click.forward", () => stepPhotos(1)).text("\u25B6");
59879       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
59880         _photoFrame = planePhotoFrame;
59881       });
59882     }
59883     function stepPhotos(stepBy) {
59884       if (!_photos || _photos.length === 0) return;
59885       if (_activePhotoIdx === void 0) _activePhotoIdx = 0;
59886       const newIndex = _activePhotoIdx + stepBy;
59887       _activePhotoIdx = Math.max(0, Math.min(_photos.length - 1, newIndex));
59888       click(null, _photos[_activePhotoIdx], false);
59889     }
59890     function click(d3_event, image, zoomTo) {
59891       _activePhotoIdx = _photos.indexOf(image);
59892       ensureViewerLoaded(context).then(() => {
59893         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
59894         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
59895         const controlsWrap = viewer.select(".photo-controls-wrap");
59896         controlsWrap.select(".back").attr("disabled", _activePhotoIdx <= 0 ? true : null);
59897         controlsWrap.select(".forward").attr("disabled", _activePhotoIdx >= _photos.length - 1 ? true : null);
59898         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
59899         if (image.date) {
59900           attribution.append("span").text(image.date.toLocaleString(_mainLocalizer.localeCode()));
59901         }
59902         if (image.name) {
59903           attribution.append("span").classed("filename", true).text(image.name);
59904         }
59905         _photoFrame.selectPhoto({ image_path: "" });
59906         image.getSrc().then((src) => {
59907           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
59908           setStyles();
59909         });
59910       });
59911       if (zoomTo) {
59912         context.map().centerEase(image.loc);
59913       }
59914     }
59915     function transform2(d2) {
59916       var svgpoint = projection2(d2.loc);
59917       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
59918     }
59919     function setStyles(hovered) {
59920       const viewer = context.container().select(".photoviewer");
59921       const selected = viewer.empty() ? void 0 : viewer.datum();
59922       context.container().selectAll(".layer-local-photos .viewfield-group").classed("hovered", (d2) => d2.id === (hovered == null ? void 0 : hovered.id)).classed("highlighted", (d2) => d2.id === (hovered == null ? void 0 : hovered.id) || d2.id === (selected == null ? void 0 : selected.id)).classed("currentView", (d2) => d2.id === (selected == null ? void 0 : selected.id));
59923     }
59924     function display_markers(imageList) {
59925       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
59926       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
59927         return d2.id;
59928       });
59929       groups.exit().remove();
59930       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
59931       groupsEnter.append("g").attr("class", "viewfield-scale");
59932       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
59933       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
59934       const showViewfields = context.map().zoom() >= minViewfieldZoom;
59935       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
59936       viewfields.exit().remove();
59937       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
59938         var _a4;
59939         const d2 = this.parentNode.__data__;
59940         return `rotate(${Math.round((_a4 = d2.direction) != null ? _a4 : 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
59941       }).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").style("visibility", function() {
59942         const d2 = this.parentNode.__data__;
59943         return isNumber_default(d2.direction) ? "visible" : "hidden";
59944       });
59945     }
59946     function drawPhotos(selection2) {
59947       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
59948       layer.exit().remove();
59949       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
59950       layerEnter.append("g").attr("class", "markers");
59951       layer = layerEnter.merge(layer);
59952       if (_photos) {
59953         display_markers(_photos);
59954       }
59955     }
59956     function readFileAsDataURL(file) {
59957       return new Promise((resolve, reject) => {
59958         const reader = new FileReader();
59959         reader.onload = () => resolve(reader.result);
59960         reader.onerror = (error) => reject(error);
59961         reader.readAsDataURL(file);
59962       });
59963     }
59964     async function readmultifiles(files, callback) {
59965       const loaded = [];
59966       for (const file of files) {
59967         try {
59968           const exifData = await full_esm_default.parse(file);
59969           const photo = {
59970             service: "photo",
59971             id: _idAutoinc++,
59972             name: file.name,
59973             getSrc: () => readFileAsDataURL(file),
59974             file,
59975             loc: [exifData.longitude, exifData.latitude],
59976             direction: exifData.GPSImgDirection,
59977             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
59978           };
59979           loaded.push(photo);
59980           const sameName = _photos.filter((i3) => i3.name === photo.name);
59981           if (sameName.length === 0) {
59982             _photos.push(photo);
59983           } else {
59984             const thisContent = await photo.getSrc();
59985             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
59986             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
59987               _photos.push(photo);
59988             }
59989           }
59990         } catch {
59991         }
59992       }
59993       if (typeof callback === "function") callback(loaded);
59994       dispatch14.call("change");
59995     }
59996     drawPhotos.setFiles = function(fileList, callback) {
59997       readmultifiles(Array.from(fileList), callback);
59998       return this;
59999     };
60000     drawPhotos.fileList = function(fileList, callback) {
60001       if (!arguments.length) return _fileList;
60002       _fileList = fileList;
60003       if (!fileList || !fileList.length) return this;
60004       drawPhotos.setFiles(_fileList, callback);
60005       return this;
60006     };
60007     drawPhotos.getPhotos = function() {
60008       return _photos;
60009     };
60010     drawPhotos.removePhoto = function(id2) {
60011       _photos = _photos.filter((i3) => i3.id !== id2);
60012       dispatch14.call("change");
60013       return _photos;
60014     };
60015     drawPhotos.openPhoto = click;
60016     drawPhotos.fitZoom = function(force) {
60017       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
60018       if (coords.length === 0) return;
60019       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a4, b3) => a4.extend(b3));
60020       const map2 = context.map();
60021       var viewport = map2.trimmedExtent().polygon();
60022       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
60023         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
60024       }
60025     };
60026     function showLayer() {
60027       layer.style("display", "block");
60028       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60029         dispatch14.call("change");
60030       });
60031     }
60032     function hideLayer() {
60033       layer.transition().duration(250).style("opacity", 0).on("end", () => {
60034         layer.selectAll(".viewfield-group").remove();
60035         layer.style("display", "none");
60036       });
60037     }
60038     drawPhotos.enabled = function(val) {
60039       if (!arguments.length) return _enabled2;
60040       _enabled2 = val;
60041       if (_enabled2) {
60042         showLayer();
60043       } else {
60044         hideLayer();
60045       }
60046       dispatch14.call("change");
60047       return this;
60048     };
60049     drawPhotos.hasData = function() {
60050       return isArray_default(_photos) && _photos.length > 0;
60051     };
60052     init2();
60053     return drawPhotos;
60054   }
60055   var _initialized2, _enabled2, minViewfieldZoom;
60056   var init_local_photos = __esm({
60057     "modules/svg/local_photos.js"() {
60058       "use strict";
60059       init_src5();
60060       init_full_esm();
60061       init_lodash();
60062       init_localizer();
60063       init_detect();
60064       init_geo2();
60065       init_plane_photo();
60066       _initialized2 = false;
60067       _enabled2 = false;
60068       minViewfieldZoom = 16;
60069     }
60070   });
60071
60072   // modules/svg/osmose.js
60073   var osmose_exports2 = {};
60074   __export(osmose_exports2, {
60075     svgOsmose: () => svgOsmose
60076   });
60077   function svgOsmose(projection2, context, dispatch14) {
60078     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60079     const minZoom5 = 12;
60080     let touchLayer = select_default2(null);
60081     let drawLayer = select_default2(null);
60082     let layerVisible = false;
60083     function markerPath(selection2, klass) {
60084       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");
60085     }
60086     function getService() {
60087       if (services.osmose && !_qaService2) {
60088         _qaService2 = services.osmose;
60089         _qaService2.on("loaded", throttledRedraw);
60090       } else if (!services.osmose && _qaService2) {
60091         _qaService2 = null;
60092       }
60093       return _qaService2;
60094     }
60095     function editOn() {
60096       if (!layerVisible) {
60097         layerVisible = true;
60098         drawLayer.style("display", "block");
60099       }
60100     }
60101     function editOff() {
60102       if (layerVisible) {
60103         layerVisible = false;
60104         drawLayer.style("display", "none");
60105         drawLayer.selectAll(".qaItem.osmose").remove();
60106         touchLayer.selectAll(".qaItem.osmose").remove();
60107       }
60108     }
60109     function layerOn() {
60110       editOn();
60111       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
60112     }
60113     function layerOff() {
60114       throttledRedraw.cancel();
60115       drawLayer.interrupt();
60116       touchLayer.selectAll(".qaItem.osmose").remove();
60117       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
60118         editOff();
60119         dispatch14.call("change");
60120       });
60121     }
60122     function updateMarkers() {
60123       if (!layerVisible || !_layerEnabled2) return;
60124       const service = getService();
60125       const selectedID = context.selectedErrorID();
60126       const data = service ? service.getItems(projection2) : [];
60127       const getTransform = svgPointTransform(projection2);
60128       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60129       markers.exit().remove();
60130       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
60131       markersEnter.append("polygon").call(markerPath, "shadow");
60132       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
60133       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
60134       markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
60135       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
60136       if (touchLayer.empty()) return;
60137       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
60138       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
60139       targets.exit().remove();
60140       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
60141       function sortY(a4, b3) {
60142         return a4.id === selectedID ? 1 : b3.id === selectedID ? -1 : b3.loc[1] - a4.loc[1];
60143       }
60144     }
60145     function drawOsmose(selection2) {
60146       const service = getService();
60147       const surface = context.surface();
60148       if (surface && !surface.empty()) {
60149         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
60150       }
60151       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
60152       drawLayer.exit().remove();
60153       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
60154       if (_layerEnabled2) {
60155         if (service && ~~context.map().zoom() >= minZoom5) {
60156           editOn();
60157           service.loadIssues(projection2);
60158           updateMarkers();
60159         } else {
60160           editOff();
60161         }
60162       }
60163     }
60164     drawOsmose.enabled = function(val) {
60165       if (!arguments.length) return _layerEnabled2;
60166       _layerEnabled2 = val;
60167       if (_layerEnabled2) {
60168         getService().loadStrings().then(layerOn).catch((err) => {
60169           console.log(err);
60170         });
60171       } else {
60172         layerOff();
60173         if (context.selectedErrorID()) {
60174           context.enter(modeBrowse(context));
60175         }
60176       }
60177       dispatch14.call("change");
60178       return this;
60179     };
60180     drawOsmose.supported = () => !!getService();
60181     return drawOsmose;
60182   }
60183   var _layerEnabled2, _qaService2;
60184   var init_osmose2 = __esm({
60185     "modules/svg/osmose.js"() {
60186       "use strict";
60187       init_throttle();
60188       init_src5();
60189       init_browse();
60190       init_helpers();
60191       init_services();
60192       _layerEnabled2 = false;
60193     }
60194   });
60195
60196   // modules/svg/streetside.js
60197   var streetside_exports2 = {};
60198   __export(streetside_exports2, {
60199     svgStreetside: () => svgStreetside
60200   });
60201   function svgStreetside(projection2, context, dispatch14) {
60202     var throttledRedraw = throttle_default(function() {
60203       dispatch14.call("change");
60204     }, 1e3);
60205     var minZoom5 = 14;
60206     var minMarkerZoom = 16;
60207     var minViewfieldZoom2 = 18;
60208     var layer = select_default2(null);
60209     var _viewerYaw = 0;
60210     var _selectedSequence = null;
60211     var _streetside;
60212     function init2() {
60213       if (svgStreetside.initialized) return;
60214       svgStreetside.enabled = false;
60215       svgStreetside.initialized = true;
60216     }
60217     function getService() {
60218       if (services.streetside && !_streetside) {
60219         _streetside = services.streetside;
60220         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
60221       } else if (!services.streetside && _streetside) {
60222         _streetside = null;
60223       }
60224       return _streetside;
60225     }
60226     function showLayer() {
60227       var service = getService();
60228       if (!service) return;
60229       editOn();
60230       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60231         dispatch14.call("change");
60232       });
60233     }
60234     function hideLayer() {
60235       throttledRedraw.cancel();
60236       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60237     }
60238     function editOn() {
60239       layer.style("display", "block");
60240     }
60241     function editOff() {
60242       layer.selectAll(".viewfield-group").remove();
60243       layer.style("display", "none");
60244     }
60245     function click(d3_event, d2) {
60246       var service = getService();
60247       if (!service) return;
60248       if (d2.sequenceKey !== _selectedSequence) {
60249         _viewerYaw = 0;
60250       }
60251       _selectedSequence = d2.sequenceKey;
60252       service.ensureViewerLoaded(context).then(function() {
60253         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
60254       });
60255       context.map().centerEase(d2.loc);
60256     }
60257     function mouseover(d3_event, d2) {
60258       var service = getService();
60259       if (service) service.setStyles(context, d2);
60260     }
60261     function mouseout() {
60262       var service = getService();
60263       if (service) service.setStyles(context, null);
60264     }
60265     function transform2(d2) {
60266       var t2 = svgPointTransform(projection2)(d2);
60267       var rot = d2.ca + _viewerYaw;
60268       if (rot) {
60269         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60270       }
60271       return t2;
60272     }
60273     function viewerChanged() {
60274       var service = getService();
60275       if (!service) return;
60276       var viewer = service.viewer();
60277       if (!viewer) return;
60278       _viewerYaw = viewer.getYaw();
60279       if (context.map().isTransformed()) return;
60280       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
60281     }
60282     function filterBubbles(bubbles) {
60283       var fromDate = context.photos().fromDate();
60284       var toDate = context.photos().toDate();
60285       var usernames = context.photos().usernames();
60286       if (fromDate) {
60287         var fromTimestamp = new Date(fromDate).getTime();
60288         bubbles = bubbles.filter(function(bubble) {
60289           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
60290         });
60291       }
60292       if (toDate) {
60293         var toTimestamp = new Date(toDate).getTime();
60294         bubbles = bubbles.filter(function(bubble) {
60295           return new Date(bubble.captured_at).getTime() <= toTimestamp;
60296         });
60297       }
60298       if (usernames) {
60299         bubbles = bubbles.filter(function(bubble) {
60300           return usernames.indexOf(bubble.captured_by) !== -1;
60301         });
60302       }
60303       return bubbles;
60304     }
60305     function filterSequences(sequences) {
60306       var fromDate = context.photos().fromDate();
60307       var toDate = context.photos().toDate();
60308       var usernames = context.photos().usernames();
60309       if (fromDate) {
60310         var fromTimestamp = new Date(fromDate).getTime();
60311         sequences = sequences.filter(function(sequences2) {
60312           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
60313         });
60314       }
60315       if (toDate) {
60316         var toTimestamp = new Date(toDate).getTime();
60317         sequences = sequences.filter(function(sequences2) {
60318           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
60319         });
60320       }
60321       if (usernames) {
60322         sequences = sequences.filter(function(sequences2) {
60323           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
60324         });
60325       }
60326       return sequences;
60327     }
60328     function update() {
60329       var viewer = context.container().select(".photoviewer");
60330       var selected = viewer.empty() ? void 0 : viewer.datum();
60331       var z3 = ~~context.map().zoom();
60332       var showMarkers = z3 >= minMarkerZoom;
60333       var showViewfields = z3 >= minViewfieldZoom2;
60334       var service = getService();
60335       var sequences = [];
60336       var bubbles = [];
60337       if (context.photos().showsPanoramic()) {
60338         sequences = service ? service.sequences(projection2) : [];
60339         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
60340         sequences = filterSequences(sequences);
60341         bubbles = filterBubbles(bubbles);
60342       }
60343       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60344         return d2.properties.key;
60345       });
60346       dispatch14.call("photoDatesChanged", this, "streetside", [...bubbles.map((p2) => p2.captured_at), ...sequences.map((t2) => t2.properties.vintageStart)]);
60347       traces.exit().remove();
60348       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60349       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
60350         return d2.key + (d2.sequenceKey ? "v1" : "v0");
60351       });
60352       groups.exit().remove();
60353       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60354       groupsEnter.append("g").attr("class", "viewfield-scale");
60355       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60356         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60357       }).attr("transform", transform2).select(".viewfield-scale");
60358       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60359       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60360       viewfields.exit().remove();
60361       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60362       function viewfieldPath() {
60363         var d2 = this.parentNode.__data__;
60364         if (d2.pano) {
60365           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60366         } else {
60367           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60368         }
60369       }
60370     }
60371     function drawImages(selection2) {
60372       var enabled = svgStreetside.enabled;
60373       var service = getService();
60374       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
60375       layer.exit().remove();
60376       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
60377       layerEnter.append("g").attr("class", "sequences");
60378       layerEnter.append("g").attr("class", "markers");
60379       layer = layerEnter.merge(layer);
60380       if (enabled) {
60381         if (service && ~~context.map().zoom() >= minZoom5) {
60382           editOn();
60383           update();
60384           service.loadBubbles(projection2);
60385         } else {
60386           dispatch14.call("photoDatesChanged", this, "streetside", []);
60387           editOff();
60388         }
60389       } else {
60390         dispatch14.call("photoDatesChanged", this, "streetside", []);
60391       }
60392     }
60393     drawImages.enabled = function(_3) {
60394       if (!arguments.length) return svgStreetside.enabled;
60395       svgStreetside.enabled = _3;
60396       if (svgStreetside.enabled) {
60397         showLayer();
60398         context.photos().on("change.streetside", update);
60399       } else {
60400         hideLayer();
60401         context.photos().on("change.streetside", null);
60402       }
60403       dispatch14.call("change");
60404       return this;
60405     };
60406     drawImages.supported = function() {
60407       return !!getService();
60408     };
60409     drawImages.rendered = function(zoom) {
60410       return zoom >= minZoom5;
60411     };
60412     init2();
60413     return drawImages;
60414   }
60415   var init_streetside2 = __esm({
60416     "modules/svg/streetside.js"() {
60417       "use strict";
60418       init_throttle();
60419       init_src5();
60420       init_helpers();
60421       init_services();
60422     }
60423   });
60424
60425   // modules/svg/vegbilder.js
60426   var vegbilder_exports2 = {};
60427   __export(vegbilder_exports2, {
60428     svgVegbilder: () => svgVegbilder
60429   });
60430   function svgVegbilder(projection2, context, dispatch14) {
60431     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
60432     const minZoom5 = 14;
60433     const minMarkerZoom = 16;
60434     const minViewfieldZoom2 = 18;
60435     let layer = select_default2(null);
60436     let _viewerYaw = 0;
60437     let _vegbilder;
60438     function init2() {
60439       if (svgVegbilder.initialized) return;
60440       svgVegbilder.enabled = false;
60441       svgVegbilder.initialized = true;
60442     }
60443     function getService() {
60444       if (services.vegbilder && !_vegbilder) {
60445         _vegbilder = services.vegbilder;
60446         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
60447       } else if (!services.vegbilder && _vegbilder) {
60448         _vegbilder = null;
60449       }
60450       return _vegbilder;
60451     }
60452     function showLayer() {
60453       const service = getService();
60454       if (!service) return;
60455       editOn();
60456       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
60457     }
60458     function hideLayer() {
60459       throttledRedraw.cancel();
60460       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60461     }
60462     function editOn() {
60463       layer.style("display", "block");
60464     }
60465     function editOff() {
60466       layer.selectAll(".viewfield-group").remove();
60467       layer.style("display", "none");
60468     }
60469     function click(d3_event, d2) {
60470       const service = getService();
60471       if (!service) return;
60472       service.ensureViewerLoaded(context).then(() => {
60473         service.selectImage(context, d2.key).showViewer(context);
60474       });
60475       context.map().centerEase(d2.loc);
60476     }
60477     function mouseover(d3_event, d2) {
60478       const service = getService();
60479       if (service) service.setStyles(context, d2);
60480     }
60481     function mouseout() {
60482       const service = getService();
60483       if (service) service.setStyles(context, null);
60484     }
60485     function transform2(d2, selected) {
60486       let t2 = svgPointTransform(projection2)(d2);
60487       let rot = d2.ca;
60488       if (d2 === selected) {
60489         rot += _viewerYaw;
60490       }
60491       if (rot) {
60492         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
60493       }
60494       return t2;
60495     }
60496     function viewerChanged() {
60497       const service = getService();
60498       if (!service) return;
60499       const frame2 = service.photoFrame();
60500       if (!frame2) return;
60501       _viewerYaw = frame2.getYaw();
60502       if (context.map().isTransformed()) return;
60503       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
60504     }
60505     function filterImages(images) {
60506       const photoContext = context.photos();
60507       const fromDateString = photoContext.fromDate();
60508       const toDateString = photoContext.toDate();
60509       const showsFlat = photoContext.showsFlat();
60510       const showsPano = photoContext.showsPanoramic();
60511       if (fromDateString) {
60512         const fromDate = new Date(fromDateString);
60513         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
60514       }
60515       if (toDateString) {
60516         const toDate = new Date(toDateString);
60517         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
60518       }
60519       if (!showsPano) {
60520         images = images.filter((image) => !image.is_sphere);
60521       }
60522       if (!showsFlat) {
60523         images = images.filter((image) => image.is_sphere);
60524       }
60525       return images;
60526     }
60527     function filterSequences(sequences) {
60528       const photoContext = context.photos();
60529       const fromDateString = photoContext.fromDate();
60530       const toDateString = photoContext.toDate();
60531       const showsFlat = photoContext.showsFlat();
60532       const showsPano = photoContext.showsPanoramic();
60533       if (fromDateString) {
60534         const fromDate = new Date(fromDateString);
60535         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
60536       }
60537       if (toDateString) {
60538         const toDate = new Date(toDateString);
60539         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
60540       }
60541       if (!showsPano) {
60542         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
60543       }
60544       if (!showsFlat) {
60545         sequences = sequences.filter(({ images }) => images[0].is_sphere);
60546       }
60547       return sequences;
60548     }
60549     function update() {
60550       const viewer = context.container().select(".photoviewer");
60551       const selected = viewer.empty() ? void 0 : viewer.datum();
60552       const z3 = ~~context.map().zoom();
60553       const showMarkers = z3 >= minMarkerZoom;
60554       const showViewfields = z3 >= minViewfieldZoom2;
60555       const service = getService();
60556       let sequences = [];
60557       let images = [];
60558       if (service) {
60559         service.loadImages(context);
60560         sequences = service.sequences(projection2);
60561         images = showMarkers ? service.images(projection2) : [];
60562         dispatch14.call("photoDatesChanged", this, "vegbilder", images.map((p2) => p2.captured_at));
60563         images = filterImages(images);
60564         sequences = filterSequences(sequences);
60565       }
60566       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
60567       traces.exit().remove();
60568       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60569       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
60570       groups.exit().remove();
60571       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60572       groupsEnter.append("g").attr("class", "viewfield-scale");
60573       const markers = groups.merge(groupsEnter).sort((a4, b3) => {
60574         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
60575       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
60576       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60577       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60578       viewfields.exit().remove();
60579       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60580       function viewfieldPath() {
60581         const d2 = this.parentNode.__data__;
60582         if (d2.is_sphere) {
60583           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60584         } else {
60585           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60586         }
60587       }
60588     }
60589     function drawImages(selection2) {
60590       const enabled = svgVegbilder.enabled;
60591       const service = getService();
60592       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
60593       layer.exit().remove();
60594       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
60595       layerEnter.append("g").attr("class", "sequences");
60596       layerEnter.append("g").attr("class", "markers");
60597       layer = layerEnter.merge(layer);
60598       if (enabled) {
60599         if (service && ~~context.map().zoom() >= minZoom5) {
60600           editOn();
60601           update();
60602           service.loadImages(context);
60603         } else {
60604           editOff();
60605         }
60606       }
60607     }
60608     drawImages.enabled = function(_3) {
60609       if (!arguments.length) return svgVegbilder.enabled;
60610       svgVegbilder.enabled = _3;
60611       if (svgVegbilder.enabled) {
60612         showLayer();
60613         context.photos().on("change.vegbilder", update);
60614       } else {
60615         hideLayer();
60616         context.photos().on("change.vegbilder", null);
60617       }
60618       dispatch14.call("change");
60619       return this;
60620     };
60621     drawImages.supported = function() {
60622       return !!getService();
60623     };
60624     drawImages.rendered = function(zoom) {
60625       return zoom >= minZoom5;
60626     };
60627     drawImages.validHere = function(extent, zoom) {
60628       return zoom >= minZoom5 - 2 && getService().validHere(extent);
60629     };
60630     init2();
60631     return drawImages;
60632   }
60633   var init_vegbilder2 = __esm({
60634     "modules/svg/vegbilder.js"() {
60635       "use strict";
60636       init_throttle();
60637       init_src5();
60638       init_helpers();
60639       init_services();
60640     }
60641   });
60642
60643   // modules/svg/mapillary_images.js
60644   var mapillary_images_exports = {};
60645   __export(mapillary_images_exports, {
60646     svgMapillaryImages: () => svgMapillaryImages
60647   });
60648   function svgMapillaryImages(projection2, context, dispatch14) {
60649     const throttledRedraw = throttle_default(function() {
60650       dispatch14.call("change");
60651     }, 1e3);
60652     const minZoom5 = 12;
60653     const minMarkerZoom = 16;
60654     const minViewfieldZoom2 = 18;
60655     let layer = select_default2(null);
60656     let _mapillary;
60657     function init2() {
60658       if (svgMapillaryImages.initialized) return;
60659       svgMapillaryImages.enabled = false;
60660       svgMapillaryImages.initialized = true;
60661     }
60662     function getService() {
60663       if (services.mapillary && !_mapillary) {
60664         _mapillary = services.mapillary;
60665         _mapillary.event.on("loadedImages", throttledRedraw);
60666       } else if (!services.mapillary && _mapillary) {
60667         _mapillary = null;
60668       }
60669       return _mapillary;
60670     }
60671     function showLayer() {
60672       const service = getService();
60673       if (!service) return;
60674       editOn();
60675       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
60676         dispatch14.call("change");
60677       });
60678     }
60679     function hideLayer() {
60680       throttledRedraw.cancel();
60681       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
60682     }
60683     function editOn() {
60684       layer.style("display", "block");
60685     }
60686     function editOff() {
60687       layer.selectAll(".viewfield-group").remove();
60688       layer.style("display", "none");
60689     }
60690     function click(d3_event, image) {
60691       const service = getService();
60692       if (!service) return;
60693       service.ensureViewerLoaded(context).then(function() {
60694         service.selectImage(context, image.id).showViewer(context);
60695       });
60696       context.map().centerEase(image.loc);
60697     }
60698     function mouseover(d3_event, image) {
60699       const service = getService();
60700       if (service) service.setStyles(context, image);
60701     }
60702     function mouseout() {
60703       const service = getService();
60704       if (service) service.setStyles(context, null);
60705     }
60706     function transform2(d2) {
60707       let t2 = svgPointTransform(projection2)(d2);
60708       if (d2.ca) {
60709         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60710       }
60711       return t2;
60712     }
60713     function filterImages(images) {
60714       const showsPano = context.photos().showsPanoramic();
60715       const showsFlat = context.photos().showsFlat();
60716       const fromDate = context.photos().fromDate();
60717       const toDate = context.photos().toDate();
60718       if (!showsPano || !showsFlat) {
60719         images = images.filter(function(image) {
60720           if (image.is_pano) return showsPano;
60721           return showsFlat;
60722         });
60723       }
60724       if (fromDate) {
60725         images = images.filter(function(image) {
60726           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
60727         });
60728       }
60729       if (toDate) {
60730         images = images.filter(function(image) {
60731           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
60732         });
60733       }
60734       return images;
60735     }
60736     function filterSequences(sequences) {
60737       const showsPano = context.photos().showsPanoramic();
60738       const showsFlat = context.photos().showsFlat();
60739       const fromDate = context.photos().fromDate();
60740       const toDate = context.photos().toDate();
60741       if (!showsPano || !showsFlat) {
60742         sequences = sequences.filter(function(sequence) {
60743           if (sequence.properties.hasOwnProperty("is_pano")) {
60744             if (sequence.properties.is_pano) return showsPano;
60745             return showsFlat;
60746           }
60747           return false;
60748         });
60749       }
60750       if (fromDate) {
60751         sequences = sequences.filter(function(sequence) {
60752           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
60753         });
60754       }
60755       if (toDate) {
60756         sequences = sequences.filter(function(sequence) {
60757           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
60758         });
60759       }
60760       return sequences;
60761     }
60762     function update() {
60763       const z3 = ~~context.map().zoom();
60764       const showMarkers = z3 >= minMarkerZoom;
60765       const showViewfields = z3 >= minViewfieldZoom2;
60766       const service = getService();
60767       let sequences = service ? service.sequences(projection2) : [];
60768       let images = service && showMarkers ? service.images(projection2) : [];
60769       dispatch14.call("photoDatesChanged", this, "mapillary", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
60770       images = filterImages(images);
60771       sequences = filterSequences(sequences, service);
60772       service.filterViewer(context);
60773       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
60774         return d2.properties.id;
60775       });
60776       traces.exit().remove();
60777       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
60778       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
60779         return d2.id;
60780       });
60781       groups.exit().remove();
60782       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
60783       groupsEnter.append("g").attr("class", "viewfield-scale");
60784       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
60785         return b3.loc[1] - a4.loc[1];
60786       }).attr("transform", transform2).select(".viewfield-scale");
60787       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60788       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60789       viewfields.exit().remove();
60790       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
60791         return this.parentNode.__data__.is_pano;
60792       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
60793       function viewfieldPath() {
60794         if (this.parentNode.__data__.is_pano) {
60795           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
60796         } else {
60797           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
60798         }
60799       }
60800     }
60801     function drawImages(selection2) {
60802       const enabled = svgMapillaryImages.enabled;
60803       const service = getService();
60804       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
60805       layer.exit().remove();
60806       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
60807       layerEnter.append("g").attr("class", "sequences");
60808       layerEnter.append("g").attr("class", "markers");
60809       layer = layerEnter.merge(layer);
60810       if (enabled) {
60811         if (service && ~~context.map().zoom() >= minZoom5) {
60812           editOn();
60813           update();
60814           service.loadImages(projection2);
60815         } else {
60816           dispatch14.call("photoDatesChanged", this, "mapillary", []);
60817           editOff();
60818         }
60819       } else {
60820         dispatch14.call("photoDatesChanged", this, "mapillary", []);
60821       }
60822     }
60823     drawImages.enabled = function(_3) {
60824       if (!arguments.length) return svgMapillaryImages.enabled;
60825       svgMapillaryImages.enabled = _3;
60826       if (svgMapillaryImages.enabled) {
60827         showLayer();
60828         context.photos().on("change.mapillary_images", update);
60829       } else {
60830         hideLayer();
60831         context.photos().on("change.mapillary_images", null);
60832       }
60833       dispatch14.call("change");
60834       return this;
60835     };
60836     drawImages.supported = function() {
60837       return !!getService();
60838     };
60839     drawImages.rendered = function(zoom) {
60840       return zoom >= minZoom5;
60841     };
60842     init2();
60843     return drawImages;
60844   }
60845   var init_mapillary_images = __esm({
60846     "modules/svg/mapillary_images.js"() {
60847       "use strict";
60848       init_throttle();
60849       init_src5();
60850       init_helpers();
60851       init_services();
60852     }
60853   });
60854
60855   // modules/svg/mapillary_position.js
60856   var mapillary_position_exports = {};
60857   __export(mapillary_position_exports, {
60858     svgMapillaryPosition: () => svgMapillaryPosition
60859   });
60860   function svgMapillaryPosition(projection2, context) {
60861     const throttledRedraw = throttle_default(function() {
60862       update();
60863     }, 1e3);
60864     const minZoom5 = 12;
60865     const minViewfieldZoom2 = 18;
60866     let layer = select_default2(null);
60867     let _mapillary;
60868     let viewerCompassAngle;
60869     function init2() {
60870       if (svgMapillaryPosition.initialized) return;
60871       svgMapillaryPosition.initialized = true;
60872     }
60873     function getService() {
60874       if (services.mapillary && !_mapillary) {
60875         _mapillary = services.mapillary;
60876         _mapillary.event.on("imageChanged", throttledRedraw);
60877         _mapillary.event.on("bearingChanged", function(e3) {
60878           viewerCompassAngle = e3.bearing;
60879           if (context.map().isTransformed()) return;
60880           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
60881             return d2.is_pano;
60882           }).attr("transform", transform2);
60883         });
60884       } else if (!services.mapillary && _mapillary) {
60885         _mapillary = null;
60886       }
60887       return _mapillary;
60888     }
60889     function editOn() {
60890       layer.style("display", "block");
60891     }
60892     function editOff() {
60893       layer.selectAll(".viewfield-group").remove();
60894       layer.style("display", "none");
60895     }
60896     function transform2(d2) {
60897       let t2 = svgPointTransform(projection2)(d2);
60898       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
60899         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
60900       } else if (d2.ca) {
60901         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
60902       }
60903       return t2;
60904     }
60905     function update() {
60906       const z3 = ~~context.map().zoom();
60907       const showViewfields = z3 >= minViewfieldZoom2;
60908       const service = getService();
60909       const image = service && service.getActiveImage();
60910       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
60911         return d2.id;
60912       });
60913       groups.exit().remove();
60914       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
60915       groupsEnter.append("g").attr("class", "viewfield-scale");
60916       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
60917       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
60918       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
60919       viewfields.exit().remove();
60920       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");
60921     }
60922     function drawImages(selection2) {
60923       const service = getService();
60924       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
60925       layer.exit().remove();
60926       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
60927       layerEnter.append("g").attr("class", "markers");
60928       layer = layerEnter.merge(layer);
60929       if (service && ~~context.map().zoom() >= minZoom5) {
60930         editOn();
60931         update();
60932       } else {
60933         editOff();
60934       }
60935     }
60936     drawImages.enabled = function() {
60937       update();
60938       return this;
60939     };
60940     drawImages.supported = function() {
60941       return !!getService();
60942     };
60943     drawImages.rendered = function(zoom) {
60944       return zoom >= minZoom5;
60945     };
60946     init2();
60947     return drawImages;
60948   }
60949   var init_mapillary_position = __esm({
60950     "modules/svg/mapillary_position.js"() {
60951       "use strict";
60952       init_throttle();
60953       init_src5();
60954       init_helpers();
60955       init_services();
60956     }
60957   });
60958
60959   // modules/svg/mapillary_signs.js
60960   var mapillary_signs_exports = {};
60961   __export(mapillary_signs_exports, {
60962     svgMapillarySigns: () => svgMapillarySigns
60963   });
60964   function svgMapillarySigns(projection2, context, dispatch14) {
60965     const throttledRedraw = throttle_default(function() {
60966       dispatch14.call("change");
60967     }, 1e3);
60968     const minZoom5 = 12;
60969     let layer = select_default2(null);
60970     let _mapillary;
60971     function init2() {
60972       if (svgMapillarySigns.initialized) return;
60973       svgMapillarySigns.enabled = false;
60974       svgMapillarySigns.initialized = true;
60975     }
60976     function getService() {
60977       if (services.mapillary && !_mapillary) {
60978         _mapillary = services.mapillary;
60979         _mapillary.event.on("loadedSigns", throttledRedraw);
60980       } else if (!services.mapillary && _mapillary) {
60981         _mapillary = null;
60982       }
60983       return _mapillary;
60984     }
60985     function showLayer() {
60986       const service = getService();
60987       if (!service) return;
60988       service.loadSignResources(context);
60989       editOn();
60990     }
60991     function hideLayer() {
60992       throttledRedraw.cancel();
60993       editOff();
60994     }
60995     function editOn() {
60996       layer.style("display", "block");
60997     }
60998     function editOff() {
60999       layer.selectAll(".icon-sign").remove();
61000       layer.style("display", "none");
61001     }
61002     function click(d3_event, d2) {
61003       const service = getService();
61004       if (!service) return;
61005       context.map().centerEase(d2.loc);
61006       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61007       service.getDetections(d2.id).then((detections) => {
61008         if (detections.length) {
61009           const imageId = detections[0].image.id;
61010           if (imageId === selectedImageId) {
61011             service.highlightDetection(detections[0]).selectImage(context, imageId);
61012           } else {
61013             service.ensureViewerLoaded(context).then(function() {
61014               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61015             });
61016           }
61017         }
61018       });
61019     }
61020     function filterData(detectedFeatures) {
61021       var fromDate = context.photos().fromDate();
61022       var toDate = context.photos().toDate();
61023       if (fromDate) {
61024         var fromTimestamp = new Date(fromDate).getTime();
61025         detectedFeatures = detectedFeatures.filter(function(feature3) {
61026           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
61027         });
61028       }
61029       if (toDate) {
61030         var toTimestamp = new Date(toDate).getTime();
61031         detectedFeatures = detectedFeatures.filter(function(feature3) {
61032           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
61033         });
61034       }
61035       return detectedFeatures;
61036     }
61037     function update() {
61038       const service = getService();
61039       let data = service ? service.signs(projection2) : [];
61040       data = filterData(data);
61041       const transform2 = svgPointTransform(projection2);
61042       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
61043         return d2.id;
61044       });
61045       signs.exit().remove();
61046       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
61047       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61048         return "#" + d2.value;
61049       });
61050       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61051       signs.merge(enter).attr("transform", transform2);
61052     }
61053     function drawSigns(selection2) {
61054       const enabled = svgMapillarySigns.enabled;
61055       const service = getService();
61056       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
61057       layer.exit().remove();
61058       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61059       if (enabled) {
61060         if (service && ~~context.map().zoom() >= minZoom5) {
61061           editOn();
61062           update();
61063           service.loadSigns(projection2);
61064           service.showSignDetections(true);
61065         } else {
61066           editOff();
61067         }
61068       } else if (service) {
61069         service.showSignDetections(false);
61070       }
61071     }
61072     drawSigns.enabled = function(_3) {
61073       if (!arguments.length) return svgMapillarySigns.enabled;
61074       svgMapillarySigns.enabled = _3;
61075       if (svgMapillarySigns.enabled) {
61076         showLayer();
61077         context.photos().on("change.mapillary_signs", update);
61078       } else {
61079         hideLayer();
61080         context.photos().on("change.mapillary_signs", null);
61081       }
61082       dispatch14.call("change");
61083       return this;
61084     };
61085     drawSigns.supported = function() {
61086       return !!getService();
61087     };
61088     drawSigns.rendered = function(zoom) {
61089       return zoom >= minZoom5;
61090     };
61091     init2();
61092     return drawSigns;
61093   }
61094   var init_mapillary_signs = __esm({
61095     "modules/svg/mapillary_signs.js"() {
61096       "use strict";
61097       init_throttle();
61098       init_src5();
61099       init_helpers();
61100       init_services();
61101     }
61102   });
61103
61104   // modules/svg/mapillary_map_features.js
61105   var mapillary_map_features_exports = {};
61106   __export(mapillary_map_features_exports, {
61107     svgMapillaryMapFeatures: () => svgMapillaryMapFeatures
61108   });
61109   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
61110     const throttledRedraw = throttle_default(function() {
61111       dispatch14.call("change");
61112     }, 1e3);
61113     const minZoom5 = 12;
61114     let layer = select_default2(null);
61115     let _mapillary;
61116     function init2() {
61117       if (svgMapillaryMapFeatures.initialized) return;
61118       svgMapillaryMapFeatures.enabled = false;
61119       svgMapillaryMapFeatures.initialized = true;
61120     }
61121     function getService() {
61122       if (services.mapillary && !_mapillary) {
61123         _mapillary = services.mapillary;
61124         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
61125       } else if (!services.mapillary && _mapillary) {
61126         _mapillary = null;
61127       }
61128       return _mapillary;
61129     }
61130     function showLayer() {
61131       const service = getService();
61132       if (!service) return;
61133       service.loadObjectResources(context);
61134       editOn();
61135     }
61136     function hideLayer() {
61137       throttledRedraw.cancel();
61138       editOff();
61139     }
61140     function editOn() {
61141       layer.style("display", "block");
61142     }
61143     function editOff() {
61144       layer.selectAll(".icon-map-feature").remove();
61145       layer.style("display", "none");
61146     }
61147     function click(d3_event, d2) {
61148       const service = getService();
61149       if (!service) return;
61150       context.map().centerEase(d2.loc);
61151       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
61152       service.getDetections(d2.id).then((detections) => {
61153         if (detections.length) {
61154           const imageId = detections[0].image.id;
61155           if (imageId === selectedImageId) {
61156             service.highlightDetection(detections[0]).selectImage(context, imageId);
61157           } else {
61158             service.ensureViewerLoaded(context).then(function() {
61159               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
61160             });
61161           }
61162         }
61163       });
61164     }
61165     function filterData(detectedFeatures) {
61166       const fromDate = context.photos().fromDate();
61167       const toDate = context.photos().toDate();
61168       if (fromDate) {
61169         detectedFeatures = detectedFeatures.filter(function(feature3) {
61170           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
61171         });
61172       }
61173       if (toDate) {
61174         detectedFeatures = detectedFeatures.filter(function(feature3) {
61175           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
61176         });
61177       }
61178       return detectedFeatures;
61179     }
61180     function update() {
61181       const service = getService();
61182       let data = service ? service.mapFeatures(projection2) : [];
61183       data = filterData(data);
61184       const transform2 = svgPointTransform(projection2);
61185       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
61186         return d2.id;
61187       });
61188       mapFeatures.exit().remove();
61189       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
61190       enter.append("title").text(function(d2) {
61191         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
61192         return _t("mapillary_map_features." + id2);
61193       });
61194       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
61195         if (d2.value === "object--billboard") {
61196           return "#object--sign--advertisement";
61197         }
61198         return "#" + d2.value;
61199       });
61200       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
61201       mapFeatures.merge(enter).attr("transform", transform2);
61202     }
61203     function drawMapFeatures(selection2) {
61204       const enabled = svgMapillaryMapFeatures.enabled;
61205       const service = getService();
61206       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
61207       layer.exit().remove();
61208       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
61209       if (enabled) {
61210         if (service && ~~context.map().zoom() >= minZoom5) {
61211           editOn();
61212           update();
61213           service.loadMapFeatures(projection2);
61214           service.showFeatureDetections(true);
61215         } else {
61216           editOff();
61217         }
61218       } else if (service) {
61219         service.showFeatureDetections(false);
61220       }
61221     }
61222     drawMapFeatures.enabled = function(_3) {
61223       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
61224       svgMapillaryMapFeatures.enabled = _3;
61225       if (svgMapillaryMapFeatures.enabled) {
61226         showLayer();
61227         context.photos().on("change.mapillary_map_features", update);
61228       } else {
61229         hideLayer();
61230         context.photos().on("change.mapillary_map_features", null);
61231       }
61232       dispatch14.call("change");
61233       return this;
61234     };
61235     drawMapFeatures.supported = function() {
61236       return !!getService();
61237     };
61238     drawMapFeatures.rendered = function(zoom) {
61239       return zoom >= minZoom5;
61240     };
61241     init2();
61242     return drawMapFeatures;
61243   }
61244   var init_mapillary_map_features = __esm({
61245     "modules/svg/mapillary_map_features.js"() {
61246       "use strict";
61247       init_throttle();
61248       init_src5();
61249       init_helpers();
61250       init_services();
61251       init_localizer();
61252     }
61253   });
61254
61255   // modules/svg/kartaview_images.js
61256   var kartaview_images_exports = {};
61257   __export(kartaview_images_exports, {
61258     svgKartaviewImages: () => svgKartaviewImages
61259   });
61260   function svgKartaviewImages(projection2, context, dispatch14) {
61261     var throttledRedraw = throttle_default(function() {
61262       dispatch14.call("change");
61263     }, 1e3);
61264     var minZoom5 = 12;
61265     var minMarkerZoom = 16;
61266     var minViewfieldZoom2 = 18;
61267     var layer = select_default2(null);
61268     var _kartaview;
61269     function init2() {
61270       if (svgKartaviewImages.initialized) return;
61271       svgKartaviewImages.enabled = false;
61272       svgKartaviewImages.initialized = true;
61273     }
61274     function getService() {
61275       if (services.kartaview && !_kartaview) {
61276         _kartaview = services.kartaview;
61277         _kartaview.event.on("loadedImages", throttledRedraw);
61278       } else if (!services.kartaview && _kartaview) {
61279         _kartaview = null;
61280       }
61281       return _kartaview;
61282     }
61283     function showLayer() {
61284       var service = getService();
61285       if (!service) return;
61286       editOn();
61287       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61288         dispatch14.call("change");
61289       });
61290     }
61291     function hideLayer() {
61292       throttledRedraw.cancel();
61293       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61294     }
61295     function editOn() {
61296       layer.style("display", "block");
61297     }
61298     function editOff() {
61299       layer.selectAll(".viewfield-group").remove();
61300       layer.style("display", "none");
61301     }
61302     function click(d3_event, d2) {
61303       var service = getService();
61304       if (!service) return;
61305       service.ensureViewerLoaded(context).then(function() {
61306         service.selectImage(context, d2.key).showViewer(context);
61307       });
61308       context.map().centerEase(d2.loc);
61309     }
61310     function mouseover(d3_event, d2) {
61311       var service = getService();
61312       if (service) service.setStyles(context, d2);
61313     }
61314     function mouseout() {
61315       var service = getService();
61316       if (service) service.setStyles(context, null);
61317     }
61318     function transform2(d2) {
61319       var t2 = svgPointTransform(projection2)(d2);
61320       if (d2.ca) {
61321         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
61322       }
61323       return t2;
61324     }
61325     function filterImages(images) {
61326       var fromDate = context.photos().fromDate();
61327       var toDate = context.photos().toDate();
61328       var usernames = context.photos().usernames();
61329       if (fromDate) {
61330         var fromTimestamp = new Date(fromDate).getTime();
61331         images = images.filter(function(item) {
61332           return new Date(item.captured_at).getTime() >= fromTimestamp;
61333         });
61334       }
61335       if (toDate) {
61336         var toTimestamp = new Date(toDate).getTime();
61337         images = images.filter(function(item) {
61338           return new Date(item.captured_at).getTime() <= toTimestamp;
61339         });
61340       }
61341       if (usernames) {
61342         images = images.filter(function(item) {
61343           return usernames.indexOf(item.captured_by) !== -1;
61344         });
61345       }
61346       return images;
61347     }
61348     function filterSequences(sequences) {
61349       var fromDate = context.photos().fromDate();
61350       var toDate = context.photos().toDate();
61351       var usernames = context.photos().usernames();
61352       if (fromDate) {
61353         var fromTimestamp = new Date(fromDate).getTime();
61354         sequences = sequences.filter(function(sequence) {
61355           return new Date(sequence.properties.captured_at).getTime() >= fromTimestamp;
61356         });
61357       }
61358       if (toDate) {
61359         var toTimestamp = new Date(toDate).getTime();
61360         sequences = sequences.filter(function(sequence) {
61361           return new Date(sequence.properties.captured_at).getTime() <= toTimestamp;
61362         });
61363       }
61364       if (usernames) {
61365         sequences = sequences.filter(function(sequence) {
61366           return usernames.indexOf(sequence.properties.captured_by) !== -1;
61367         });
61368       }
61369       return sequences;
61370     }
61371     function update() {
61372       var viewer = context.container().select(".photoviewer");
61373       var selected = viewer.empty() ? void 0 : viewer.datum();
61374       var z3 = ~~context.map().zoom();
61375       var showMarkers = z3 >= minMarkerZoom;
61376       var showViewfields = z3 >= minViewfieldZoom2;
61377       var service = getService();
61378       var sequences = [];
61379       var images = [];
61380       sequences = service ? service.sequences(projection2) : [];
61381       images = service && showMarkers ? service.images(projection2) : [];
61382       dispatch14.call("photoDatesChanged", this, "kartaview", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
61383       sequences = filterSequences(sequences);
61384       images = filterImages(images);
61385       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61386         return d2.properties.key;
61387       });
61388       traces.exit().remove();
61389       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61390       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61391         return d2.key;
61392       });
61393       groups.exit().remove();
61394       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61395       groupsEnter.append("g").attr("class", "viewfield-scale");
61396       var markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61397         return a4 === selected ? 1 : b3 === selected ? -1 : b3.loc[1] - a4.loc[1];
61398       }).attr("transform", transform2).select(".viewfield-scale");
61399       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61400       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61401       viewfields.exit().remove();
61402       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");
61403     }
61404     function drawImages(selection2) {
61405       var enabled = svgKartaviewImages.enabled, service = getService();
61406       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
61407       layer.exit().remove();
61408       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
61409       layerEnter.append("g").attr("class", "sequences");
61410       layerEnter.append("g").attr("class", "markers");
61411       layer = layerEnter.merge(layer);
61412       if (enabled) {
61413         if (service && ~~context.map().zoom() >= minZoom5) {
61414           editOn();
61415           update();
61416           service.loadImages(projection2);
61417         } else {
61418           dispatch14.call("photoDatesChanged", this, "kartaview", []);
61419           editOff();
61420         }
61421       } else {
61422         dispatch14.call("photoDatesChanged", this, "kartaview", []);
61423       }
61424     }
61425     drawImages.enabled = function(_3) {
61426       if (!arguments.length) return svgKartaviewImages.enabled;
61427       svgKartaviewImages.enabled = _3;
61428       if (svgKartaviewImages.enabled) {
61429         showLayer();
61430         context.photos().on("change.kartaview_images", update);
61431       } else {
61432         hideLayer();
61433         context.photos().on("change.kartaview_images", null);
61434       }
61435       dispatch14.call("change");
61436       return this;
61437     };
61438     drawImages.supported = function() {
61439       return !!getService();
61440     };
61441     drawImages.rendered = function(zoom) {
61442       return zoom >= minZoom5;
61443     };
61444     init2();
61445     return drawImages;
61446   }
61447   var init_kartaview_images = __esm({
61448     "modules/svg/kartaview_images.js"() {
61449       "use strict";
61450       init_throttle();
61451       init_src5();
61452       init_helpers();
61453       init_services();
61454     }
61455   });
61456
61457   // modules/svg/mapilio_images.js
61458   var mapilio_images_exports = {};
61459   __export(mapilio_images_exports, {
61460     svgMapilioImages: () => svgMapilioImages
61461   });
61462   function svgMapilioImages(projection2, context, dispatch14) {
61463     const throttledRedraw = throttle_default(function() {
61464       dispatch14.call("change");
61465     }, 1e3);
61466     const imageMinZoom2 = 16;
61467     const lineMinZoom2 = 10;
61468     const viewFieldZoomLevel = 18;
61469     let layer = select_default2(null);
61470     let _mapilio;
61471     let _viewerYaw = 0;
61472     function init2() {
61473       if (svgMapilioImages.initialized) return;
61474       svgMapilioImages.enabled = false;
61475       svgMapilioImages.initialized = true;
61476     }
61477     function getService() {
61478       if (services.mapilio && !_mapilio) {
61479         _mapilio = services.mapilio;
61480         _mapilio.event.on("loadedImages", throttledRedraw).on("loadedLines", throttledRedraw);
61481       } else if (!services.mapilio && _mapilio) {
61482         _mapilio = null;
61483       }
61484       return _mapilio;
61485     }
61486     function filterImages(images) {
61487       var fromDate = context.photos().fromDate();
61488       var toDate = context.photos().toDate();
61489       if (fromDate) {
61490         images = images.filter(function(image) {
61491           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61492         });
61493       }
61494       if (toDate) {
61495         images = images.filter(function(image) {
61496           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61497         });
61498       }
61499       return images;
61500     }
61501     function filterSequences(sequences) {
61502       var fromDate = context.photos().fromDate();
61503       var toDate = context.photos().toDate();
61504       if (fromDate) {
61505         sequences = sequences.filter(function(sequence) {
61506           return new Date(sequence.properties.capture_time).getTime() >= new Date(fromDate).getTime().toString();
61507         });
61508       }
61509       if (toDate) {
61510         sequences = sequences.filter(function(sequence) {
61511           return new Date(sequence.properties.capture_time).getTime() <= new Date(toDate).getTime().toString();
61512         });
61513       }
61514       return sequences;
61515     }
61516     function showLayer() {
61517       const service = getService();
61518       if (!service) return;
61519       editOn();
61520       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61521         dispatch14.call("change");
61522       });
61523     }
61524     function hideLayer() {
61525       throttledRedraw.cancel();
61526       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61527     }
61528     function transform2(d2, selectedImageId) {
61529       let t2 = svgPointTransform(projection2)(d2);
61530       let rot = d2.heading || 0;
61531       if (d2.id === selectedImageId) {
61532         rot += _viewerYaw;
61533       }
61534       if (rot) {
61535         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61536       }
61537       return t2;
61538     }
61539     function editOn() {
61540       layer.style("display", "block");
61541     }
61542     function editOff() {
61543       layer.selectAll(".viewfield-group").remove();
61544       layer.style("display", "none");
61545     }
61546     function click(d3_event, image) {
61547       const service = getService();
61548       if (!service) return;
61549       service.ensureViewerLoaded(context, image.id).then(() => {
61550         service.selectImage(context, image.id).showViewer(context);
61551       });
61552       context.map().centerEase(image.loc);
61553     }
61554     function mouseover(d3_event, image) {
61555       const service = getService();
61556       if (service) service.setStyles(context, image);
61557     }
61558     function mouseout() {
61559       const service = getService();
61560       if (service) service.setStyles(context, null);
61561     }
61562     async function update() {
61563       var _a4;
61564       const zoom = ~~context.map().zoom();
61565       const showViewfields = zoom >= viewFieldZoomLevel;
61566       const service = getService();
61567       let sequences = service ? service.sequences(projection2, zoom) : [];
61568       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61569       dispatch14.call("photoDatesChanged", this, "mapilio", [
61570         ...images.map((p2) => p2.capture_time),
61571         ...sequences.map((s2) => s2.properties.capture_time)
61572       ]);
61573       images = await filterImages(images);
61574       sequences = await filterSequences(sequences, service);
61575       const activeImage = (_a4 = service.getActiveImage) == null ? void 0 : _a4.call(service);
61576       const activeImageId = activeImage ? activeImage.id : null;
61577       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61578         return d2.properties.id;
61579       });
61580       traces.exit().remove();
61581       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61582       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61583         return d2.id;
61584       });
61585       groups.exit().remove();
61586       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61587       groupsEnter.append("g").attr("class", "viewfield-scale");
61588       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61589         if (a4.id === activeImageId) return 1;
61590         if (b3.id === activeImageId) return -1;
61591         return a4.capture_time_parsed - b3.capture_time_parsed;
61592       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61593       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61594       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61595       viewfields.exit().remove();
61596       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61597       service.setStyles(context, null);
61598       function viewfieldPath() {
61599         if (this.parentNode.__data__.isPano) {
61600           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61601         } else {
61602           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61603         }
61604       }
61605     }
61606     function drawImages(selection2) {
61607       const enabled = svgMapilioImages.enabled;
61608       const service = getService();
61609       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
61610       layer.exit().remove();
61611       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
61612       layerEnter.append("g").attr("class", "sequences");
61613       layerEnter.append("g").attr("class", "markers");
61614       layer = layerEnter.merge(layer);
61615       if (enabled) {
61616         let zoom = ~~context.map().zoom();
61617         if (service) {
61618           if (zoom >= imageMinZoom2) {
61619             editOn();
61620             update();
61621             service.loadImages(projection2);
61622             service.loadLines(projection2, zoom);
61623           } else if (zoom >= lineMinZoom2) {
61624             editOn();
61625             update();
61626             service.loadImages(projection2);
61627             service.loadLines(projection2, zoom);
61628           } else {
61629             editOff();
61630             dispatch14.call("photoDatesChanged", this, "mapilio", []);
61631             service.selectImage(context, null);
61632           }
61633         } else {
61634           editOff();
61635         }
61636       } else {
61637         dispatch14.call("photoDatesChanged", this, "mapilio", []);
61638       }
61639     }
61640     drawImages.enabled = function(_3) {
61641       if (!arguments.length) return svgMapilioImages.enabled;
61642       svgMapilioImages.enabled = _3;
61643       if (svgMapilioImages.enabled) {
61644         showLayer();
61645         context.photos().on("change.mapilio_images", update);
61646       } else {
61647         hideLayer();
61648         context.photos().on("change.mapilio_images", null);
61649       }
61650       dispatch14.call("change");
61651       return this;
61652     };
61653     drawImages.supported = function() {
61654       return !!getService();
61655     };
61656     drawImages.rendered = function(zoom) {
61657       return zoom >= lineMinZoom2;
61658     };
61659     init2();
61660     return drawImages;
61661   }
61662   var init_mapilio_images = __esm({
61663     "modules/svg/mapilio_images.js"() {
61664       "use strict";
61665       init_throttle();
61666       init_src5();
61667       init_services();
61668       init_helpers();
61669     }
61670   });
61671
61672   // modules/svg/panoramax_images.js
61673   var panoramax_images_exports = {};
61674   __export(panoramax_images_exports, {
61675     svgPanoramaxImages: () => svgPanoramaxImages
61676   });
61677   function svgPanoramaxImages(projection2, context, dispatch14) {
61678     const throttledRedraw = throttle_default(function() {
61679       dispatch14.call("change");
61680     }, 1e3);
61681     const imageMinZoom2 = 15;
61682     const lineMinZoom2 = 10;
61683     const viewFieldZoomLevel = 18;
61684     let layer = select_default2(null);
61685     let _panoramax;
61686     let _viewerYaw = 0;
61687     let _activeUsernameFilter;
61688     let _activeIds;
61689     function init2() {
61690       if (svgPanoramaxImages.initialized) return;
61691       svgPanoramaxImages.enabled = false;
61692       svgPanoramaxImages.initialized = true;
61693     }
61694     function getService() {
61695       if (services.panoramax && !_panoramax) {
61696         _panoramax = services.panoramax;
61697         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
61698       } else if (!services.panoramax && _panoramax) {
61699         _panoramax = null;
61700       }
61701       return _panoramax;
61702     }
61703     async function filterImages(images) {
61704       const showsPano = context.photos().showsPanoramic();
61705       const showsFlat = context.photos().showsFlat();
61706       const fromDate = context.photos().fromDate();
61707       const toDate = context.photos().toDate();
61708       const username = context.photos().usernames();
61709       const service = getService();
61710       if (!showsPano || !showsFlat) {
61711         images = images.filter(function(image) {
61712           if (image.isPano) return showsPano;
61713           return showsFlat;
61714         });
61715       }
61716       if (fromDate) {
61717         images = images.filter(function(image) {
61718           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
61719         });
61720       }
61721       if (toDate) {
61722         images = images.filter(function(image) {
61723           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
61724         });
61725       }
61726       if (username && service) {
61727         if (_activeUsernameFilter !== username) {
61728           _activeUsernameFilter = username;
61729           const tempIds = await service.getUserIds(username);
61730           _activeIds = {};
61731           tempIds.forEach((id2) => {
61732             _activeIds[id2] = true;
61733           });
61734         }
61735         images = images.filter(function(image) {
61736           return _activeIds[image.account_id];
61737         });
61738       }
61739       return images;
61740     }
61741     async function filterSequences(sequences) {
61742       const showsPano = context.photos().showsPanoramic();
61743       const showsFlat = context.photos().showsFlat();
61744       const fromDate = context.photos().fromDate();
61745       const toDate = context.photos().toDate();
61746       const username = context.photos().usernames();
61747       const service = getService();
61748       if (!showsPano || !showsFlat) {
61749         sequences = sequences.filter(function(sequence) {
61750           if (sequence.properties.type === "equirectangular") return showsPano;
61751           return showsFlat;
61752         });
61753       }
61754       if (fromDate) {
61755         sequences = sequences.filter(function(sequence) {
61756           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
61757         });
61758       }
61759       if (toDate) {
61760         sequences = sequences.filter(function(sequence) {
61761           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
61762         });
61763       }
61764       if (username && service) {
61765         if (_activeUsernameFilter !== username) {
61766           _activeUsernameFilter = username;
61767           const tempIds = await service.getUserIds(username);
61768           _activeIds = {};
61769           tempIds.forEach((id2) => {
61770             _activeIds[id2] = true;
61771           });
61772         }
61773         sequences = sequences.filter(function(sequence) {
61774           return _activeIds[sequence.properties.account_id];
61775         });
61776       }
61777       return sequences;
61778     }
61779     function showLayer() {
61780       const service = getService();
61781       if (!service) return;
61782       editOn();
61783       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
61784         dispatch14.call("change");
61785       });
61786     }
61787     function hideLayer() {
61788       throttledRedraw.cancel();
61789       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
61790     }
61791     function transform2(d2, selectedImageId) {
61792       let t2 = svgPointTransform(projection2)(d2);
61793       let rot = d2.heading;
61794       if (d2.id === selectedImageId) {
61795         rot += _viewerYaw;
61796       }
61797       if (rot) {
61798         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
61799       }
61800       return t2;
61801     }
61802     function editOn() {
61803       layer.style("display", "block");
61804     }
61805     function editOff() {
61806       layer.selectAll(".viewfield-group").remove();
61807       layer.style("display", "none");
61808     }
61809     function click(d3_event, image) {
61810       const service = getService();
61811       if (!service) return;
61812       service.ensureViewerLoaded(context).then(function() {
61813         service.selectImage(context, image.id).showViewer(context);
61814       });
61815       context.map().centerEase(image.loc);
61816     }
61817     function mouseover(d3_event, image) {
61818       const service = getService();
61819       if (service) service.setStyles(context, image);
61820     }
61821     function mouseout() {
61822       const service = getService();
61823       if (service) service.setStyles(context, null);
61824     }
61825     async function update() {
61826       var _a4;
61827       const zoom = ~~context.map().zoom();
61828       const showViewfields = zoom >= viewFieldZoomLevel;
61829       const service = getService();
61830       let sequences = service ? service.sequences(projection2, zoom) : [];
61831       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
61832       dispatch14.call("photoDatesChanged", this, "panoramax", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.date)]);
61833       images = await filterImages(images);
61834       sequences = await filterSequences(sequences, service);
61835       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
61836         return d2.properties.id;
61837       });
61838       traces.exit().remove();
61839       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
61840       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
61841         return d2.id;
61842       });
61843       groups.exit().remove();
61844       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
61845       groupsEnter.append("g").attr("class", "viewfield-scale");
61846       const activeImageId = (_a4 = service.getActiveImage()) == null ? void 0 : _a4.id;
61847       const markers = groups.merge(groupsEnter).sort(function(a4, b3) {
61848         if (a4.id === activeImageId) return 1;
61849         if (b3.id === activeImageId) return -1;
61850         return a4.capture_time_parsed - b3.capture_time_parsed;
61851       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
61852       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
61853       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
61854       viewfields.exit().remove();
61855       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
61856       service.setStyles(context, null);
61857       function viewfieldPath() {
61858         if (this.parentNode.__data__.isPano) {
61859           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
61860         } else {
61861           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
61862         }
61863       }
61864     }
61865     function viewerChanged() {
61866       const service = getService();
61867       if (!service) return;
61868       const frame2 = service.photoFrame();
61869       if (!frame2) return;
61870       _viewerYaw = frame2.getYaw();
61871       if (context.map().isTransformed()) return;
61872       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
61873     }
61874     function drawImages(selection2) {
61875       const enabled = svgPanoramaxImages.enabled;
61876       const service = getService();
61877       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
61878       layer.exit().remove();
61879       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
61880       layerEnter.append("g").attr("class", "sequences");
61881       layerEnter.append("g").attr("class", "markers");
61882       layer = layerEnter.merge(layer);
61883       if (enabled) {
61884         let zoom = ~~context.map().zoom();
61885         if (service) {
61886           if (zoom >= imageMinZoom2) {
61887             editOn();
61888             update();
61889             service.loadImages(projection2);
61890           } else if (zoom >= lineMinZoom2) {
61891             editOn();
61892             update();
61893             service.loadLines(projection2, zoom);
61894           } else {
61895             editOff();
61896             dispatch14.call("photoDatesChanged", this, "panoramax", []);
61897           }
61898         } else {
61899           editOff();
61900         }
61901       } else {
61902         dispatch14.call("photoDatesChanged", this, "panoramax", []);
61903       }
61904     }
61905     drawImages.enabled = function(_3) {
61906       if (!arguments.length) return svgPanoramaxImages.enabled;
61907       svgPanoramaxImages.enabled = _3;
61908       if (svgPanoramaxImages.enabled) {
61909         showLayer();
61910         context.photos().on("change.panoramax_images", update);
61911       } else {
61912         hideLayer();
61913         context.photos().on("change.panoramax_images", null);
61914       }
61915       dispatch14.call("change");
61916       return this;
61917     };
61918     drawImages.supported = function() {
61919       return !!getService();
61920     };
61921     drawImages.rendered = function(zoom) {
61922       return zoom >= lineMinZoom2;
61923     };
61924     init2();
61925     return drawImages;
61926   }
61927   var init_panoramax_images = __esm({
61928     "modules/svg/panoramax_images.js"() {
61929       "use strict";
61930       init_throttle();
61931       init_src5();
61932       init_services();
61933       init_helpers();
61934     }
61935   });
61936
61937   // modules/svg/osm.js
61938   var osm_exports3 = {};
61939   __export(osm_exports3, {
61940     svgOsm: () => svgOsm
61941   });
61942   function svgOsm(projection2, context, dispatch14) {
61943     var enabled = true;
61944     function drawOsm(selection2) {
61945       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
61946         return "layer-osm " + d2;
61947       });
61948       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["vertices", "midpoints", "points", "turns"]).enter().append("g").attr("class", function(d2) {
61949         return "points-group " + d2;
61950       });
61951     }
61952     function showLayer() {
61953       var layer = context.surface().selectAll(".data-layer.osm");
61954       layer.interrupt();
61955       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
61956         dispatch14.call("change");
61957       });
61958     }
61959     function hideLayer() {
61960       var layer = context.surface().selectAll(".data-layer.osm");
61961       layer.interrupt();
61962       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
61963         layer.classed("disabled", true);
61964         dispatch14.call("change");
61965       });
61966     }
61967     drawOsm.enabled = function(val) {
61968       if (!arguments.length) return enabled;
61969       enabled = val;
61970       if (enabled) {
61971         showLayer();
61972       } else {
61973         hideLayer();
61974       }
61975       dispatch14.call("change");
61976       return this;
61977     };
61978     return drawOsm;
61979   }
61980   var init_osm3 = __esm({
61981     "modules/svg/osm.js"() {
61982       "use strict";
61983     }
61984   });
61985
61986   // modules/svg/notes.js
61987   var notes_exports = {};
61988   __export(notes_exports, {
61989     svgNotes: () => svgNotes
61990   });
61991   function svgNotes(projection2, context, dispatch14) {
61992     if (!dispatch14) {
61993       dispatch14 = dispatch_default("change");
61994     }
61995     var throttledRedraw = throttle_default(function() {
61996       dispatch14.call("change");
61997     }, 1e3);
61998     var minZoom5 = 12;
61999     var touchLayer = select_default2(null);
62000     var drawLayer = select_default2(null);
62001     var _notesVisible = false;
62002     function markerPath(selection2, klass) {
62003       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");
62004     }
62005     function getService() {
62006       if (services.osm && !_osmService) {
62007         _osmService = services.osm;
62008         _osmService.on("loadedNotes", throttledRedraw);
62009       } else if (!services.osm && _osmService) {
62010         _osmService = null;
62011       }
62012       return _osmService;
62013     }
62014     function editOn() {
62015       if (!_notesVisible) {
62016         _notesVisible = true;
62017         drawLayer.style("display", "block");
62018       }
62019     }
62020     function editOff() {
62021       if (_notesVisible) {
62022         _notesVisible = false;
62023         drawLayer.style("display", "none");
62024         drawLayer.selectAll(".note").remove();
62025         touchLayer.selectAll(".note").remove();
62026       }
62027     }
62028     function layerOn() {
62029       editOn();
62030       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
62031         dispatch14.call("change");
62032       });
62033     }
62034     function layerOff() {
62035       throttledRedraw.cancel();
62036       drawLayer.interrupt();
62037       touchLayer.selectAll(".note").remove();
62038       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
62039         editOff();
62040         dispatch14.call("change");
62041       });
62042     }
62043     function updateMarkers() {
62044       if (!_notesVisible || !_notesEnabled) return;
62045       var service = getService();
62046       var selectedID = context.selectedNoteID();
62047       var data = service ? service.notes(projection2) : [];
62048       var getTransform = svgPointTransform(projection2);
62049       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
62050         return d2.status + d2.id;
62051       });
62052       notes.exit().remove();
62053       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
62054         return "note note-" + d2.id + " " + d2.status;
62055       }).classed("new", function(d2) {
62056         return d2.id < 0;
62057       });
62058       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62059       notesEnter.append("path").call(markerPath, "shadow");
62060       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");
62061       notesEnter.selectAll(".icon-annotation").data(function(d2) {
62062         return [d2];
62063       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
62064         if (d2.id < 0) return "#iD-icon-plus";
62065         if (d2.status === "open") return "#iD-icon-close";
62066         return "#iD-icon-apply";
62067       });
62068       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
62069         var mode = context.mode();
62070         var isMoving = mode && mode.id === "drag-note";
62071         return !isMoving && d2.id === selectedID;
62072       }).attr("transform", getTransform);
62073       if (touchLayer.empty()) return;
62074       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62075       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
62076         return d2.id;
62077       });
62078       targets.exit().remove();
62079       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
62080         var newClass = d2.id < 0 ? "new" : "";
62081         return "note target note-" + d2.id + " " + fillClass + newClass;
62082       }).attr("transform", getTransform);
62083       function sortY(a4, b3) {
62084         if (a4.id === selectedID) return 1;
62085         if (b3.id === selectedID) return -1;
62086         return b3.loc[1] - a4.loc[1];
62087       }
62088     }
62089     function drawNotes(selection2) {
62090       var service = getService();
62091       var surface = context.surface();
62092       if (surface && !surface.empty()) {
62093         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
62094       }
62095       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
62096       drawLayer.exit().remove();
62097       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
62098       if (_notesEnabled) {
62099         if (service && ~~context.map().zoom() >= minZoom5) {
62100           editOn();
62101           service.loadNotes(projection2);
62102           updateMarkers();
62103         } else {
62104           editOff();
62105         }
62106       }
62107     }
62108     drawNotes.enabled = function(val) {
62109       if (!arguments.length) return _notesEnabled;
62110       _notesEnabled = val;
62111       if (_notesEnabled) {
62112         layerOn();
62113       } else {
62114         layerOff();
62115         if (context.selectedNoteID()) {
62116           context.enter(modeBrowse(context));
62117         }
62118       }
62119       dispatch14.call("change");
62120       return this;
62121     };
62122     return drawNotes;
62123   }
62124   var hash, _notesEnabled, _osmService;
62125   var init_notes = __esm({
62126     "modules/svg/notes.js"() {
62127       "use strict";
62128       init_throttle();
62129       init_src5();
62130       init_src4();
62131       init_browse();
62132       init_helpers();
62133       init_services();
62134       init_util();
62135       hash = utilStringQs(window.location.hash);
62136       _notesEnabled = !!hash.notes;
62137     }
62138   });
62139
62140   // modules/svg/touch.js
62141   var touch_exports = {};
62142   __export(touch_exports, {
62143     svgTouch: () => svgTouch
62144   });
62145   function svgTouch() {
62146     function drawTouch(selection2) {
62147       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
62148         return "layer-touch " + d2;
62149       });
62150     }
62151     return drawTouch;
62152   }
62153   var init_touch = __esm({
62154     "modules/svg/touch.js"() {
62155       "use strict";
62156     }
62157   });
62158
62159   // modules/util/dimensions.js
62160   var dimensions_exports = {};
62161   __export(dimensions_exports, {
62162     utilGetDimensions: () => utilGetDimensions,
62163     utilSetDimensions: () => utilSetDimensions
62164   });
62165   function refresh(selection2, node) {
62166     var cr = node.getBoundingClientRect();
62167     var prop = [cr.width, cr.height];
62168     selection2.property("__dimensions__", prop);
62169     return prop;
62170   }
62171   function utilGetDimensions(selection2, force) {
62172     if (!selection2 || selection2.empty()) {
62173       return [0, 0];
62174     }
62175     var node = selection2.node(), cached = selection2.property("__dimensions__");
62176     return !cached || force ? refresh(selection2, node) : cached;
62177   }
62178   function utilSetDimensions(selection2, dimensions) {
62179     if (!selection2 || selection2.empty()) {
62180       return selection2;
62181     }
62182     var node = selection2.node();
62183     if (dimensions === null) {
62184       refresh(selection2, node);
62185       return selection2;
62186     }
62187     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
62188   }
62189   var init_dimensions = __esm({
62190     "modules/util/dimensions.js"() {
62191       "use strict";
62192     }
62193   });
62194
62195   // modules/svg/layers.js
62196   var layers_exports = {};
62197   __export(layers_exports, {
62198     svgLayers: () => svgLayers
62199   });
62200   function svgLayers(projection2, context) {
62201     var dispatch14 = dispatch_default("change", "photoDatesChanged");
62202     var svg2 = select_default2(null);
62203     var _layers = [
62204       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
62205       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
62206       { id: "data", layer: svgData(projection2, context, dispatch14) },
62207       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
62208       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
62209       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
62210       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
62211       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
62212       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
62213       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
62214       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
62215       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
62216       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
62217       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
62218       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
62219       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
62220       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
62221       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
62222     ];
62223     function drawLayers(selection2) {
62224       svg2 = selection2.selectAll(".surface").data([0]);
62225       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
62226       var defs = svg2.selectAll(".surface-defs").data([0]);
62227       defs.enter().append("defs").attr("class", "surface-defs");
62228       var groups = svg2.selectAll(".data-layer").data(_layers);
62229       groups.exit().remove();
62230       groups.enter().append("g").attr("class", function(d2) {
62231         return "data-layer " + d2.id;
62232       }).merge(groups).each(function(d2) {
62233         select_default2(this).call(d2.layer);
62234       });
62235     }
62236     drawLayers.all = function() {
62237       return _layers;
62238     };
62239     drawLayers.layer = function(id2) {
62240       var obj = _layers.find(function(o2) {
62241         return o2.id === id2;
62242       });
62243       return obj && obj.layer;
62244     };
62245     drawLayers.only = function(what) {
62246       var arr = [].concat(what);
62247       var all = _layers.map(function(layer) {
62248         return layer.id;
62249       });
62250       return drawLayers.remove(utilArrayDifference(all, arr));
62251     };
62252     drawLayers.remove = function(what) {
62253       var arr = [].concat(what);
62254       arr.forEach(function(id2) {
62255         _layers = _layers.filter(function(o2) {
62256           return o2.id !== id2;
62257         });
62258       });
62259       dispatch14.call("change");
62260       return this;
62261     };
62262     drawLayers.add = function(what) {
62263       var arr = [].concat(what);
62264       arr.forEach(function(obj) {
62265         if ("id" in obj && "layer" in obj) {
62266           _layers.push(obj);
62267         }
62268       });
62269       dispatch14.call("change");
62270       return this;
62271     };
62272     drawLayers.dimensions = function(val) {
62273       if (!arguments.length) return utilGetDimensions(svg2);
62274       utilSetDimensions(svg2, val);
62275       return this;
62276     };
62277     return utilRebind(drawLayers, dispatch14, "on");
62278   }
62279   var init_layers = __esm({
62280     "modules/svg/layers.js"() {
62281       "use strict";
62282       init_src4();
62283       init_src5();
62284       init_data2();
62285       init_local_photos();
62286       init_debug();
62287       init_geolocate();
62288       init_keepRight2();
62289       init_osmose2();
62290       init_streetside2();
62291       init_vegbilder2();
62292       init_mapillary_images();
62293       init_mapillary_position();
62294       init_mapillary_signs();
62295       init_mapillary_map_features();
62296       init_kartaview_images();
62297       init_mapilio_images();
62298       init_panoramax_images();
62299       init_osm3();
62300       init_notes();
62301       init_touch();
62302       init_util();
62303       init_dimensions();
62304     }
62305   });
62306
62307   // modules/svg/lines.js
62308   var lines_exports = {};
62309   __export(lines_exports, {
62310     svgLines: () => svgLines
62311   });
62312   function onewayArrowColour(tags) {
62313     if (tags.highway === "construction" && tags.bridge) return "white";
62314     if (tags.highway === "pedestrian") return "gray";
62315     if (tags.railway && !tags.highway) return "gray";
62316     if (tags.aeroway === "runway") return "white";
62317     return "black";
62318   }
62319   function svgLines(projection2, context) {
62320     var detected = utilDetect();
62321     var highway_stack = {
62322       motorway: 0,
62323       motorway_link: 1,
62324       trunk: 2,
62325       trunk_link: 3,
62326       primary: 4,
62327       primary_link: 5,
62328       secondary: 6,
62329       tertiary: 7,
62330       unclassified: 8,
62331       residential: 9,
62332       service: 10,
62333       busway: 11,
62334       footway: 12
62335     };
62336     function drawTargets(selection2, graph, entities, filter2) {
62337       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
62338       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
62339       var getPath = svgPath(projection2).geojson;
62340       var activeID = context.activeID();
62341       var base = context.history().base();
62342       var data = { targets: [], nopes: [] };
62343       entities.forEach(function(way) {
62344         var features = svgSegmentWay(way, graph, activeID);
62345         data.targets.push.apply(data.targets, features.passive);
62346         data.nopes.push.apply(data.nopes, features.active);
62347       });
62348       var targetData = data.targets.filter(getPath);
62349       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
62350         return filter2(d2.properties.entity);
62351       }).data(targetData, function key(d2) {
62352         return d2.id;
62353       });
62354       targets.exit().remove();
62355       var segmentWasEdited = function(d2) {
62356         var wayID = d2.properties.entity.id;
62357         if (!base.entities[wayID] || !(0, import_fast_deep_equal7.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
62358           return false;
62359         }
62360         return d2.properties.nodes.some(function(n3) {
62361           return !base.entities[n3.id] || !(0, import_fast_deep_equal7.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
62362         });
62363       };
62364       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
62365         return "way line target target-allowed " + targetClass + d2.id;
62366       }).classed("segment-edited", segmentWasEdited);
62367       var nopeData = data.nopes.filter(getPath);
62368       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
62369         return filter2(d2.properties.entity);
62370       }).data(nopeData, function key(d2) {
62371         return d2.id;
62372       });
62373       nopes.exit().remove();
62374       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
62375         return "way line target target-nope " + nopeClass + d2.id;
62376       }).classed("segment-edited", segmentWasEdited);
62377     }
62378     function drawLines(selection2, graph, entities, filter2) {
62379       var base = context.history().base();
62380       function waystack(a4, b3) {
62381         var selected = context.selectedIDs();
62382         var scoreA = selected.indexOf(a4.id) !== -1 ? 20 : 0;
62383         var scoreB = selected.indexOf(b3.id) !== -1 ? 20 : 0;
62384         if (a4.tags.highway) {
62385           scoreA -= highway_stack[a4.tags.highway];
62386         }
62387         if (b3.tags.highway) {
62388           scoreB -= highway_stack[b3.tags.highway];
62389         }
62390         return scoreA - scoreB;
62391       }
62392       function drawLineGroup(selection3, klass, isSelected) {
62393         var mode = context.mode();
62394         var isDrawing = mode && /^draw/.test(mode.id);
62395         var selectedClass = !isDrawing && isSelected ? "selected " : "";
62396         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
62397         lines.exit().remove();
62398         lines.enter().append("path").attr("class", function(d2) {
62399           var prefix = "way line";
62400           if (!d2.hasInterestingTags()) {
62401             var parentRelations = graph.parentRelations(d2);
62402             var parentMultipolygons = parentRelations.filter(function(relation) {
62403               return relation.isMultipolygon();
62404             });
62405             if (parentMultipolygons.length > 0 && // and only multipolygon relations
62406             parentRelations.length === parentMultipolygons.length) {
62407               prefix = "relation area";
62408             }
62409           }
62410           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
62411           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
62412         }).classed("added", function(d2) {
62413           return !base.entities[d2.id];
62414         }).classed("geometry-edited", function(d2) {
62415           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
62416         }).classed("retagged", function(d2) {
62417           return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
62418         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
62419         return selection3;
62420       }
62421       function getPathData(isSelected) {
62422         return function() {
62423           var layer = this.parentNode.__data__;
62424           var data = pathdata[layer] || [];
62425           return data.filter(function(d2) {
62426             if (isSelected) {
62427               return context.selectedIDs().indexOf(d2.id) !== -1;
62428             } else {
62429               return context.selectedIDs().indexOf(d2.id) === -1;
62430             }
62431           });
62432         };
62433       }
62434       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
62435         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
62436         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
62437         var markers = markergroup.selectAll("path").filter(filter2).data(
62438           function data() {
62439             return groupdata[this.parentNode.__data__] || [];
62440           },
62441           function key(d2) {
62442             return [d2.id, d2.index];
62443           }
62444         );
62445         markers.exit().remove();
62446         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
62447           return d2.d;
62448         });
62449         if (detected.ie) {
62450           markers.each(function() {
62451             this.parentNode.insertBefore(this, this);
62452           });
62453         }
62454       }
62455       var getPath = svgPath(projection2, graph);
62456       var ways = [];
62457       var onewaydata = {};
62458       var sideddata = {};
62459       var oldMultiPolygonOuters = {};
62460       for (var i3 = 0; i3 < entities.length; i3++) {
62461         var entity = entities[i3];
62462         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
62463           ways.push(entity);
62464         }
62465       }
62466       ways = ways.filter(getPath);
62467       const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
62468       Object.keys(pathdata).forEach(function(k3) {
62469         var v3 = pathdata[k3];
62470         var onewayArr = v3.filter(function(d2) {
62471           return d2.isOneWay();
62472         });
62473         var onewaySegments = svgMarkerSegments(
62474           projection2,
62475           graph,
62476           36,
62477           (entity2) => entity2.isOneWayBackwards(),
62478           (entity2) => entity2.isBiDirectional()
62479         );
62480         onewaydata[k3] = utilArrayFlatten(onewayArr.map(onewaySegments));
62481         var sidedArr = v3.filter(function(d2) {
62482           return d2.isSided();
62483         });
62484         var sidedSegments = svgMarkerSegments(
62485           projection2,
62486           graph,
62487           30
62488         );
62489         sideddata[k3] = utilArrayFlatten(sidedArr.map(sidedSegments));
62490       });
62491       var covered = selection2.selectAll(".layer-osm.covered");
62492       var uncovered = selection2.selectAll(".layer-osm.lines");
62493       var touchLayer = selection2.selectAll(".layer-touch.lines");
62494       [covered, uncovered].forEach(function(selection3) {
62495         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
62496         var layergroup = selection3.selectAll("g.layergroup").data(range3);
62497         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
62498           return "layergroup layer" + String(d2);
62499         }).merge(layergroup);
62500         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
62501           return "linegroup line-" + d2;
62502         });
62503         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
62504         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
62505         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
62506         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
62507         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
62508         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
62509         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, (d2) => {
62510           const category = onewayArrowColour(graph.entity(d2.id).tags);
62511           return `url(#ideditor-oneway-marker-${category})`;
62512         });
62513         addMarkers(
62514           layergroup,
62515           "sided",
62516           "sidedgroup",
62517           sideddata,
62518           function marker(d2) {
62519             var category = graph.entity(d2.id).sidednessIdentifier();
62520             return "url(#ideditor-sided-marker-" + category + ")";
62521           }
62522         );
62523       });
62524       touchLayer.call(drawTargets, graph, ways, filter2);
62525     }
62526     return drawLines;
62527   }
62528   var import_fast_deep_equal7;
62529   var init_lines = __esm({
62530     "modules/svg/lines.js"() {
62531       "use strict";
62532       import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
62533       init_src();
62534       init_helpers();
62535       init_tag_classes();
62536       init_osm();
62537       init_util();
62538       init_detect();
62539     }
62540   });
62541
62542   // modules/svg/midpoints.js
62543   var midpoints_exports = {};
62544   __export(midpoints_exports, {
62545     svgMidpoints: () => svgMidpoints
62546   });
62547   function svgMidpoints(projection2, context) {
62548     var targetRadius = 8;
62549     function drawTargets(selection2, graph, entities, filter2) {
62550       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62551       var getTransform = svgPointTransform(projection2).geojson;
62552       var data = entities.map(function(midpoint) {
62553         return {
62554           type: "Feature",
62555           id: midpoint.id,
62556           properties: {
62557             target: true,
62558             entity: midpoint
62559           },
62560           geometry: {
62561             type: "Point",
62562             coordinates: midpoint.loc
62563           }
62564         };
62565       });
62566       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
62567         return filter2(d2.properties.entity);
62568       }).data(data, function key(d2) {
62569         return d2.id;
62570       });
62571       targets.exit().remove();
62572       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
62573         return "node midpoint target " + fillClass + d2.id;
62574       }).attr("transform", getTransform);
62575     }
62576     function drawMidpoints(selection2, graph, entities, filter2, extent) {
62577       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
62578       var touchLayer = selection2.selectAll(".layer-touch.points");
62579       var mode = context.mode();
62580       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
62581         drawLayer.selectAll(".midpoint").remove();
62582         touchLayer.selectAll(".midpoint.target").remove();
62583         return;
62584       }
62585       var poly = extent.polygon();
62586       var midpoints = {};
62587       for (var i3 = 0; i3 < entities.length; i3++) {
62588         var entity = entities[i3];
62589         if (entity.type !== "way") continue;
62590         if (!filter2(entity)) continue;
62591         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
62592         var nodes = graph.childNodes(entity);
62593         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
62594           var a4 = nodes[j3];
62595           var b3 = nodes[j3 + 1];
62596           var id2 = [a4.id, b3.id].sort().join("-");
62597           if (midpoints[id2]) {
62598             midpoints[id2].parents.push(entity);
62599           } else if (geoVecLength(projection2(a4.loc), projection2(b3.loc)) > 40) {
62600             var point = geoVecInterp(a4.loc, b3.loc, 0.5);
62601             var loc = null;
62602             if (extent.intersects(point)) {
62603               loc = point;
62604             } else {
62605               for (var k3 = 0; k3 < 4; k3++) {
62606                 point = geoLineIntersection([a4.loc, b3.loc], [poly[k3], poly[k3 + 1]]);
62607                 if (point && geoVecLength(projection2(a4.loc), projection2(point)) > 20 && geoVecLength(projection2(b3.loc), projection2(point)) > 20) {
62608                   loc = point;
62609                   break;
62610                 }
62611               }
62612             }
62613             if (loc) {
62614               midpoints[id2] = {
62615                 type: "midpoint",
62616                 id: id2,
62617                 loc,
62618                 edge: [a4.id, b3.id],
62619                 parents: [entity]
62620               };
62621             }
62622           }
62623         }
62624       }
62625       function midpointFilter(d2) {
62626         if (midpoints[d2.id]) return true;
62627         for (var i4 = 0; i4 < d2.parents.length; i4++) {
62628           if (filter2(d2.parents[i4])) {
62629             return true;
62630           }
62631         }
62632         return false;
62633       }
62634       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
62635         return d2.id;
62636       });
62637       groups.exit().remove();
62638       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
62639       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
62640       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
62641       groups = groups.merge(enter).attr("transform", function(d2) {
62642         var translate = svgPointTransform(projection2);
62643         var a5 = graph.entity(d2.edge[0]);
62644         var b4 = graph.entity(d2.edge[1]);
62645         var angle2 = geoAngle(a5, b4, projection2) * (180 / Math.PI);
62646         return translate(d2) + " rotate(" + angle2 + ")";
62647       }).call(svgTagClasses().tags(
62648         function(d2) {
62649           return d2.parents[0].tags;
62650         }
62651       ));
62652       groups.select("polygon.shadow");
62653       groups.select("polygon.fill");
62654       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
62655     }
62656     return drawMidpoints;
62657   }
62658   var init_midpoints = __esm({
62659     "modules/svg/midpoints.js"() {
62660       "use strict";
62661       init_helpers();
62662       init_tag_classes();
62663       init_geo2();
62664     }
62665   });
62666
62667   // node_modules/d3-axis/src/index.js
62668   var init_src19 = __esm({
62669     "node_modules/d3-axis/src/index.js"() {
62670     }
62671   });
62672
62673   // node_modules/d3-brush/src/constant.js
62674   var init_constant7 = __esm({
62675     "node_modules/d3-brush/src/constant.js"() {
62676     }
62677   });
62678
62679   // node_modules/d3-brush/src/event.js
62680   var init_event3 = __esm({
62681     "node_modules/d3-brush/src/event.js"() {
62682     }
62683   });
62684
62685   // node_modules/d3-brush/src/noevent.js
62686   var init_noevent3 = __esm({
62687     "node_modules/d3-brush/src/noevent.js"() {
62688     }
62689   });
62690
62691   // node_modules/d3-brush/src/brush.js
62692   function number1(e3) {
62693     return [+e3[0], +e3[1]];
62694   }
62695   function number22(e3) {
62696     return [number1(e3[0]), number1(e3[1])];
62697   }
62698   function type(t2) {
62699     return { type: t2 };
62700   }
62701   var abs2, max2, min2, X4, Y3, XY;
62702   var init_brush = __esm({
62703     "node_modules/d3-brush/src/brush.js"() {
62704       init_src11();
62705       init_constant7();
62706       init_event3();
62707       init_noevent3();
62708       ({ abs: abs2, max: max2, min: min2 } = Math);
62709       X4 = {
62710         name: "x",
62711         handles: ["w", "e"].map(type),
62712         input: function(x2, e3) {
62713           return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
62714         },
62715         output: function(xy) {
62716           return xy && [xy[0][0], xy[1][0]];
62717         }
62718       };
62719       Y3 = {
62720         name: "y",
62721         handles: ["n", "s"].map(type),
62722         input: function(y2, e3) {
62723           return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
62724         },
62725         output: function(xy) {
62726           return xy && [xy[0][1], xy[1][1]];
62727         }
62728       };
62729       XY = {
62730         name: "xy",
62731         handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
62732         input: function(xy) {
62733           return xy == null ? null : number22(xy);
62734         },
62735         output: function(xy) {
62736           return xy;
62737         }
62738       };
62739     }
62740   });
62741
62742   // node_modules/d3-brush/src/index.js
62743   var init_src20 = __esm({
62744     "node_modules/d3-brush/src/index.js"() {
62745       init_brush();
62746     }
62747   });
62748
62749   // node_modules/d3-path/src/index.js
62750   var init_src21 = __esm({
62751     "node_modules/d3-path/src/index.js"() {
62752     }
62753   });
62754
62755   // node_modules/d3-chord/src/index.js
62756   var init_src22 = __esm({
62757     "node_modules/d3-chord/src/index.js"() {
62758     }
62759   });
62760
62761   // node_modules/d3-contour/src/index.js
62762   var init_src23 = __esm({
62763     "node_modules/d3-contour/src/index.js"() {
62764     }
62765   });
62766
62767   // node_modules/d3-delaunay/src/index.js
62768   var init_src24 = __esm({
62769     "node_modules/d3-delaunay/src/index.js"() {
62770     }
62771   });
62772
62773   // node_modules/d3-quadtree/src/index.js
62774   var init_src25 = __esm({
62775     "node_modules/d3-quadtree/src/index.js"() {
62776     }
62777   });
62778
62779   // node_modules/d3-force/src/index.js
62780   var init_src26 = __esm({
62781     "node_modules/d3-force/src/index.js"() {
62782     }
62783   });
62784
62785   // node_modules/d3-hierarchy/src/index.js
62786   var init_src27 = __esm({
62787     "node_modules/d3-hierarchy/src/index.js"() {
62788     }
62789   });
62790
62791   // node_modules/d3-random/src/index.js
62792   var init_src28 = __esm({
62793     "node_modules/d3-random/src/index.js"() {
62794     }
62795   });
62796
62797   // node_modules/d3-scale-chromatic/src/index.js
62798   var init_src29 = __esm({
62799     "node_modules/d3-scale-chromatic/src/index.js"() {
62800     }
62801   });
62802
62803   // node_modules/d3-shape/src/index.js
62804   var init_src30 = __esm({
62805     "node_modules/d3-shape/src/index.js"() {
62806     }
62807   });
62808
62809   // node_modules/d3/src/index.js
62810   var init_src31 = __esm({
62811     "node_modules/d3/src/index.js"() {
62812       init_src();
62813       init_src19();
62814       init_src20();
62815       init_src22();
62816       init_src7();
62817       init_src23();
62818       init_src24();
62819       init_src4();
62820       init_src6();
62821       init_src17();
62822       init_src10();
62823       init_src18();
62824       init_src26();
62825       init_src13();
62826       init_src2();
62827       init_src27();
62828       init_src8();
62829       init_src21();
62830       init_src3();
62831       init_src25();
62832       init_src28();
62833       init_src16();
62834       init_src29();
62835       init_src5();
62836       init_src30();
62837       init_src14();
62838       init_src15();
62839       init_src9();
62840       init_src11();
62841       init_src12();
62842     }
62843   });
62844
62845   // modules/svg/points.js
62846   var points_exports = {};
62847   __export(points_exports, {
62848     svgPoints: () => svgPoints
62849   });
62850   function svgPoints(projection2, context) {
62851     function markerPath(selection2, klass) {
62852       selection2.attr("class", klass).attr("transform", (d2) => isAddressPoint(d2.tags) ? `translate(-${addressShieldWidth(d2, selection2) / 2}, -8)` : "translate(-8, -23)").attr("d", (d2) => {
62853         if (!isAddressPoint(d2.tags)) {
62854           return "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";
62855         }
62856         const w3 = addressShieldWidth(d2, selection2);
62857         return `M ${w3 - 3.5} 0 a 3.5 3.5 0 0 0 3.5 3.5 l 0 9 a 3.5 3.5 0 0 0 -3.5 3.5 l -${w3 - 7} 0 a 3.5 3.5 0 0 0 -3.5 -3.5 l 0 -9 a 3.5 3.5 0 0 0 3.5 -3.5 z`;
62858       });
62859     }
62860     function sortY(a4, b3) {
62861       return b3.loc[1] - a4.loc[1];
62862     }
62863     function addressShieldWidth(d2, selection2) {
62864       const width = textWidth(d2.tags["addr:housenumber"] || d2.tags["addr:housename"] || "", 10, selection2.node().parentElement);
62865       return clamp_default(width, 10, 34) + 8;
62866     }
62867     ;
62868     function fastEntityKey(d2) {
62869       const mode = context.mode();
62870       const isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
62871       return isMoving ? d2.id : osmEntity.key(d2);
62872     }
62873     function drawTargets(selection2, graph, entities, filter2) {
62874       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
62875       var getTransform = svgPointTransform(projection2).geojson;
62876       var activeID = context.activeID();
62877       var data = [];
62878       entities.forEach(function(node) {
62879         if (activeID === node.id) return;
62880         data.push({
62881           type: "Feature",
62882           id: node.id,
62883           properties: {
62884             target: true,
62885             entity: node,
62886             isAddr: isAddressPoint(node.tags)
62887           },
62888           geometry: node.asGeoJSON()
62889         });
62890       });
62891       var targets = selection2.selectAll(".point.target").filter((d2) => filter2(d2.properties.entity)).data(data, (d2) => fastEntityKey(d2.properties.entity));
62892       targets.exit().remove();
62893       targets.enter().append("rect").attr("x", (d2) => d2.properties.isAddr ? -addressShieldWidth(d2.properties.entity, selection2) / 2 : -10).attr("y", (d2) => d2.properties.isAddr ? -8 : -26).attr("width", (d2) => d2.properties.isAddr ? addressShieldWidth(d2.properties.entity, selection2) : 20).attr("height", (d2) => d2.properties.isAddr ? 16 : 30).attr("class", function(d2) {
62894         return "node point target " + fillClass + d2.id;
62895       }).merge(targets).attr("transform", getTransform);
62896     }
62897     function drawPoints(selection2, graph, entities, filter2) {
62898       var wireframe = context.surface().classed("fill-wireframe");
62899       var zoom = geoScaleToZoom(projection2.scale());
62900       var base = context.history().base();
62901       function renderAsPoint(entity) {
62902         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
62903       }
62904       var points = wireframe ? [] : entities.filter(renderAsPoint);
62905       points.sort(sortY);
62906       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
62907       var touchLayer = selection2.selectAll(".layer-touch.points");
62908       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
62909       groups.exit().remove();
62910       var enter = groups.enter().append("g").attr("class", function(d2) {
62911         return "node point " + d2.id;
62912       }).order();
62913       enter.append("path").call(markerPath, "shadow");
62914       enter.each(function(d2) {
62915         if (isAddressPoint(d2.tags)) return;
62916         select_default2(this).append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
62917       });
62918       enter.append("path").call(markerPath, "stroke");
62919       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
62920       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
62921         return !base.entities[d2.id];
62922       }).classed("moved", function(d2) {
62923         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
62924       }).classed("retagged", function(d2) {
62925         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
62926       }).call(svgTagClasses());
62927       groups.select(".shadow");
62928       groups.select(".stroke");
62929       groups.select(".icon").attr("xlink:href", function(entity) {
62930         var preset = _mainPresetIndex.match(entity, graph);
62931         var picon = preset && preset.icon;
62932         return picon ? "#" + picon : "";
62933       });
62934       touchLayer.call(drawTargets, graph, points, filter2);
62935     }
62936     return drawPoints;
62937   }
62938   var import_fast_deep_equal8;
62939   var init_points = __esm({
62940     "modules/svg/points.js"() {
62941       "use strict";
62942       import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
62943       init_lodash();
62944       init_src31();
62945       init_geo2();
62946       init_osm();
62947       init_helpers();
62948       init_tag_classes();
62949       init_presets();
62950       init_labels();
62951     }
62952   });
62953
62954   // modules/svg/turns.js
62955   var turns_exports = {};
62956   __export(turns_exports, {
62957     svgTurns: () => svgTurns
62958   });
62959   function svgTurns(projection2, context) {
62960     function icon2(turn) {
62961       var u2 = turn.u ? "-u" : "";
62962       if (turn.no) return "#iD-turn-no" + u2;
62963       if (turn.only) return "#iD-turn-only" + u2;
62964       return "#iD-turn-yes" + u2;
62965     }
62966     function drawTurns(selection2, graph, turns) {
62967       function turnTransform(d2) {
62968         var pxRadius = 50;
62969         var toWay = graph.entity(d2.to.way);
62970         var toPoints = graph.childNodes(toWay).map(function(n3) {
62971           return n3.loc;
62972         }).map(projection2);
62973         var toLength = geoPathLength(toPoints);
62974         var mid = toLength / 2;
62975         var toNode = graph.entity(d2.to.node);
62976         var toVertex = graph.entity(d2.to.vertex);
62977         var a4 = geoAngle(toVertex, toNode, projection2);
62978         var o2 = projection2(toVertex.loc);
62979         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
62980         return "translate(" + (r2 * Math.cos(a4) + o2[0]) + "," + (r2 * Math.sin(a4) + o2[1]) + ") rotate(" + a4 * 180 / Math.PI + ")";
62981       }
62982       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
62983       var touchLayer = selection2.selectAll(".layer-touch.turns");
62984       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
62985         return d2.key;
62986       });
62987       groups.exit().remove();
62988       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
62989         return "turn " + d2.key;
62990       });
62991       var turnsEnter = groupsEnter.filter(function(d2) {
62992         return !d2.u;
62993       });
62994       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
62995       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
62996       var uEnter = groupsEnter.filter(function(d2) {
62997         return d2.u;
62998       });
62999       uEnter.append("circle").attr("r", "16");
63000       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
63001       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
63002         return d2.direct === false ? "0.7" : null;
63003       }).attr("transform", turnTransform);
63004       groups.select("use").attr("xlink:href", icon2);
63005       groups.select("rect");
63006       groups.select("circle");
63007       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
63008       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
63009         return d2.key;
63010       });
63011       groups.exit().remove();
63012       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
63013         return "turn " + d2.key;
63014       });
63015       turnsEnter = groupsEnter.filter(function(d2) {
63016         return !d2.u;
63017       });
63018       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
63019       uEnter = groupsEnter.filter(function(d2) {
63020         return d2.u;
63021       });
63022       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
63023       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
63024       groups.select("rect");
63025       groups.select("circle");
63026       return this;
63027     }
63028     return drawTurns;
63029   }
63030   var init_turns = __esm({
63031     "modules/svg/turns.js"() {
63032       "use strict";
63033       init_geo2();
63034     }
63035   });
63036
63037   // modules/svg/vertices.js
63038   var vertices_exports = {};
63039   __export(vertices_exports, {
63040     svgVertices: () => svgVertices
63041   });
63042   function svgVertices(projection2, context) {
63043     var radiuses = {
63044       //       z16-, z17,   z18+,  w/icon
63045       shadow: [6, 7.5, 7.5, 12],
63046       stroke: [2.5, 3.5, 3.5, 8],
63047       fill: [1, 1.5, 1.5, 1.5]
63048     };
63049     var _currHoverTarget;
63050     var _currPersistent = {};
63051     var _currHover = {};
63052     var _prevHover = {};
63053     var _currSelected = {};
63054     var _prevSelected = {};
63055     var _radii = {};
63056     function sortY(a4, b3) {
63057       return b3.loc[1] - a4.loc[1];
63058     }
63059     function fastEntityKey(d2) {
63060       var mode = context.mode();
63061       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63062       return isMoving ? d2.id : osmEntity.key(d2);
63063     }
63064     function draw(selection2, graph, vertices, sets2, filter2) {
63065       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
63066       var icons = {};
63067       var directions = {};
63068       var wireframe = context.surface().classed("fill-wireframe");
63069       var zoom = geoScaleToZoom(projection2.scale());
63070       var z3 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
63071       var activeID = context.activeID();
63072       var base = context.history().base();
63073       function getIcon(d2) {
63074         var entity = graph.entity(d2.id);
63075         if (entity.id in icons) return icons[entity.id];
63076         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
63077         return icons[entity.id];
63078       }
63079       function getDirections(entity) {
63080         if (entity.id in directions) return directions[entity.id];
63081         var angles = entity.directions(graph, projection2);
63082         directions[entity.id] = angles.length ? angles : false;
63083         return angles;
63084       }
63085       function updateAttributes(selection3) {
63086         ["shadow", "stroke", "fill"].forEach(function(klass) {
63087           var rads = radiuses[klass];
63088           selection3.selectAll("." + klass).each(function(entity) {
63089             var i3 = z3 && getIcon(entity);
63090             var r2 = rads[i3 ? 3 : z3];
63091             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
63092               r2 += 1.5;
63093             }
63094             if (klass === "shadow") {
63095               _radii[entity.id] = r2;
63096             }
63097             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
63098           });
63099         });
63100       }
63101       vertices.sort(sortY);
63102       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
63103       groups.exit().remove();
63104       var enter = groups.enter().append("g").attr("class", function(d2) {
63105         return "node vertex " + d2.id;
63106       }).order();
63107       enter.append("circle").attr("class", "shadow");
63108       enter.append("circle").attr("class", "stroke");
63109       enter.filter(function(d2) {
63110         return d2.hasInterestingTags();
63111       }).append("circle").attr("class", "fill");
63112       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
63113         return d2.id in sets2.selected;
63114       }).classed("shared", function(d2) {
63115         return graph.isShared(d2);
63116       }).classed("endpoint", function(d2) {
63117         return d2.isEndpoint(graph);
63118       }).classed("added", function(d2) {
63119         return !base.entities[d2.id];
63120       }).classed("moved", function(d2) {
63121         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
63122       }).classed("retagged", function(d2) {
63123         return base.entities[d2.id] && !(0, import_fast_deep_equal9.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
63124       }).call(svgTagClasses()).call(updateAttributes);
63125       var iconUse = groups.selectAll(".icon").data(function data(d2) {
63126         return zoom >= 17 && getIcon(d2) ? [d2] : [];
63127       }, fastEntityKey);
63128       iconUse.exit().remove();
63129       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
63130         var picon = getIcon(d2);
63131         return picon ? "#" + picon : "";
63132       });
63133       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
63134         return zoom >= 18 && getDirections(d2) ? [d2] : [];
63135       }, fastEntityKey);
63136       dgroups.exit().remove();
63137       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
63138       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
63139         return osmEntity.key(d2);
63140       });
63141       viewfields.exit().remove();
63142       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(d2) {
63143         return "rotate(" + d2 + ")";
63144       });
63145     }
63146     function drawTargets(selection2, graph, entities, filter2) {
63147       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
63148       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
63149       var getTransform = svgPointTransform(projection2).geojson;
63150       var activeID = context.activeID();
63151       var data = { targets: [], nopes: [] };
63152       entities.forEach(function(node) {
63153         if (activeID === node.id) return;
63154         var vertexType = svgPassiveVertex(node, graph, activeID);
63155         if (vertexType !== 0) {
63156           data.targets.push({
63157             type: "Feature",
63158             id: node.id,
63159             properties: {
63160               target: true,
63161               entity: node
63162             },
63163             geometry: node.asGeoJSON()
63164           });
63165         } else {
63166           data.nopes.push({
63167             type: "Feature",
63168             id: node.id + "-nope",
63169             properties: {
63170               nope: true,
63171               target: true,
63172               entity: node
63173             },
63174             geometry: node.asGeoJSON()
63175           });
63176         }
63177       });
63178       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
63179         return filter2(d2.properties.entity);
63180       }).data(data.targets, function key(d2) {
63181         return d2.id;
63182       });
63183       targets.exit().remove();
63184       targets.enter().append("circle").attr("r", function(d2) {
63185         return _radii[d2.id] || radiuses.shadow[3];
63186       }).merge(targets).attr("class", function(d2) {
63187         return "node vertex target target-allowed " + targetClass + d2.id;
63188       }).attr("transform", getTransform);
63189       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
63190         return filter2(d2.properties.entity);
63191       }).data(data.nopes, function key(d2) {
63192         return d2.id;
63193       });
63194       nopes.exit().remove();
63195       nopes.enter().append("circle").attr("r", function(d2) {
63196         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
63197       }).merge(nopes).attr("class", function(d2) {
63198         return "node vertex target target-nope " + nopeClass + d2.id;
63199       }).attr("transform", getTransform);
63200     }
63201     function renderAsVertex(entity, graph, wireframe, zoom) {
63202       var geometry = entity.geometry(graph);
63203       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
63204     }
63205     function isEditedNode(node, base, head) {
63206       var baseNode = base.entities[node.id];
63207       var headNode = head.entities[node.id];
63208       return !headNode || !baseNode || !(0, import_fast_deep_equal9.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal9.default)(headNode.loc, baseNode.loc);
63209     }
63210     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
63211       var results = {};
63212       var seenIds = {};
63213       function addChildVertices(entity) {
63214         if (seenIds[entity.id]) return;
63215         seenIds[entity.id] = true;
63216         var geometry = entity.geometry(graph);
63217         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
63218           var i3;
63219           if (entity.type === "way") {
63220             for (i3 = 0; i3 < entity.nodes.length; i3++) {
63221               var child = graph.hasEntity(entity.nodes[i3]);
63222               if (child) {
63223                 addChildVertices(child);
63224               }
63225             }
63226           } else if (entity.type === "relation") {
63227             for (i3 = 0; i3 < entity.members.length; i3++) {
63228               var member = graph.hasEntity(entity.members[i3].id);
63229               if (member) {
63230                 addChildVertices(member);
63231               }
63232             }
63233           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
63234             results[entity.id] = entity;
63235           }
63236         }
63237       }
63238       ids.forEach(function(id2) {
63239         var entity = graph.hasEntity(id2);
63240         if (!entity) return;
63241         if (entity.type === "node") {
63242           if (renderAsVertex(entity, graph, wireframe, zoom)) {
63243             results[entity.id] = entity;
63244             graph.parentWays(entity).forEach(function(entity2) {
63245               addChildVertices(entity2);
63246             });
63247           }
63248         } else {
63249           addChildVertices(entity);
63250         }
63251       });
63252       return results;
63253     }
63254     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
63255       var wireframe = context.surface().classed("fill-wireframe");
63256       var visualDiff = context.surface().classed("highlight-edited");
63257       var zoom = geoScaleToZoom(projection2.scale());
63258       var mode = context.mode();
63259       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
63260       var base = context.history().base();
63261       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
63262       var touchLayer = selection2.selectAll(".layer-touch.points");
63263       if (fullRedraw) {
63264         _currPersistent = {};
63265         _radii = {};
63266       }
63267       for (var i3 = 0; i3 < entities.length; i3++) {
63268         var entity = entities[i3];
63269         var geometry = entity.geometry(graph);
63270         var keep = false;
63271         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
63272           _currPersistent[entity.id] = entity;
63273           keep = true;
63274         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
63275           _currPersistent[entity.id] = entity;
63276           keep = true;
63277         }
63278         if (!keep && !fullRedraw) {
63279           delete _currPersistent[entity.id];
63280         }
63281       }
63282       var sets2 = {
63283         persistent: _currPersistent,
63284         // persistent = important vertices (render always)
63285         selected: _currSelected,
63286         // selected + siblings of selected (render always)
63287         hovered: _currHover
63288         // hovered + siblings of hovered (render only in draw modes)
63289       };
63290       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
63291       var filterRendered = function(d2) {
63292         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
63293       };
63294       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
63295       var filterTouch = function(d2) {
63296         return isMoving ? true : filterRendered(d2);
63297       };
63298       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
63299       function currentVisible(which) {
63300         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
63301           return entity2 && entity2.intersects(extent, graph);
63302         });
63303       }
63304     }
63305     drawVertices.drawSelected = function(selection2, graph, extent) {
63306       var wireframe = context.surface().classed("fill-wireframe");
63307       var zoom = geoScaleToZoom(projection2.scale());
63308       _prevSelected = _currSelected || {};
63309       if (context.map().isInWideSelection()) {
63310         _currSelected = {};
63311         context.selectedIDs().forEach(function(id2) {
63312           var entity = graph.hasEntity(id2);
63313           if (!entity) return;
63314           if (entity.type === "node") {
63315             if (renderAsVertex(entity, graph, wireframe, zoom)) {
63316               _currSelected[entity.id] = entity;
63317             }
63318           }
63319         });
63320       } else {
63321         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
63322       }
63323       var filter2 = function(d2) {
63324         return d2.id in _prevSelected;
63325       };
63326       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
63327     };
63328     drawVertices.drawHover = function(selection2, graph, target, extent) {
63329       if (target === _currHoverTarget) return;
63330       var wireframe = context.surface().classed("fill-wireframe");
63331       var zoom = geoScaleToZoom(projection2.scale());
63332       _prevHover = _currHover || {};
63333       _currHoverTarget = target;
63334       var entity = target && target.properties && target.properties.entity;
63335       if (entity) {
63336         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
63337       } else {
63338         _currHover = {};
63339       }
63340       var filter2 = function(d2) {
63341         return d2.id in _prevHover;
63342       };
63343       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
63344     };
63345     return drawVertices;
63346   }
63347   var import_fast_deep_equal9;
63348   var init_vertices = __esm({
63349     "modules/svg/vertices.js"() {
63350       "use strict";
63351       import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
63352       init_src5();
63353       init_presets();
63354       init_geo2();
63355       init_osm();
63356       init_helpers();
63357       init_tag_classes();
63358     }
63359   });
63360
63361   // modules/svg/index.js
63362   var svg_exports = {};
63363   __export(svg_exports, {
63364     svgAreas: () => svgAreas,
63365     svgData: () => svgData,
63366     svgDebug: () => svgDebug,
63367     svgDefs: () => svgDefs,
63368     svgGeolocate: () => svgGeolocate,
63369     svgIcon: () => svgIcon,
63370     svgKartaviewImages: () => svgKartaviewImages,
63371     svgKeepRight: () => svgKeepRight,
63372     svgLabels: () => svgLabels,
63373     svgLayers: () => svgLayers,
63374     svgLines: () => svgLines,
63375     svgMapilioImages: () => svgMapilioImages,
63376     svgMapillaryImages: () => svgMapillaryImages,
63377     svgMapillarySigns: () => svgMapillarySigns,
63378     svgMarkerSegments: () => svgMarkerSegments,
63379     svgMidpoints: () => svgMidpoints,
63380     svgNotes: () => svgNotes,
63381     svgOsm: () => svgOsm,
63382     svgPanoramaxImages: () => svgPanoramaxImages,
63383     svgPassiveVertex: () => svgPassiveVertex,
63384     svgPath: () => svgPath,
63385     svgPointTransform: () => svgPointTransform,
63386     svgPoints: () => svgPoints,
63387     svgRelationMemberTags: () => svgRelationMemberTags,
63388     svgSegmentWay: () => svgSegmentWay,
63389     svgStreetside: () => svgStreetside,
63390     svgTagClasses: () => svgTagClasses,
63391     svgTagPattern: () => svgTagPattern,
63392     svgTouch: () => svgTouch,
63393     svgTurns: () => svgTurns,
63394     svgVegbilder: () => svgVegbilder,
63395     svgVertices: () => svgVertices
63396   });
63397   var init_svg = __esm({
63398     "modules/svg/index.js"() {
63399       "use strict";
63400       init_areas();
63401       init_data2();
63402       init_debug();
63403       init_defs();
63404       init_keepRight2();
63405       init_icon();
63406       init_geolocate();
63407       init_labels();
63408       init_layers();
63409       init_lines();
63410       init_mapillary_images();
63411       init_mapillary_signs();
63412       init_midpoints();
63413       init_notes();
63414       init_helpers();
63415       init_kartaview_images();
63416       init_osm3();
63417       init_helpers();
63418       init_helpers();
63419       init_helpers();
63420       init_points();
63421       init_helpers();
63422       init_helpers();
63423       init_streetside2();
63424       init_vegbilder2();
63425       init_tag_classes();
63426       init_tag_pattern();
63427       init_touch();
63428       init_turns();
63429       init_vertices();
63430       init_mapilio_images();
63431       init_panoramax_images();
63432     }
63433   });
63434
63435   // modules/ui/length_indicator.js
63436   var length_indicator_exports = {};
63437   __export(length_indicator_exports, {
63438     uiLengthIndicator: () => uiLengthIndicator
63439   });
63440   function uiLengthIndicator(maxChars) {
63441     var _wrap = select_default2(null);
63442     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
63443       selection2.text("");
63444       selection2.call(svgIcon("#iD-icon-alert", "inline"));
63445       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
63446     });
63447     var _silent = false;
63448     var lengthIndicator = function(selection2) {
63449       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
63450       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
63451       selection2.call(_tooltip);
63452     };
63453     lengthIndicator.update = function(val) {
63454       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
63455       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
63456       indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d2) => d2 > maxChars).style("border-right-width", (d2) => `${Math.abs(maxChars - d2) * 2}px`).style("margin-right", (d2) => d2 > maxChars ? `${(maxChars - d2) * 2}px` : 0).style("opacity", (d2) => d2 > maxChars * 0.8 ? Math.min(1, (d2 / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d2) => d2 > maxChars * 0.8 ? null : "none");
63457       if (_silent) return;
63458       if (strLen > maxChars) {
63459         _tooltip.show();
63460       } else {
63461         _tooltip.hide();
63462       }
63463     };
63464     lengthIndicator.silent = function(val) {
63465       if (!arguments.length) return _silent;
63466       _silent = val;
63467       return lengthIndicator;
63468     };
63469     return lengthIndicator;
63470   }
63471   var init_length_indicator = __esm({
63472     "modules/ui/length_indicator.js"() {
63473       "use strict";
63474       init_src5();
63475       init_localizer();
63476       init_svg();
63477       init_util();
63478       init_popover();
63479     }
63480   });
63481
63482   // modules/ui/fields/combo.js
63483   var combo_exports = {};
63484   __export(combo_exports, {
63485     uiFieldCombo: () => uiFieldCombo,
63486     uiFieldManyCombo: () => uiFieldCombo,
63487     uiFieldMultiCombo: () => uiFieldCombo,
63488     uiFieldNetworkCombo: () => uiFieldCombo,
63489     uiFieldSemiCombo: () => uiFieldCombo,
63490     uiFieldTypeCombo: () => uiFieldCombo
63491   });
63492   function uiFieldCombo(field, context) {
63493     var dispatch14 = dispatch_default("change");
63494     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
63495     var _isNetwork = field.type === "networkCombo";
63496     var _isSemi = field.type === "semiCombo";
63497     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
63498     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
63499     var _snake_case = field.snake_case || field.snake_case === void 0;
63500     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
63501     var _container = select_default2(null);
63502     var _inputWrap = select_default2(null);
63503     var _input = select_default2(null);
63504     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63505     var _comboData = [];
63506     var _multiData = [];
63507     var _entityIDs = [];
63508     var _tags;
63509     var _countryCode;
63510     var _staticPlaceholder;
63511     var _customOptions = [];
63512     var _dataDeprecated = [];
63513     _mainFileFetcher.get("deprecated").then(function(d2) {
63514       _dataDeprecated = d2;
63515     }).catch(function() {
63516     });
63517     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
63518       field.key += ":";
63519     }
63520     function snake(s2) {
63521       return s2.replace(/\s+/g, "_");
63522     }
63523     function clean2(s2) {
63524       return s2.split(";").map(function(s3) {
63525         return s3.trim();
63526       }).join(";");
63527     }
63528     function tagValue(dval) {
63529       dval = clean2(dval || "");
63530       var found = getOptions(true).find(function(o2) {
63531         return o2.key && clean2(o2.value) === dval;
63532       });
63533       if (found) return found.key;
63534       if (field.type === "typeCombo" && !dval) {
63535         return "yes";
63536       }
63537       return restrictTagValueSpelling(dval) || void 0;
63538     }
63539     function restrictTagValueSpelling(dval) {
63540       if (_snake_case) {
63541         dval = snake(dval);
63542       }
63543       if (!field.caseSensitive) {
63544         dval = dval.toLowerCase();
63545       }
63546       return dval;
63547     }
63548     function getLabelId(field2, v3) {
63549       return field2.hasTextForStringId(`options.${v3}.title`) ? `options.${v3}.title` : `options.${v3}`;
63550     }
63551     function displayValue(tval) {
63552       tval = tval || "";
63553       var stringsField = field.resolveReference("stringsCrossReference");
63554       const labelId = getLabelId(stringsField, tval);
63555       if (stringsField.hasTextForStringId(labelId)) {
63556         return stringsField.t(labelId, { default: tval });
63557       }
63558       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63559         return "";
63560       }
63561       return tval;
63562     }
63563     function renderValue(tval) {
63564       tval = tval || "";
63565       var stringsField = field.resolveReference("stringsCrossReference");
63566       const labelId = getLabelId(stringsField, tval);
63567       if (stringsField.hasTextForStringId(labelId)) {
63568         return stringsField.t.append(labelId, { default: tval });
63569       }
63570       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
63571         tval = "";
63572       }
63573       return (selection2) => selection2.text(tval);
63574     }
63575     function objectDifference(a4, b3) {
63576       return a4.filter(function(d1) {
63577         return !b3.some(function(d2) {
63578           return d1.value === d2.value;
63579         });
63580       });
63581     }
63582     function initCombo(selection2, attachTo) {
63583       if (!_allowCustomValues) {
63584         selection2.attr("readonly", "readonly");
63585       }
63586       if (_showTagInfoSuggestions && services.taginfo) {
63587         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
63588         setTaginfoValues("", setPlaceholder);
63589       } else {
63590         selection2.call(_combobox, attachTo);
63591         setTimeout(() => setStaticValues(setPlaceholder), 0);
63592       }
63593     }
63594     function getOptions(allOptions) {
63595       var stringsField = field.resolveReference("stringsCrossReference");
63596       if (!(field.options || stringsField.options)) return [];
63597       let options;
63598       if (allOptions !== true) {
63599         options = field.options || stringsField.options;
63600       } else {
63601         options = [].concat(field.options, stringsField.options).filter(Boolean);
63602       }
63603       const result = options.map(function(v3) {
63604         const labelId = getLabelId(stringsField, v3);
63605         return {
63606           key: v3,
63607           value: stringsField.t(labelId, { default: v3 }),
63608           title: stringsField.t(`options.${v3}.description`, { default: v3 }),
63609           display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63610           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
63611         };
63612       });
63613       return [...result, ..._customOptions];
63614     }
63615     function hasStaticValues() {
63616       return getOptions().length > 0;
63617     }
63618     function setStaticValues(callback, filter2) {
63619       _comboData = getOptions();
63620       if (filter2 !== void 0) {
63621         _comboData = _comboData.filter(filter2);
63622       }
63623       _comboData = objectDifference(_comboData, _multiData);
63624       _combobox.data(_comboData);
63625       _container.classed("empty-combobox", _comboData.length === 0);
63626       if (callback) callback(_comboData);
63627     }
63628     function setTaginfoValues(q3, callback) {
63629       var queryFilter = (d2) => d2.value.toLowerCase().includes(q3.toLowerCase()) || d2.key.toLowerCase().includes(q3.toLowerCase());
63630       if (hasStaticValues()) {
63631         setStaticValues(callback, queryFilter);
63632       }
63633       var stringsField = field.resolveReference("stringsCrossReference");
63634       var fn = _isMulti ? "multikeys" : "values";
63635       var query = (_isMulti ? field.key : "") + q3;
63636       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q3.toLowerCase()) === 0;
63637       if (hasCountryPrefix) {
63638         query = _countryCode + ":";
63639       }
63640       var params = {
63641         debounce: q3 !== "",
63642         key: field.key,
63643         query
63644       };
63645       if (_entityIDs.length) {
63646         params.geometry = context.graph().geometry(_entityIDs[0]);
63647       }
63648       services.taginfo[fn](params, function(err, data) {
63649         if (err) return;
63650         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
63651         data = data.filter((d2) => {
63652           var value = d2.value;
63653           if (_isMulti) {
63654             value = value.slice(field.key.length);
63655           }
63656           return value === restrictTagValueSpelling(value);
63657         });
63658         var deprecatedValues = deprecatedTagValuesByKey(_dataDeprecated)[field.key];
63659         if (deprecatedValues) {
63660           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
63661         }
63662         if (hasCountryPrefix) {
63663           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
63664         }
63665         const additionalOptions = (field.options || stringsField.options || []).filter((v3) => !data.some((dv) => dv.value === (_isMulti ? field.key + v3 : v3))).map((v3) => ({ value: v3 }));
63666         _container.classed("empty-combobox", data.length === 0);
63667         _comboData = data.concat(additionalOptions).map(function(d2) {
63668           var v3 = d2.value;
63669           if (_isMulti) v3 = v3.replace(field.key, "");
63670           const labelId = getLabelId(stringsField, v3);
63671           var isLocalizable = stringsField.hasTextForStringId(labelId);
63672           var label = stringsField.t(labelId, { default: v3 });
63673           return {
63674             key: v3,
63675             value: label,
63676             title: stringsField.t(`options.${v3}.description`, { default: isLocalizable ? v3 : d2.title !== label ? d2.title : "" }),
63677             display: addComboboxIcons(stringsField.t.append(labelId, { default: v3 }), v3),
63678             klass: isLocalizable ? "" : "raw-option"
63679           };
63680         });
63681         _comboData = _comboData.filter(queryFilter);
63682         _comboData = objectDifference(_comboData, _multiData);
63683         if (callback) callback(_comboData, hasStaticValues());
63684       });
63685     }
63686     function addComboboxIcons(disp, value) {
63687       const iconsField = field.resolveReference("iconsCrossReference");
63688       if (iconsField.icons) {
63689         return function(selection2) {
63690           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
63691           if (iconsField.icons[value]) {
63692             span.call(svgIcon(`#${iconsField.icons[value]}`));
63693           }
63694           disp.call(this, selection2);
63695         };
63696       }
63697       return disp;
63698     }
63699     function setPlaceholder(values) {
63700       if (_isMulti || _isSemi) {
63701         _staticPlaceholder = field.placeholder() || _t("inspector.add");
63702       } else {
63703         var vals = values.map(function(d2) {
63704           return d2.value;
63705         }).filter(function(s2) {
63706           return s2.length < 20;
63707         });
63708         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
63709           return d2.key;
63710         });
63711         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
63712       }
63713       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
63714         _staticPlaceholder += "\u2026";
63715       }
63716       var ph;
63717       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
63718         ph = _t("inspector.multiple_values");
63719       } else {
63720         ph = _staticPlaceholder;
63721       }
63722       _container.selectAll("input").attr("placeholder", ph);
63723       var hideAdd = !_allowCustomValues && !values.length;
63724       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63725     }
63726     function change() {
63727       var t2 = {};
63728       var val;
63729       if (_isMulti || _isSemi) {
63730         var vals;
63731         if (_isMulti) {
63732           vals = [tagValue(utilGetSetValue(_input))];
63733         } else if (_isSemi) {
63734           val = tagValue(utilGetSetValue(_input)) || "";
63735           val = val.replace(/,/g, ";");
63736           vals = val.split(";");
63737         }
63738         vals = vals.filter(Boolean);
63739         if (!vals.length) return;
63740         _container.classed("active", false);
63741         utilGetSetValue(_input, "");
63742         if (_isMulti) {
63743           utilArrayUniq(vals).forEach(function(v3) {
63744             var key = (field.key || "") + v3;
63745             if (_tags) {
63746               var old = _tags[key];
63747               if (typeof old === "string" && old.toLowerCase() !== "no") return;
63748             }
63749             key = context.cleanTagKey(key);
63750             field.keys.push(key);
63751             t2[key] = "yes";
63752           });
63753         } else if (_isSemi) {
63754           var arr = _multiData.map(function(d2) {
63755             return d2.key;
63756           });
63757           arr = arr.concat(vals);
63758           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
63759         }
63760         window.setTimeout(function() {
63761           _input.node().focus();
63762         }, 10);
63763       } else {
63764         var rawValue = utilGetSetValue(_input);
63765         if (!rawValue && Array.isArray(_tags[field.key])) return;
63766         val = context.cleanTagValue(tagValue(rawValue));
63767         t2[field.key] = val || void 0;
63768       }
63769       dispatch14.call("change", this, t2);
63770     }
63771     function removeMultikey(d3_event, d2) {
63772       d3_event.preventDefault();
63773       d3_event.stopPropagation();
63774       var t2 = {};
63775       if (_isMulti) {
63776         t2[d2.key] = void 0;
63777       } else if (_isSemi) {
63778         var arr = _multiData.map(function(md) {
63779           return md.key === d2.key ? null : md.key;
63780         }).filter(Boolean);
63781         arr = utilArrayUniq(arr);
63782         t2[field.key] = arr.length ? arr.join(";") : void 0;
63783         _lengthIndicator.update(t2[field.key]);
63784       }
63785       dispatch14.call("change", this, t2);
63786     }
63787     function invertMultikey(d3_event, d2) {
63788       d3_event.preventDefault();
63789       d3_event.stopPropagation();
63790       var t2 = {};
63791       if (_isMulti) {
63792         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
63793       }
63794       dispatch14.call("change", this, t2);
63795     }
63796     function combo(selection2) {
63797       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
63798       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
63799       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
63800       if (_isMulti || _isSemi) {
63801         _container = _container.selectAll(".chiplist").data([0]);
63802         var listClass = "chiplist";
63803         if (field.key === "destination" || field.key === "via") {
63804           listClass += " full-line-chips";
63805         }
63806         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
63807           window.setTimeout(function() {
63808             _input.node().focus();
63809           }, 10);
63810         }).merge(_container);
63811         _inputWrap = _container.selectAll(".input-wrap").data([0]);
63812         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
63813         var hideAdd = !_allowCustomValues && !_comboData.length;
63814         _inputWrap.style("display", hideAdd ? "none" : null);
63815         _input = _inputWrap.selectAll("input").data([0]);
63816       } else {
63817         _input = _container.selectAll("input").data([0]);
63818       }
63819       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
63820       if (_isSemi) {
63821         _inputWrap.call(_lengthIndicator);
63822       } else if (!_isMulti) {
63823         _container.call(_lengthIndicator);
63824       }
63825       if (_isNetwork) {
63826         var extent = combinedEntityExtent();
63827         var countryCode = extent && iso1A2Code(extent.center());
63828         _countryCode = countryCode && countryCode.toLowerCase();
63829       }
63830       _input.on("change", change).on("blur", change).on("input", function() {
63831         let val = utilGetSetValue(_input);
63832         updateIcon(val);
63833         if (_isSemi && _tags[field.key]) {
63834           val += ";" + _tags[field.key];
63835         }
63836         _lengthIndicator.update(val);
63837       });
63838       _input.on("keydown.field", function(d3_event) {
63839         switch (d3_event.keyCode) {
63840           case 13:
63841             _input.node().blur();
63842             d3_event.stopPropagation();
63843             break;
63844         }
63845       });
63846       if (_isMulti || _isSemi) {
63847         _combobox.on("accept", function() {
63848           _input.node().blur();
63849           _input.node().focus();
63850         });
63851         _input.on("focus", function() {
63852           _container.classed("active", true);
63853         });
63854       }
63855       _combobox.on("cancel", function() {
63856         _input.node().blur();
63857       }).on("update", function() {
63858         updateIcon(utilGetSetValue(_input));
63859       });
63860     }
63861     function updateIcon(value) {
63862       value = tagValue(value);
63863       let container = _container;
63864       if (field.type === "multiCombo" || field.type === "semiCombo") {
63865         container = _container.select(".input-wrap");
63866       }
63867       const iconsField = field.resolveReference("iconsCrossReference");
63868       if (iconsField.icons) {
63869         container.selectAll(".tag-value-icon").remove();
63870         if (iconsField.icons[value]) {
63871           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
63872         }
63873       }
63874     }
63875     combo.tags = function(tags) {
63876       _tags = tags;
63877       var stringsField = field.resolveReference("stringsCrossReference");
63878       var isMixed = Array.isArray(tags[field.key]);
63879       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
63880       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
63881       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
63882       var isReadOnly = !_allowCustomValues;
63883       if (_isMulti || _isSemi) {
63884         _multiData = [];
63885         var maxLength;
63886         if (_isMulti) {
63887           for (var k3 in tags) {
63888             if (field.key && k3.indexOf(field.key) !== 0) continue;
63889             if (!field.key && field.keys.indexOf(k3) === -1) continue;
63890             var v3 = tags[k3];
63891             var suffix = field.key ? k3.slice(field.key.length) : k3;
63892             _multiData.push({
63893               key: k3,
63894               value: displayValue(suffix),
63895               display: addComboboxIcons(renderValue(suffix), suffix),
63896               state: typeof v3 === "string" ? v3.toLowerCase() : "",
63897               isMixed: Array.isArray(v3)
63898             });
63899           }
63900           if (field.key) {
63901             field.keys = _multiData.map(function(d2) {
63902               return d2.key;
63903             });
63904             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
63905           } else {
63906             maxLength = context.maxCharsForTagKey();
63907           }
63908         } else if (_isSemi) {
63909           var allValues = [];
63910           var commonValues;
63911           if (Array.isArray(tags[field.key])) {
63912             tags[field.key].forEach(function(tagVal) {
63913               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
63914               allValues = allValues.concat(thisVals);
63915               if (!commonValues) {
63916                 commonValues = thisVals;
63917               } else {
63918                 commonValues = commonValues.filter((value) => thisVals.includes(value));
63919               }
63920             });
63921             allValues = utilArrayUniq(allValues).filter(Boolean);
63922           } else {
63923             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
63924             commonValues = allValues;
63925           }
63926           _multiData = allValues.map(function(v4) {
63927             return {
63928               key: v4,
63929               value: displayValue(v4),
63930               display: addComboboxIcons(renderValue(v4), v4),
63931               isMixed: !commonValues.includes(v4)
63932             };
63933           });
63934           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
63935           maxLength = context.maxCharsForTagValue() - currLength;
63936           if (currLength > 0) {
63937             maxLength -= 1;
63938           }
63939         }
63940         maxLength = Math.max(0, maxLength);
63941         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
63942         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
63943         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
63944         var chips = _container.selectAll(".chip").data(_multiData);
63945         chips.exit().remove();
63946         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
63947         enter.append("span");
63948         const field_buttons = enter.append("div").attr("class", "field_buttons");
63949         field_buttons.append("a").attr("class", "remove");
63950         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
63951           var k4 = d2.key;
63952           if (_isMulti) k4 = k4.replace(field.key, "");
63953           return !stringsField.hasTextForStringId("options." + k4);
63954         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
63955           return d2.isMixed;
63956         }).attr("title", function(d2) {
63957           if (d2.isMixed) {
63958             return _t("inspector.unshared_value_tooltip");
63959           }
63960           if (!["yes", "no"].includes(d2.state)) {
63961             return d2.state;
63962           }
63963           return null;
63964         }).classed("negated", (d2) => d2.state === "no");
63965         if (!_isSemi) {
63966           chips.selectAll("input[type=checkbox]").remove();
63967           chips.insert("input", "span").attr("type", "checkbox").property("checked", (d2) => d2.state === "yes").property("indeterminate", (d2) => d2.isMixed || !["yes", "no"].includes(d2.state)).on("click", invertMultikey);
63968         }
63969         if (allowDragAndDrop) {
63970           registerDragAndDrop(chips);
63971         }
63972         chips.each(function(d2) {
63973           const selection2 = select_default2(this);
63974           const text_span = selection2.select("span");
63975           const field_buttons2 = selection2.select(".field_buttons");
63976           const clean_value = d2.value.trim();
63977           text_span.text("");
63978           if (!field_buttons2.select("button").empty()) {
63979             field_buttons2.select("button").remove();
63980           }
63981           if (clean_value.startsWith("https://")) {
63982             text_span.text(clean_value);
63983             field_buttons2.append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).attr("aria-label", () => _t("icons.visit_website")).on("click", function(d3_event) {
63984               d3_event.preventDefault();
63985               window.open(clean_value, "_blank");
63986             });
63987             return;
63988           }
63989           if (d2.display) {
63990             d2.display(text_span);
63991             return;
63992           }
63993           text_span.text(d2.value);
63994         });
63995         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
63996         updateIcon("");
63997       } else {
63998         var mixedValues = isMixed && tags[field.key].map(function(val) {
63999           return displayValue(val);
64000         }).filter(Boolean);
64001         utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").data([tags[field.key]]).classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
64002           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
64003             d3_event.preventDefault();
64004             d3_event.stopPropagation();
64005             var t2 = {};
64006             t2[field.key] = void 0;
64007             dispatch14.call("change", this, t2);
64008           }
64009         });
64010         if (!Array.isArray(tags[field.key])) {
64011           updateIcon(tags[field.key]);
64012         }
64013         if (!isMixed) {
64014           _lengthIndicator.update(tags[field.key]);
64015         }
64016       }
64017       const refreshStyles = () => {
64018         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
64019       };
64020       _input.on("input.refreshStyles", refreshStyles);
64021       _combobox.on("update.refreshStyles", refreshStyles);
64022       refreshStyles();
64023     };
64024     function registerDragAndDrop(selection2) {
64025       var dragOrigin, targetIndex;
64026       selection2.call(
64027         drag_default().on("start", function(d3_event) {
64028           dragOrigin = {
64029             x: d3_event.x,
64030             y: d3_event.y
64031           };
64032           targetIndex = null;
64033         }).on("drag", function(d3_event) {
64034           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
64035           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
64036           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
64037           var index = selection2.nodes().indexOf(this);
64038           select_default2(this).classed("dragging", true);
64039           targetIndex = null;
64040           var targetIndexOffsetTop = null;
64041           var draggedTagWidth = select_default2(this).node().offsetWidth;
64042           if (field.key === "destination" || field.key === "via") {
64043             _container.selectAll(".chip").style("transform", function(d2, index2) {
64044               var node = select_default2(this).node();
64045               if (index === index2) {
64046                 return "translate(" + x2 + "px, " + y2 + "px)";
64047               } else if (index2 > index && d3_event.y > node.offsetTop) {
64048                 if (targetIndex === null || index2 > targetIndex) {
64049                   targetIndex = index2;
64050                 }
64051                 return "translateY(-100%)";
64052               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
64053                 if (targetIndex === null || index2 < targetIndex) {
64054                   targetIndex = index2;
64055                 }
64056                 return "translateY(100%)";
64057               }
64058               return null;
64059             });
64060           } else {
64061             _container.selectAll(".chip").each(function(d2, index2) {
64062               var node = select_default2(this).node();
64063               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) {
64064                 targetIndex = index2;
64065                 targetIndexOffsetTop = node.offsetTop;
64066               }
64067             }).style("transform", function(d2, index2) {
64068               var node = select_default2(this).node();
64069               if (index === index2) {
64070                 return "translate(" + x2 + "px, " + y2 + "px)";
64071               }
64072               if (node.offsetTop === targetIndexOffsetTop) {
64073                 if (index2 < index && index2 >= targetIndex) {
64074                   return "translateX(" + draggedTagWidth + "px)";
64075                 } else if (index2 > index && index2 <= targetIndex) {
64076                   return "translateX(-" + draggedTagWidth + "px)";
64077                 }
64078               }
64079               return null;
64080             });
64081           }
64082         }).on("end", function() {
64083           if (!select_default2(this).classed("dragging")) {
64084             return;
64085           }
64086           var index = selection2.nodes().indexOf(this);
64087           select_default2(this).classed("dragging", false);
64088           _container.selectAll(".chip").style("transform", null);
64089           if (typeof targetIndex === "number") {
64090             var element = _multiData[index];
64091             _multiData.splice(index, 1);
64092             _multiData.splice(targetIndex, 0, element);
64093             var t2 = {};
64094             if (_multiData.length) {
64095               t2[field.key] = _multiData.map(function(element2) {
64096                 return element2.key;
64097               }).join(";");
64098             } else {
64099               t2[field.key] = void 0;
64100             }
64101             dispatch14.call("change", this, t2);
64102           }
64103           dragOrigin = void 0;
64104           targetIndex = void 0;
64105         })
64106       );
64107     }
64108     combo.setCustomOptions = (newValue) => {
64109       _customOptions = newValue;
64110     };
64111     combo.focus = function() {
64112       _input.node().focus();
64113     };
64114     combo.entityIDs = function(val) {
64115       if (!arguments.length) return _entityIDs;
64116       _entityIDs = val;
64117       return combo;
64118     };
64119     function combinedEntityExtent() {
64120       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64121     }
64122     return utilRebind(combo, dispatch14, "on");
64123   }
64124   var init_combo = __esm({
64125     "modules/ui/fields/combo.js"() {
64126       "use strict";
64127       init_src4();
64128       init_src5();
64129       init_src6();
64130       init_country_coder();
64131       init_file_fetcher();
64132       init_localizer();
64133       init_services();
64134       init_combobox();
64135       init_icon();
64136       init_keybinding();
64137       init_util();
64138       init_length_indicator();
64139       init_deprecated();
64140     }
64141   });
64142
64143   // modules/behavior/hash.js
64144   var hash_exports = {};
64145   __export(hash_exports, {
64146     behaviorHash: () => behaviorHash
64147   });
64148   function behaviorHash(context) {
64149     var _cachedHash = null;
64150     var _latitudeLimit = 90 - 1e-8;
64151     function computedHashParameters() {
64152       var map2 = context.map();
64153       var center = map2.center();
64154       var zoom = map2.zoom();
64155       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
64156       var oldParams = utilObjectOmit(
64157         utilStringQs(window.location.hash),
64158         ["comment", "source", "hashtags", "walkthrough"]
64159       );
64160       var newParams = {};
64161       delete oldParams.id;
64162       var selected = context.selectedIDs().filter(function(id2) {
64163         return context.hasEntity(id2);
64164       });
64165       if (selected.length) {
64166         newParams.id = selected.join(",");
64167       } else if (context.selectedNoteID()) {
64168         newParams.id = `note/${context.selectedNoteID()}`;
64169       }
64170       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
64171       return Object.assign(oldParams, newParams);
64172     }
64173     function computedHash() {
64174       return "#" + utilQsString(computedHashParameters(), true);
64175     }
64176     function computedTitle(includeChangeCount) {
64177       var baseTitle = context.documentTitleBase() || "iD";
64178       var contextual;
64179       var changeCount;
64180       var titleID;
64181       var selected = context.selectedIDs().filter(function(id2) {
64182         return context.hasEntity(id2);
64183       });
64184       if (selected.length) {
64185         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
64186         if (selected.length > 1) {
64187           contextual = _t("title.labeled_and_more", {
64188             labeled: firstLabel,
64189             count: selected.length - 1
64190           });
64191         } else {
64192           contextual = firstLabel;
64193         }
64194         titleID = "context";
64195       }
64196       if (includeChangeCount) {
64197         changeCount = context.history().difference().summary().length;
64198         if (changeCount > 0) {
64199           titleID = contextual ? "changes_context" : "changes";
64200         }
64201       }
64202       if (titleID) {
64203         return _t("title.format." + titleID, {
64204           changes: changeCount,
64205           base: baseTitle,
64206           context: contextual
64207         });
64208       }
64209       return baseTitle;
64210     }
64211     function updateTitle(includeChangeCount) {
64212       if (!context.setsDocumentTitle()) return;
64213       var newTitle = computedTitle(includeChangeCount);
64214       if (document.title !== newTitle) {
64215         document.title = newTitle;
64216       }
64217     }
64218     function updateHashIfNeeded() {
64219       if (context.inIntro()) return;
64220       var latestHash = computedHash();
64221       if (_cachedHash !== latestHash) {
64222         _cachedHash = latestHash;
64223         window.history.replaceState(null, "", latestHash);
64224         updateTitle(
64225           true
64226           /* includeChangeCount */
64227         );
64228         const q3 = utilStringQs(latestHash);
64229         if (q3.map) {
64230           corePreferences("map-location", q3.map);
64231         }
64232       }
64233     }
64234     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
64235     var _throttledUpdateTitle = throttle_default(function() {
64236       updateTitle(
64237         true
64238         /* includeChangeCount */
64239       );
64240     }, 500);
64241     function hashchange() {
64242       if (window.location.hash === _cachedHash) return;
64243       _cachedHash = window.location.hash;
64244       var q3 = utilStringQs(_cachedHash);
64245       var mapArgs = (q3.map || "").split("/").map(Number);
64246       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
64247         updateHashIfNeeded();
64248       } else {
64249         if (_cachedHash === computedHash()) return;
64250         var mode = context.mode();
64251         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64252         if (q3.id && mode) {
64253           var ids = q3.id.split(",").filter(function(id2) {
64254             return context.hasEntity(id2) || id2.startsWith("note/");
64255           });
64256           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
64257             if (ids.length === 1 && ids[0].startsWith("note/")) {
64258               context.enter(modeSelectNote(context, ids[0]));
64259             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
64260               context.enter(modeSelect(context, ids));
64261             }
64262             return;
64263           }
64264         }
64265         var center = context.map().center();
64266         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
64267         var maxdist = 500;
64268         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
64269           context.enter(modeBrowse(context));
64270           return;
64271         }
64272       }
64273     }
64274     function behavior() {
64275       context.map().on("move.behaviorHash", _throttledUpdate);
64276       context.history().on("change.behaviorHash", _throttledUpdateTitle);
64277       context.on("enter.behaviorHash", _throttledUpdate);
64278       select_default2(window).on("hashchange.behaviorHash", hashchange);
64279       var q3 = utilStringQs(window.location.hash);
64280       if (q3.id) {
64281         const selectIds = q3.id.split(",");
64282         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
64283           const noteId = selectIds[0].split("/")[1];
64284           context.moveToNote(noteId, !q3.map);
64285         } else {
64286           context.zoomToEntities(
64287             // convert ids to short form id: node/123 -> n123
64288             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
64289             !q3.map
64290           );
64291         }
64292       }
64293       if (q3.walkthrough === "true") {
64294         behavior.startWalkthrough = true;
64295       }
64296       if (q3.map) {
64297         behavior.hadLocation = true;
64298       } else if (!q3.id && corePreferences("map-location")) {
64299         const mapArgs = corePreferences("map-location").split("/").map(Number);
64300         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
64301         updateHashIfNeeded();
64302         behavior.hadLocation = true;
64303       }
64304       hashchange();
64305       updateTitle(false);
64306     }
64307     behavior.off = function() {
64308       _throttledUpdate.cancel();
64309       _throttledUpdateTitle.cancel();
64310       context.map().on("move.behaviorHash", null);
64311       context.on("enter.behaviorHash", null);
64312       select_default2(window).on("hashchange.behaviorHash", null);
64313       window.location.hash = "";
64314     };
64315     return behavior;
64316   }
64317   var init_hash = __esm({
64318     "modules/behavior/hash.js"() {
64319       "use strict";
64320       init_throttle();
64321       init_src5();
64322       init_geo2();
64323       init_browse();
64324       init_modes2();
64325       init_util();
64326       init_array3();
64327       init_utilDisplayLabel();
64328       init_localizer();
64329       init_preferences();
64330     }
64331   });
64332
64333   // modules/behavior/index.js
64334   var behavior_exports = {};
64335   __export(behavior_exports, {
64336     behaviorAddWay: () => behaviorAddWay,
64337     behaviorBreathe: () => behaviorBreathe,
64338     behaviorDrag: () => behaviorDrag,
64339     behaviorDraw: () => behaviorDraw,
64340     behaviorDrawWay: () => behaviorDrawWay,
64341     behaviorEdit: () => behaviorEdit,
64342     behaviorHash: () => behaviorHash,
64343     behaviorHover: () => behaviorHover,
64344     behaviorLasso: () => behaviorLasso,
64345     behaviorOperation: () => behaviorOperation,
64346     behaviorPaste: () => behaviorPaste,
64347     behaviorSelect: () => behaviorSelect
64348   });
64349   var init_behavior = __esm({
64350     "modules/behavior/index.js"() {
64351       "use strict";
64352       init_add_way();
64353       init_breathe();
64354       init_drag2();
64355       init_draw_way();
64356       init_draw();
64357       init_edit();
64358       init_hash();
64359       init_hover();
64360       init_lasso2();
64361       init_operation();
64362       init_paste();
64363       init_select4();
64364     }
64365   });
64366
64367   // modules/ui/account.js
64368   var account_exports = {};
64369   __export(account_exports, {
64370     uiAccount: () => uiAccount
64371   });
64372   function uiAccount(context) {
64373     const osm = context.connection();
64374     function updateUserDetails(selection2) {
64375       if (!osm) return;
64376       if (!osm.authenticated()) {
64377         render(selection2, null);
64378       } else {
64379         osm.userDetails((err, user) => {
64380           if (err && err.status === 401) {
64381             osm.logout();
64382           }
64383           render(selection2, user);
64384         });
64385       }
64386     }
64387     function render(selection2, user) {
64388       let userInfo = selection2.select(".userInfo");
64389       let loginLogout = selection2.select(".loginLogout");
64390       if (user) {
64391         userInfo.html("").classed("hide", false);
64392         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
64393         if (user.image_url) {
64394           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
64395         } else {
64396           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
64397         }
64398         userLink.append("span").attr("class", "label").text(user.display_name);
64399         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
64400           e3.preventDefault();
64401           osm.logout();
64402           osm.authenticate(void 0, { switchUser: true });
64403         });
64404       } else {
64405         userInfo.html("").classed("hide", true);
64406         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
64407           e3.preventDefault();
64408           osm.authenticate();
64409         });
64410       }
64411     }
64412     return function(selection2) {
64413       if (!osm) return;
64414       selection2.append("li").attr("class", "userInfo").classed("hide", true);
64415       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
64416       osm.on("change.account", () => updateUserDetails(selection2));
64417       updateUserDetails(selection2);
64418     };
64419   }
64420   var init_account = __esm({
64421     "modules/ui/account.js"() {
64422       "use strict";
64423       init_localizer();
64424       init_icon();
64425     }
64426   });
64427
64428   // modules/ui/attribution.js
64429   var attribution_exports = {};
64430   __export(attribution_exports, {
64431     uiAttribution: () => uiAttribution
64432   });
64433   function uiAttribution(context) {
64434     let _selection = select_default2(null);
64435     function render(selection2, data, klass) {
64436       let div = selection2.selectAll(`.${klass}`).data([0]);
64437       div = div.enter().append("div").attr("class", klass).merge(div);
64438       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
64439       attributions.exit().remove();
64440       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
64441         let attribution = select_default2(nodes[i3]);
64442         if (d2.terms_html) {
64443           attribution.html(d2.terms_html);
64444           return;
64445         }
64446         if (d2.terms_url) {
64447           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
64448         }
64449         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
64450         const terms_text = _t(
64451           `imagery.${sourceID}.attribution.text`,
64452           { default: d2.terms_text || d2.id || d2.name() }
64453         );
64454         if (d2.icon && !d2.overlay) {
64455           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
64456         }
64457         attribution.append("span").attr("class", "attribution-text").text(terms_text);
64458       }).merge(attributions);
64459       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
64460         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
64461         return notice ? [notice] : [];
64462       });
64463       copyright.exit().remove();
64464       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
64465       copyright.text(String);
64466     }
64467     function update() {
64468       let baselayer = context.background().baseLayerSource();
64469       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
64470       const z3 = context.map().zoom();
64471       let overlays = context.background().overlayLayerSources() || [];
64472       _selection.call(render, overlays.filter((s2) => s2.validZoom(z3)), "overlay-layer-attribution");
64473     }
64474     return function(selection2) {
64475       _selection = selection2;
64476       context.background().on("change.attribution", update);
64477       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
64478       update();
64479     };
64480   }
64481   var init_attribution = __esm({
64482     "modules/ui/attribution.js"() {
64483       "use strict";
64484       init_throttle();
64485       init_src5();
64486       init_localizer();
64487     }
64488   });
64489
64490   // modules/ui/contributors.js
64491   var contributors_exports = {};
64492   __export(contributors_exports, {
64493     uiContributors: () => uiContributors
64494   });
64495   function uiContributors(context) {
64496     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
64497       update();
64498     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
64499     function update() {
64500       if (!osm) return;
64501       var users = {}, entities = context.history().intersects(context.map().extent());
64502       entities.forEach(function(entity) {
64503         if (entity && entity.user) users[entity.user] = true;
64504       });
64505       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
64506       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
64507       var userList = select_default2(document.createElement("span"));
64508       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
64509         return osm.userURL(d2);
64510       }).attr("target", "_blank").text(String);
64511       if (u2.length > limit) {
64512         var count = select_default2(document.createElement("span"));
64513         var othersNum = u2.length - limit + 1;
64514         count.append("a").attr("target", "_blank").attr("href", function() {
64515           return osm.changesetsURL(context.map().center(), context.map().zoom());
64516         }).text(othersNum);
64517         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
64518       } else {
64519         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
64520       }
64521       if (!u2.length) {
64522         hidden = true;
64523         wrap2.transition().style("opacity", 0);
64524       } else if (hidden) {
64525         wrap2.transition().style("opacity", 1);
64526       }
64527     }
64528     return function(selection2) {
64529       if (!osm) return;
64530       wrap2 = selection2;
64531       update();
64532       osm.on("loaded.contributors", debouncedUpdate);
64533       context.map().on("move.contributors", debouncedUpdate);
64534     };
64535   }
64536   var init_contributors = __esm({
64537     "modules/ui/contributors.js"() {
64538       "use strict";
64539       init_debounce();
64540       init_src5();
64541       init_localizer();
64542       init_svg();
64543     }
64544   });
64545
64546   // modules/ui/edit_menu.js
64547   var edit_menu_exports = {};
64548   __export(edit_menu_exports, {
64549     uiEditMenu: () => uiEditMenu
64550   });
64551   function uiEditMenu(context) {
64552     var dispatch14 = dispatch_default("toggled");
64553     var _menu = select_default2(null);
64554     var _operations = [];
64555     var _anchorLoc = [0, 0];
64556     var _anchorLocLonLat = [0, 0];
64557     var _triggerType = "";
64558     var _vpTopMargin = 85;
64559     var _vpBottomMargin = 45;
64560     var _vpSideMargin = 35;
64561     var _menuTop = false;
64562     var _menuHeight;
64563     var _menuWidth;
64564     var _verticalPadding = 4;
64565     var _tooltipWidth = 210;
64566     var _menuSideMargin = 10;
64567     var _tooltips = [];
64568     var editMenu = function(selection2) {
64569       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
64570       var ops = _operations.filter(function(op) {
64571         return !isTouchMenu || !op.mouseOnly;
64572       });
64573       if (!ops.length) return;
64574       _tooltips = [];
64575       _menuTop = isTouchMenu;
64576       var showLabels = isTouchMenu;
64577       var buttonHeight = showLabels ? 32 : 34;
64578       if (showLabels) {
64579         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
64580           return op.title.length;
64581         })));
64582       } else {
64583         _menuWidth = 44;
64584       }
64585       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
64586       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
64587       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
64588       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
64589         return "edit-menu-item edit-menu-item-" + d2.id;
64590       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
64591         d3_event.stopPropagation();
64592       }).on("mouseenter.highlight", function(d3_event, d2) {
64593         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
64594         utilHighlightEntities(d2.relatedEntityIds(), true, context);
64595       }).on("mouseleave.highlight", function(d3_event, d2) {
64596         if (!d2.relatedEntityIds) return;
64597         utilHighlightEntities(d2.relatedEntityIds(), false, context);
64598       });
64599       buttonsEnter.each(function(d2) {
64600         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
64601         _tooltips.push(tooltip);
64602         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
64603       });
64604       if (showLabels) {
64605         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
64606           select_default2(this).call(d2.title);
64607         });
64608       }
64609       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
64610         return d2.disabled();
64611       });
64612       updatePosition();
64613       var initialScale = context.projection.scale();
64614       context.map().on("move.edit-menu", function() {
64615         if (initialScale !== context.projection.scale()) {
64616           editMenu.close();
64617         }
64618       }).on("drawn.edit-menu", function(info) {
64619         if (info.full) updatePosition();
64620       });
64621       var lastPointerUpType;
64622       function pointerup(d3_event) {
64623         lastPointerUpType = d3_event.pointerType;
64624       }
64625       function click(d3_event, operation2) {
64626         d3_event.stopPropagation();
64627         if (operation2.relatedEntityIds) {
64628           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
64629         }
64630         if (operation2.disabled()) {
64631           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64632             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
64633           }
64634         } else {
64635           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
64636             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
64637           }
64638           operation2();
64639           editMenu.close();
64640         }
64641         lastPointerUpType = null;
64642       }
64643       dispatch14.call("toggled", this, true);
64644     };
64645     function updatePosition() {
64646       if (!_menu || _menu.empty()) return;
64647       var anchorLoc = context.projection(_anchorLocLonLat);
64648       var viewport = context.surfaceRect();
64649       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
64650         editMenu.close();
64651         return;
64652       }
64653       var menuLeft = displayOnLeft(viewport);
64654       var offset = [0, 0];
64655       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
64656       if (_menuTop) {
64657         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
64658           offset[1] = -anchorLoc[1] + _vpTopMargin;
64659         } else {
64660           offset[1] = -_menuHeight;
64661         }
64662       } else {
64663         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
64664           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
64665         } else {
64666           offset[1] = 0;
64667         }
64668       }
64669       var origin = geoVecAdd(anchorLoc, offset);
64670       var _verticalOffset = parseFloat(utilGetDimensions(select_default2(".top-toolbar-wrap"))[1]);
64671       origin[1] -= _verticalOffset;
64672       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
64673       var tooltipSide = tooltipPosition(viewport, menuLeft);
64674       _tooltips.forEach(function(tooltip) {
64675         tooltip.placement(tooltipSide);
64676       });
64677       function displayOnLeft(viewport2) {
64678         if (_mainLocalizer.textDirection() === "ltr") {
64679           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
64680             return true;
64681           }
64682           return false;
64683         } else {
64684           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
64685             return false;
64686           }
64687           return true;
64688         }
64689       }
64690       function tooltipPosition(viewport2, menuLeft2) {
64691         if (_mainLocalizer.textDirection() === "ltr") {
64692           if (menuLeft2) {
64693             return "left";
64694           }
64695           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
64696             return "left";
64697           }
64698           return "right";
64699         } else {
64700           if (!menuLeft2) {
64701             return "right";
64702           }
64703           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
64704             return "right";
64705           }
64706           return "left";
64707         }
64708       }
64709     }
64710     editMenu.close = function() {
64711       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
64712       _menu.remove();
64713       _tooltips = [];
64714       dispatch14.call("toggled", this, false);
64715     };
64716     editMenu.anchorLoc = function(val) {
64717       if (!arguments.length) return _anchorLoc;
64718       _anchorLoc = val;
64719       _anchorLocLonLat = context.projection.invert(_anchorLoc);
64720       return editMenu;
64721     };
64722     editMenu.triggerType = function(val) {
64723       if (!arguments.length) return _triggerType;
64724       _triggerType = val;
64725       return editMenu;
64726     };
64727     editMenu.operations = function(val) {
64728       if (!arguments.length) return _operations;
64729       _operations = val;
64730       return editMenu;
64731     };
64732     return utilRebind(editMenu, dispatch14, "on");
64733   }
64734   var init_edit_menu = __esm({
64735     "modules/ui/edit_menu.js"() {
64736       "use strict";
64737       init_src5();
64738       init_src4();
64739       init_geo2();
64740       init_localizer();
64741       init_tooltip();
64742       init_rebind();
64743       init_util2();
64744       init_dimensions();
64745       init_icon();
64746     }
64747   });
64748
64749   // modules/ui/feature_info.js
64750   var feature_info_exports = {};
64751   __export(feature_info_exports, {
64752     uiFeatureInfo: () => uiFeatureInfo
64753   });
64754   function uiFeatureInfo(context) {
64755     function update(selection2) {
64756       var features = context.features();
64757       var stats = features.stats();
64758       var count = 0;
64759       var hiddenList = features.hidden().map(function(k3) {
64760         if (stats[k3]) {
64761           count += stats[k3];
64762           return _t.append("inspector.title_count", {
64763             title: _t("feature." + k3 + ".description"),
64764             count: stats[k3]
64765           });
64766         }
64767         return null;
64768       }).filter(Boolean);
64769       selection2.text("");
64770       if (hiddenList.length) {
64771         var tooltipBehavior = uiTooltip().placement("top").title(function() {
64772           return (selection3) => {
64773             hiddenList.forEach((hiddenFeature) => {
64774               selection3.append("div").call(hiddenFeature);
64775             });
64776           };
64777         });
64778         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
64779           tooltipBehavior.hide();
64780           d3_event.preventDefault();
64781           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
64782         });
64783       }
64784       selection2.classed("hide", !hiddenList.length);
64785     }
64786     return function(selection2) {
64787       update(selection2);
64788       context.features().on("change.feature_info", function() {
64789         update(selection2);
64790       });
64791     };
64792   }
64793   var init_feature_info = __esm({
64794     "modules/ui/feature_info.js"() {
64795       "use strict";
64796       init_localizer();
64797       init_tooltip();
64798     }
64799   });
64800
64801   // modules/ui/flash.js
64802   var flash_exports = {};
64803   __export(flash_exports, {
64804     uiFlash: () => uiFlash
64805   });
64806   function uiFlash(context) {
64807     var _flashTimer;
64808     var _duration = 2e3;
64809     var _iconName = "#iD-icon-no";
64810     var _iconClass = "disabled";
64811     var _label = (s2) => s2.text("");
64812     function flash() {
64813       if (_flashTimer) {
64814         _flashTimer.stop();
64815       }
64816       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
64817       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
64818       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
64819       var contentEnter = content.enter().append("div").attr("class", "flash-content");
64820       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
64821       iconEnter.append("circle").attr("r", 9);
64822       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
64823       contentEnter.append("div").attr("class", "flash-text");
64824       content = content.merge(contentEnter);
64825       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
64826       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
64827       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
64828       _flashTimer = timeout_default(function() {
64829         _flashTimer = null;
64830         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
64831         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
64832       }, _duration);
64833       return content;
64834     }
64835     flash.duration = function(_3) {
64836       if (!arguments.length) return _duration;
64837       _duration = _3;
64838       return flash;
64839     };
64840     flash.label = function(_3) {
64841       if (!arguments.length) return _label;
64842       if (typeof _3 !== "function") {
64843         _label = (selection2) => selection2.text(_3);
64844       } else {
64845         _label = (selection2) => selection2.text("").call(_3);
64846       }
64847       return flash;
64848     };
64849     flash.iconName = function(_3) {
64850       if (!arguments.length) return _iconName;
64851       _iconName = _3;
64852       return flash;
64853     };
64854     flash.iconClass = function(_3) {
64855       if (!arguments.length) return _iconClass;
64856       _iconClass = _3;
64857       return flash;
64858     };
64859     return flash;
64860   }
64861   var init_flash = __esm({
64862     "modules/ui/flash.js"() {
64863       "use strict";
64864       init_src9();
64865     }
64866   });
64867
64868   // modules/ui/full_screen.js
64869   var full_screen_exports = {};
64870   __export(full_screen_exports, {
64871     uiFullScreen: () => uiFullScreen
64872   });
64873   function uiFullScreen(context) {
64874     var element = context.container().node();
64875     function getFullScreenFn() {
64876       if (element.requestFullscreen) {
64877         return element.requestFullscreen;
64878       } else if (element.msRequestFullscreen) {
64879         return element.msRequestFullscreen;
64880       } else if (element.mozRequestFullScreen) {
64881         return element.mozRequestFullScreen;
64882       } else if (element.webkitRequestFullscreen) {
64883         return element.webkitRequestFullscreen;
64884       }
64885     }
64886     function getExitFullScreenFn() {
64887       if (document.exitFullscreen) {
64888         return document.exitFullscreen;
64889       } else if (document.msExitFullscreen) {
64890         return document.msExitFullscreen;
64891       } else if (document.mozCancelFullScreen) {
64892         return document.mozCancelFullScreen;
64893       } else if (document.webkitExitFullscreen) {
64894         return document.webkitExitFullscreen;
64895       }
64896     }
64897     function isFullScreen() {
64898       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
64899     }
64900     function isSupported() {
64901       return !!getFullScreenFn();
64902     }
64903     function fullScreen(d3_event) {
64904       d3_event.preventDefault();
64905       if (!isFullScreen()) {
64906         getFullScreenFn().apply(element);
64907       } else {
64908         getExitFullScreenFn().apply(document);
64909       }
64910     }
64911     return function() {
64912       if (!isSupported()) return;
64913       var detected = utilDetect();
64914       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
64915       context.keybinding().on(keys2, fullScreen);
64916     };
64917   }
64918   var init_full_screen = __esm({
64919     "modules/ui/full_screen.js"() {
64920       "use strict";
64921       init_cmd();
64922       init_detect();
64923     }
64924   });
64925
64926   // modules/ui/geolocate.js
64927   var geolocate_exports2 = {};
64928   __export(geolocate_exports2, {
64929     uiGeolocate: () => uiGeolocate
64930   });
64931   function uiGeolocate(context) {
64932     var _geolocationOptions = {
64933       // prioritize speed and power usage over precision
64934       enableHighAccuracy: false,
64935       // don't hang indefinitely getting the location
64936       timeout: 6e3
64937       // 6sec
64938     };
64939     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
64940     var _layer = context.layers().layer("geolocate");
64941     var _position;
64942     var _extent;
64943     var _timeoutID;
64944     var _button = select_default2(null);
64945     function click() {
64946       if (context.inIntro()) return;
64947       if (!_layer.enabled() && !_locating.isShown()) {
64948         _timeoutID = setTimeout(
64949           error,
64950           1e4
64951           /* 10sec */
64952         );
64953         context.container().call(_locating);
64954         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
64955       } else {
64956         _locating.close();
64957         _layer.enabled(null, false);
64958         updateButtonState();
64959       }
64960     }
64961     function zoomTo() {
64962       context.enter(modeBrowse(context));
64963       var map2 = context.map();
64964       _layer.enabled(_position, true);
64965       updateButtonState();
64966       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
64967     }
64968     function success(geolocation) {
64969       _position = geolocation;
64970       var coords = _position.coords;
64971       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
64972       zoomTo();
64973       finish();
64974     }
64975     function error() {
64976       if (_position) {
64977         zoomTo();
64978       } else {
64979         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
64980       }
64981       finish();
64982     }
64983     function finish() {
64984       _locating.close();
64985       if (_timeoutID) {
64986         clearTimeout(_timeoutID);
64987       }
64988       _timeoutID = void 0;
64989     }
64990     function updateButtonState() {
64991       _button.classed("active", _layer.enabled());
64992       _button.attr("aria-pressed", _layer.enabled());
64993     }
64994     return function(selection2) {
64995       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
64996       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
64997         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title"))
64998       );
64999     };
65000   }
65001   var init_geolocate2 = __esm({
65002     "modules/ui/geolocate.js"() {
65003       "use strict";
65004       init_src5();
65005       init_localizer();
65006       init_tooltip();
65007       init_geo2();
65008       init_browse();
65009       init_icon();
65010       init_loading();
65011     }
65012   });
65013
65014   // modules/ui/panels/background.js
65015   var background_exports = {};
65016   __export(background_exports, {
65017     uiPanelBackground: () => uiPanelBackground
65018   });
65019   function uiPanelBackground(context) {
65020     var background = context.background();
65021     var _currSourceName = null;
65022     var _metadata = {};
65023     var _metadataKeys = [
65024       "zoom",
65025       "vintage",
65026       "source",
65027       "description",
65028       "resolution",
65029       "accuracy"
65030     ];
65031     var debouncedRedraw = debounce_default(redraw, 250);
65032     function redraw(selection2) {
65033       var source = background.baseLayerSource();
65034       if (!source) return;
65035       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
65036       var sourceLabel = source.label();
65037       if (_currSourceName !== sourceLabel) {
65038         _currSourceName = sourceLabel;
65039         _metadata = {};
65040       }
65041       selection2.text("");
65042       var list = selection2.append("ul").attr("class", "background-info");
65043       list.append("li").call(_currSourceName);
65044       _metadataKeys.forEach(function(k3) {
65045         if (isDG && k3 === "vintage") return;
65046         list.append("li").attr("class", "background-info-list-" + k3).classed("hide", !_metadata[k3]).call(_t.append("info_panels.background." + k3, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k3).text(_metadata[k3]);
65047       });
65048       debouncedGetMetadata(selection2);
65049       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
65050       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
65051         d3_event.preventDefault();
65052         context.setDebug("tile", !context.getDebug("tile"));
65053         selection2.call(redraw);
65054       });
65055       if (isDG) {
65056         var key = source.id + "-vintage";
65057         var sourceVintage = context.background().findSource(key);
65058         var showsVintage = context.background().showsLayer(sourceVintage);
65059         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
65060         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
65061           d3_event.preventDefault();
65062           context.background().toggleOverlayLayer(sourceVintage);
65063           selection2.call(redraw);
65064         });
65065       }
65066       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
65067         if (source.id !== layerId) {
65068           var key2 = layerId + "-vintage";
65069           var sourceVintage2 = context.background().findSource(key2);
65070           if (context.background().showsLayer(sourceVintage2)) {
65071             context.background().toggleOverlayLayer(sourceVintage2);
65072           }
65073         }
65074       });
65075     }
65076     var debouncedGetMetadata = debounce_default(getMetadata, 250);
65077     function getMetadata(selection2) {
65078       var tile = context.container().select(".layer-background img.tile-center");
65079       if (tile.empty()) return;
65080       var sourceName = _currSourceName;
65081       var d2 = tile.datum();
65082       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
65083       var center = context.map().center();
65084       _metadata.zoom = String(zoom);
65085       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
65086       if (!d2 || !d2.length >= 3) return;
65087       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
65088         if (err || _currSourceName !== sourceName) return;
65089         var vintage = result.vintage;
65090         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
65091         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
65092         _metadataKeys.forEach(function(k3) {
65093           if (k3 === "zoom" || k3 === "vintage") return;
65094           var val = result[k3];
65095           _metadata[k3] = val;
65096           selection2.selectAll(".background-info-list-" + k3).classed("hide", !val).selectAll(".background-info-span-" + k3).text(val);
65097         });
65098       });
65099     }
65100     var panel = function(selection2) {
65101       selection2.call(redraw);
65102       context.map().on("drawn.info-background", function() {
65103         selection2.call(debouncedRedraw);
65104       }).on("move.info-background", function() {
65105         selection2.call(debouncedGetMetadata);
65106       });
65107     };
65108     panel.off = function() {
65109       context.map().on("drawn.info-background", null).on("move.info-background", null);
65110     };
65111     panel.id = "background";
65112     panel.label = _t.append("info_panels.background.title");
65113     panel.key = _t("info_panels.background.key");
65114     return panel;
65115   }
65116   var init_background = __esm({
65117     "modules/ui/panels/background.js"() {
65118       "use strict";
65119       init_debounce();
65120       init_localizer();
65121     }
65122   });
65123
65124   // modules/ui/panels/history.js
65125   var history_exports2 = {};
65126   __export(history_exports2, {
65127     uiPanelHistory: () => uiPanelHistory
65128   });
65129   function uiPanelHistory(context) {
65130     var osm;
65131     function displayTimestamp(timestamp) {
65132       if (!timestamp) return _t("info_panels.history.unknown");
65133       var options = {
65134         day: "numeric",
65135         month: "short",
65136         year: "numeric",
65137         hour: "numeric",
65138         minute: "numeric",
65139         second: "numeric"
65140       };
65141       var d2 = new Date(timestamp);
65142       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
65143       return d2.toLocaleString(_mainLocalizer.localeCode(), options);
65144     }
65145     function displayUser(selection2, userName) {
65146       if (!userName) {
65147         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65148         return;
65149       }
65150       selection2.append("span").attr("class", "user-name").text(userName);
65151       var links = selection2.append("div").attr("class", "links");
65152       if (osm) {
65153         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
65154       }
65155       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
65156     }
65157     function displayChangeset(selection2, changeset) {
65158       if (!changeset) {
65159         selection2.append("span").call(_t.append("info_panels.history.unknown"));
65160         return;
65161       }
65162       selection2.append("span").attr("class", "changeset-id").text(changeset);
65163       var links = selection2.append("div").attr("class", "links");
65164       if (osm) {
65165         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
65166       }
65167       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
65168       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
65169     }
65170     function redraw(selection2) {
65171       var selectedNoteID = context.selectedNoteID();
65172       osm = context.connection();
65173       var selected, note, entity;
65174       if (selectedNoteID && osm) {
65175         selected = [_t.html("note.note") + " " + selectedNoteID];
65176         note = osm.getNote(selectedNoteID);
65177       } else {
65178         selected = context.selectedIDs().filter(function(e3) {
65179           return context.hasEntity(e3);
65180         });
65181         if (selected.length) {
65182           entity = context.entity(selected[0]);
65183         }
65184       }
65185       var singular = selected.length === 1 ? selected[0] : null;
65186       selection2.html("");
65187       if (singular) {
65188         selection2.append("h4").attr("class", "history-heading").html(singular);
65189       } else {
65190         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
65191       }
65192       if (!singular) return;
65193       if (entity) {
65194         selection2.call(redrawEntity, entity);
65195       } else if (note) {
65196         selection2.call(redrawNote, note);
65197       }
65198     }
65199     function redrawNote(selection2, note) {
65200       if (!note || note.isNew()) {
65201         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
65202         return;
65203       }
65204       var list = selection2.append("ul");
65205       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
65206       if (note.comments.length) {
65207         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
65208         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
65209       }
65210       if (osm) {
65211         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"));
65212       }
65213     }
65214     function redrawEntity(selection2, entity) {
65215       if (!entity || entity.isNew()) {
65216         selection2.append("div").call(_t.append("info_panels.history.no_history"));
65217         return;
65218       }
65219       var links = selection2.append("div").attr("class", "links");
65220       if (osm) {
65221         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"));
65222       }
65223       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");
65224       var list = selection2.append("ul");
65225       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
65226       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
65227       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
65228       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
65229     }
65230     var panel = function(selection2) {
65231       selection2.call(redraw);
65232       context.map().on("drawn.info-history", function() {
65233         selection2.call(redraw);
65234       });
65235       context.on("enter.info-history", function() {
65236         selection2.call(redraw);
65237       });
65238     };
65239     panel.off = function() {
65240       context.map().on("drawn.info-history", null);
65241       context.on("enter.info-history", null);
65242     };
65243     panel.id = "history";
65244     panel.label = _t.append("info_panels.history.title");
65245     panel.key = _t("info_panels.history.key");
65246     return panel;
65247   }
65248   var init_history2 = __esm({
65249     "modules/ui/panels/history.js"() {
65250       "use strict";
65251       init_localizer();
65252       init_svg();
65253     }
65254   });
65255
65256   // modules/ui/panels/location.js
65257   var location_exports = {};
65258   __export(location_exports, {
65259     uiPanelLocation: () => uiPanelLocation
65260   });
65261   function uiPanelLocation(context) {
65262     var currLocation = "";
65263     function redraw(selection2) {
65264       selection2.html("");
65265       var list = selection2.append("ul");
65266       var coord2 = context.map().mouseCoordinates();
65267       if (coord2.some(isNaN)) {
65268         coord2 = context.map().center();
65269       }
65270       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
65271       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
65272       debouncedGetLocation(selection2, coord2);
65273     }
65274     var debouncedGetLocation = debounce_default(getLocation, 250);
65275     function getLocation(selection2, coord2) {
65276       if (!services.geocoder) {
65277         currLocation = _t("info_panels.location.unknown_location");
65278         selection2.selectAll(".location-info").text(currLocation);
65279       } else {
65280         services.geocoder.reverse(coord2, function(err, result) {
65281           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
65282           selection2.selectAll(".location-info").text(currLocation);
65283         });
65284       }
65285     }
65286     var panel = function(selection2) {
65287       selection2.call(redraw);
65288       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
65289         selection2.call(redraw);
65290       });
65291     };
65292     panel.off = function() {
65293       context.surface().on(".info-location", null);
65294     };
65295     panel.id = "location";
65296     panel.label = _t.append("info_panels.location.title");
65297     panel.key = _t("info_panels.location.key");
65298     return panel;
65299   }
65300   var init_location = __esm({
65301     "modules/ui/panels/location.js"() {
65302       "use strict";
65303       init_debounce();
65304       init_units();
65305       init_localizer();
65306       init_services();
65307     }
65308   });
65309
65310   // modules/ui/panels/measurement.js
65311   var measurement_exports = {};
65312   __export(measurement_exports, {
65313     uiPanelMeasurement: () => uiPanelMeasurement
65314   });
65315   function uiPanelMeasurement(context) {
65316     function radiansToMeters(r2) {
65317       return r2 * 63710071809e-4;
65318     }
65319     function steradiansToSqmeters(r2) {
65320       return r2 / (4 * Math.PI) * 510065621724e3;
65321     }
65322     function toLineString(feature3) {
65323       if (feature3.type === "LineString") return feature3;
65324       var result = { type: "LineString", coordinates: [] };
65325       if (feature3.type === "Polygon") {
65326         result.coordinates = feature3.coordinates[0];
65327       } else if (feature3.type === "MultiPolygon") {
65328         result.coordinates = feature3.coordinates[0][0];
65329       }
65330       return result;
65331     }
65332     var _isImperial = !_mainLocalizer.usesMetric();
65333     function redraw(selection2) {
65334       var graph = context.graph();
65335       var selectedNoteID = context.selectedNoteID();
65336       var osm = services.osm;
65337       var localeCode = _mainLocalizer.localeCode();
65338       var heading;
65339       var center, location, centroid;
65340       var closed, geometry;
65341       var totalNodeCount, length2 = 0, area = 0, distance;
65342       if (selectedNoteID && osm) {
65343         var note = osm.getNote(selectedNoteID);
65344         heading = _t.html("note.note") + " " + selectedNoteID;
65345         location = note.loc;
65346         geometry = "note";
65347       } else {
65348         var selectedIDs = context.selectedIDs().filter(function(id2) {
65349           return context.hasEntity(id2);
65350         });
65351         var selected = selectedIDs.map(function(id2) {
65352           return context.entity(id2);
65353         });
65354         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
65355         if (selected.length) {
65356           var extent = geoExtent();
65357           for (var i3 in selected) {
65358             var entity = selected[i3];
65359             extent._extend(entity.extent(graph));
65360             geometry = entity.geometry(graph);
65361             if (geometry === "line" || geometry === "area") {
65362               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
65363               var feature3 = entity.asGeoJSON(graph);
65364               length2 += radiansToMeters(length_default(toLineString(feature3)));
65365               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
65366               centroid = centroid && context.projection.invert(centroid);
65367               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
65368                 centroid = entity.extent(graph).center();
65369               }
65370               if (closed) {
65371                 area += steradiansToSqmeters(entity.area(graph));
65372               }
65373             }
65374           }
65375           if (selected.length > 1) {
65376             geometry = null;
65377             closed = null;
65378             centroid = null;
65379           }
65380           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
65381             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
65382           }
65383           if (selected.length === 1 && selected[0].type === "node") {
65384             location = selected[0].loc;
65385           } else {
65386             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
65387           }
65388           if (!location && !centroid) {
65389             center = extent.center();
65390           }
65391         }
65392       }
65393       selection2.html("");
65394       if (heading) {
65395         selection2.append("h4").attr("class", "measurement-heading").html(heading);
65396       }
65397       var list = selection2.append("ul");
65398       var coordItem;
65399       if (geometry) {
65400         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
65401           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
65402         );
65403       }
65404       if (totalNodeCount) {
65405         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
65406       }
65407       if (area) {
65408         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
65409       }
65410       if (length2) {
65411         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
65412       }
65413       if (typeof distance === "number") {
65414         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
65415       }
65416       if (location) {
65417         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
65418         coordItem.append("span").text(dmsCoordinatePair(location));
65419         coordItem.append("span").text(decimalCoordinatePair(location));
65420       }
65421       if (centroid) {
65422         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
65423         coordItem.append("span").text(dmsCoordinatePair(centroid));
65424         coordItem.append("span").text(decimalCoordinatePair(centroid));
65425       }
65426       if (center) {
65427         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
65428         coordItem.append("span").text(dmsCoordinatePair(center));
65429         coordItem.append("span").text(decimalCoordinatePair(center));
65430       }
65431       if (length2 || area || typeof distance === "number") {
65432         var toggle = _isImperial ? "imperial" : "metric";
65433         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
65434           d3_event.preventDefault();
65435           _isImperial = !_isImperial;
65436           selection2.call(redraw);
65437         });
65438       }
65439     }
65440     var panel = function(selection2) {
65441       selection2.call(redraw);
65442       context.map().on("drawn.info-measurement", function() {
65443         selection2.call(redraw);
65444       });
65445       context.on("enter.info-measurement", function() {
65446         selection2.call(redraw);
65447       });
65448     };
65449     panel.off = function() {
65450       context.map().on("drawn.info-measurement", null);
65451       context.on("enter.info-measurement", null);
65452     };
65453     panel.id = "measurement";
65454     panel.label = _t.append("info_panels.measurement.title");
65455     panel.key = _t("info_panels.measurement.key");
65456     return panel;
65457   }
65458   var init_measurement = __esm({
65459     "modules/ui/panels/measurement.js"() {
65460       "use strict";
65461       init_src2();
65462       init_localizer();
65463       init_units();
65464       init_geo2();
65465       init_services();
65466       init_util();
65467     }
65468   });
65469
65470   // modules/ui/panels/index.js
65471   var panels_exports = {};
65472   __export(panels_exports, {
65473     uiInfoPanels: () => uiInfoPanels,
65474     uiPanelBackground: () => uiPanelBackground,
65475     uiPanelHistory: () => uiPanelHistory,
65476     uiPanelLocation: () => uiPanelLocation,
65477     uiPanelMeasurement: () => uiPanelMeasurement
65478   });
65479   var uiInfoPanels;
65480   var init_panels = __esm({
65481     "modules/ui/panels/index.js"() {
65482       "use strict";
65483       init_background();
65484       init_history2();
65485       init_location();
65486       init_measurement();
65487       init_background();
65488       init_history2();
65489       init_location();
65490       init_measurement();
65491       uiInfoPanels = {
65492         background: uiPanelBackground,
65493         history: uiPanelHistory,
65494         location: uiPanelLocation,
65495         measurement: uiPanelMeasurement
65496       };
65497     }
65498   });
65499
65500   // modules/ui/info.js
65501   var info_exports = {};
65502   __export(info_exports, {
65503     uiInfo: () => uiInfo
65504   });
65505   function uiInfo(context) {
65506     var ids = Object.keys(uiInfoPanels);
65507     var wasActive = ["measurement"];
65508     var panels = {};
65509     var active = {};
65510     ids.forEach(function(k3) {
65511       if (!panels[k3]) {
65512         panels[k3] = uiInfoPanels[k3](context);
65513         active[k3] = false;
65514       }
65515     });
65516     function info(selection2) {
65517       function redraw() {
65518         var activeids = ids.filter(function(k3) {
65519           return active[k3];
65520         }).sort();
65521         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k3) {
65522           return k3;
65523         });
65524         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
65525           select_default2(this).call(panels[d2].off).remove();
65526         });
65527         var enter = containers.enter().append("div").attr("class", function(d2) {
65528           return "fillD2 panel-container panel-container-" + d2;
65529         });
65530         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
65531         var title = enter.append("div").attr("class", "panel-title fillD2");
65532         title.append("h3").each(function(d2) {
65533           return panels[d2].label(select_default2(this));
65534         });
65535         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
65536           d3_event.stopImmediatePropagation();
65537           d3_event.preventDefault();
65538           info.toggle(d2);
65539         }).call(svgIcon("#iD-icon-close"));
65540         enter.append("div").attr("class", function(d2) {
65541           return "panel-content panel-content-" + d2;
65542         });
65543         infoPanels.selectAll(".panel-content").each(function(d2) {
65544           select_default2(this).call(panels[d2]);
65545         });
65546       }
65547       info.toggle = function(which) {
65548         var activeids = ids.filter(function(k3) {
65549           return active[k3];
65550         });
65551         if (which) {
65552           active[which] = !active[which];
65553           if (activeids.length === 1 && activeids[0] === which) {
65554             wasActive = [which];
65555           }
65556           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
65557         } else {
65558           if (activeids.length) {
65559             wasActive = activeids;
65560             activeids.forEach(function(k3) {
65561               active[k3] = false;
65562             });
65563           } else {
65564             wasActive.forEach(function(k3) {
65565               active[k3] = true;
65566             });
65567           }
65568         }
65569         redraw();
65570       };
65571       var infoPanels = selection2.selectAll(".info-panels").data([0]);
65572       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
65573       redraw();
65574       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
65575         if (d3_event.shiftKey) return;
65576         d3_event.stopImmediatePropagation();
65577         d3_event.preventDefault();
65578         info.toggle();
65579       });
65580       ids.forEach(function(k3) {
65581         var key = _t("info_panels." + k3 + ".key", { default: null });
65582         if (!key) return;
65583         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
65584           d3_event.stopImmediatePropagation();
65585           d3_event.preventDefault();
65586           info.toggle(k3);
65587         });
65588       });
65589     }
65590     return info;
65591   }
65592   var init_info = __esm({
65593     "modules/ui/info.js"() {
65594       "use strict";
65595       init_src5();
65596       init_localizer();
65597       init_icon();
65598       init_cmd();
65599       init_panels();
65600     }
65601   });
65602
65603   // modules/ui/curtain.js
65604   var curtain_exports = {};
65605   __export(curtain_exports, {
65606     uiCurtain: () => uiCurtain
65607   });
65608   function uiCurtain(containerNode) {
65609     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
65610     function curtain(selection2) {
65611       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
65612       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
65613       select_default2(window).on("resize.curtain", resize);
65614       tooltip = selection2.append("div").attr("class", "tooltip");
65615       tooltip.append("div").attr("class", "popover-arrow");
65616       tooltip.append("div").attr("class", "popover-inner");
65617       resize();
65618       function resize() {
65619         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
65620         curtain.cut(darkness.datum());
65621       }
65622     }
65623     curtain.reveal = function(box, html2, options) {
65624       options = options || {};
65625       if (typeof box === "string") {
65626         box = select_default2(box).node();
65627       }
65628       if (box && box.getBoundingClientRect) {
65629         box = copyBox(box.getBoundingClientRect());
65630       }
65631       if (box) {
65632         var containerRect = containerNode.getBoundingClientRect();
65633         box.top -= containerRect.top;
65634         box.left -= containerRect.left;
65635       }
65636       if (box && options.padding) {
65637         box.top -= options.padding;
65638         box.left -= options.padding;
65639         box.bottom += options.padding;
65640         box.right += options.padding;
65641         box.height += options.padding * 2;
65642         box.width += options.padding * 2;
65643       }
65644       var tooltipBox;
65645       if (options.tooltipBox) {
65646         tooltipBox = options.tooltipBox;
65647         if (typeof tooltipBox === "string") {
65648           tooltipBox = select_default2(tooltipBox).node();
65649         }
65650         if (tooltipBox && tooltipBox.getBoundingClientRect) {
65651           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
65652         }
65653       } else {
65654         tooltipBox = box;
65655       }
65656       if (tooltipBox && html2) {
65657         if (html2.indexOf("**") !== -1) {
65658           if (html2.indexOf("<span") === 0) {
65659             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
65660           } else {
65661             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
65662           }
65663           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
65664         }
65665         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
65666         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
65667         if (options.buttonText && options.buttonCallback) {
65668           html2 += '<div class="button-section"><button href="#" class="button action">' + options.buttonText + "</button></div>";
65669         }
65670         var classes = "curtain-tooltip popover tooltip arrowed in " + (options.tooltipClass || "");
65671         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
65672         if (options.buttonText && options.buttonCallback) {
65673           var button = tooltip.selectAll(".button-section .button.action");
65674           button.on("click", function(d3_event) {
65675             d3_event.preventDefault();
65676             options.buttonCallback();
65677           });
65678         }
65679         var tip = copyBox(tooltip.node().getBoundingClientRect()), w3 = containerNode.clientWidth, h3 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
65680         if (options.tooltipClass === "intro-mouse") {
65681           tip.height += 80;
65682         }
65683         if (tooltipBox.top + tooltipBox.height > h3) {
65684           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h3;
65685         }
65686         if (tooltipBox.left + tooltipBox.width > w3) {
65687           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w3;
65688         }
65689         const onLeftOrRightEdge = tooltipBox.left + tooltipBox.width / 2 > w3 - 100 || tooltipBox.left + tooltipBox.width / 2 < 100;
65690         if (tooltipBox.top + tooltipBox.height < 100 && !onLeftOrRightEdge) {
65691           side = "bottom";
65692           pos = [
65693             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65694             tooltipBox.top + tooltipBox.height
65695           ];
65696         } else if (tooltipBox.top > h3 - 140 && !onLeftOrRightEdge) {
65697           side = "top";
65698           pos = [
65699             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
65700             tooltipBox.top - tip.height
65701           ];
65702         } else {
65703           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
65704           if (_mainLocalizer.textDirection() === "rtl") {
65705             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
65706               side = "right";
65707               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65708             } else {
65709               side = "left";
65710               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65711             }
65712           } else {
65713             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w3 - 70) {
65714               side = "left";
65715               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
65716             } else {
65717               side = "right";
65718               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
65719             }
65720           }
65721         }
65722         if (options.duration !== 0 || !tooltip.classed(side)) {
65723           tooltip.call(uiToggle(true));
65724         }
65725         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
65726         var shiftY = 0;
65727         if (side === "left" || side === "right") {
65728           if (pos[1] < 60) {
65729             shiftY = 60 - pos[1];
65730           } else if (pos[1] + tip.height > h3 - 100) {
65731             shiftY = h3 - pos[1] - tip.height - 100;
65732           }
65733         }
65734         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
65735       } else {
65736         tooltip.classed("in", false).call(uiToggle(false));
65737       }
65738       curtain.cut(box, options.duration);
65739       return tooltip;
65740     };
65741     curtain.cut = function(datum2, duration) {
65742       darkness.datum(datum2).interrupt();
65743       var selection2;
65744       if (duration === 0) {
65745         selection2 = darkness;
65746       } else {
65747         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
65748       }
65749       selection2.attr("d", function(d2) {
65750         var containerWidth = containerNode.clientWidth;
65751         var containerHeight = containerNode.clientHeight;
65752         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
65753         if (!d2) return string;
65754         return string + "M" + d2.left + "," + d2.top + "L" + d2.left + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + d2.top + "Z";
65755       });
65756     };
65757     curtain.remove = function() {
65758       surface.remove();
65759       tooltip.remove();
65760       select_default2(window).on("resize.curtain", null);
65761     };
65762     function copyBox(src) {
65763       return {
65764         top: src.top,
65765         right: src.right,
65766         bottom: src.bottom,
65767         left: src.left,
65768         width: src.width,
65769         height: src.height
65770       };
65771     }
65772     return curtain;
65773   }
65774   var init_curtain = __esm({
65775     "modules/ui/curtain.js"() {
65776       "use strict";
65777       init_src10();
65778       init_src5();
65779       init_localizer();
65780       init_toggle();
65781     }
65782   });
65783
65784   // modules/ui/intro/welcome.js
65785   var welcome_exports = {};
65786   __export(welcome_exports, {
65787     uiIntroWelcome: () => uiIntroWelcome
65788   });
65789   function uiIntroWelcome(context, reveal) {
65790     var dispatch14 = dispatch_default("done");
65791     var chapter = {
65792       title: "intro.welcome.title"
65793     };
65794     function welcome() {
65795       context.map().centerZoom([-85.63591, 41.94285], 19);
65796       reveal(
65797         ".intro-nav-wrap .chapter-welcome",
65798         helpHtml("intro.welcome.welcome"),
65799         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
65800       );
65801     }
65802     function practice() {
65803       reveal(
65804         ".intro-nav-wrap .chapter-welcome",
65805         helpHtml("intro.welcome.practice"),
65806         { buttonText: _t.html("intro.ok"), buttonCallback: words }
65807       );
65808     }
65809     function words() {
65810       reveal(
65811         ".intro-nav-wrap .chapter-welcome",
65812         helpHtml("intro.welcome.words"),
65813         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
65814       );
65815     }
65816     function chapters() {
65817       dispatch14.call("done");
65818       reveal(
65819         ".intro-nav-wrap .chapter-navigation",
65820         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
65821       );
65822     }
65823     chapter.enter = function() {
65824       welcome();
65825     };
65826     chapter.exit = function() {
65827       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
65828     };
65829     chapter.restart = function() {
65830       chapter.exit();
65831       chapter.enter();
65832     };
65833     return utilRebind(chapter, dispatch14, "on");
65834   }
65835   var init_welcome = __esm({
65836     "modules/ui/intro/welcome.js"() {
65837       "use strict";
65838       init_src4();
65839       init_helper();
65840       init_localizer();
65841       init_rebind();
65842     }
65843   });
65844
65845   // modules/ui/intro/navigation.js
65846   var navigation_exports = {};
65847   __export(navigation_exports, {
65848     uiIntroNavigation: () => uiIntroNavigation
65849   });
65850   function uiIntroNavigation(context, reveal) {
65851     var dispatch14 = dispatch_default("done");
65852     var timeouts = [];
65853     var hallId = "n2061";
65854     var townHall = [-85.63591, 41.94285];
65855     var springStreetId = "w397";
65856     var springStreetEndId = "n1834";
65857     var springStreet = [-85.63582, 41.94255];
65858     var onewayField = _mainPresetIndex.field("oneway");
65859     var maxspeedField = _mainPresetIndex.field("maxspeed");
65860     var chapter = {
65861       title: "intro.navigation.title"
65862     };
65863     function timeout2(f2, t2) {
65864       timeouts.push(window.setTimeout(f2, t2));
65865     }
65866     function eventCancel(d3_event) {
65867       d3_event.stopPropagation();
65868       d3_event.preventDefault();
65869     }
65870     function isTownHallSelected() {
65871       var ids = context.selectedIDs();
65872       return ids.length === 1 && ids[0] === hallId;
65873     }
65874     function dragMap() {
65875       context.enter(modeBrowse(context));
65876       context.history().reset("initial");
65877       var msec = transitionTime(townHall, context.map().center());
65878       if (msec) {
65879         reveal(null, null, { duration: 0 });
65880       }
65881       context.map().centerZoomEase(townHall, 19, msec);
65882       timeout2(function() {
65883         var centerStart = context.map().center();
65884         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
65885         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
65886         reveal(".main-map .surface", dragString);
65887         context.map().on("drawn.intro", function() {
65888           reveal(".main-map .surface", dragString, { duration: 0 });
65889         });
65890         context.map().on("move.intro", function() {
65891           var centerNow = context.map().center();
65892           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
65893             context.map().on("move.intro", null);
65894             timeout2(function() {
65895               continueTo(zoomMap);
65896             }, 3e3);
65897           }
65898         });
65899       }, msec + 100);
65900       function continueTo(nextStep) {
65901         context.map().on("move.intro drawn.intro", null);
65902         nextStep();
65903       }
65904     }
65905     function zoomMap() {
65906       var zoomStart = context.map().zoom();
65907       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
65908       var zoomString = helpHtml("intro.navigation." + textId);
65909       reveal(".main-map .surface", zoomString);
65910       context.map().on("drawn.intro", function() {
65911         reveal(".main-map .surface", zoomString, { duration: 0 });
65912       });
65913       context.map().on("move.intro", function() {
65914         if (context.map().zoom() !== zoomStart) {
65915           context.map().on("move.intro", null);
65916           timeout2(function() {
65917             continueTo(features);
65918           }, 3e3);
65919         }
65920       });
65921       function continueTo(nextStep) {
65922         context.map().on("move.intro drawn.intro", null);
65923         nextStep();
65924       }
65925     }
65926     function features() {
65927       var onClick = function() {
65928         continueTo(pointsLinesAreas);
65929       };
65930       reveal(
65931         ".main-map .surface",
65932         helpHtml("intro.navigation.features"),
65933         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65934       );
65935       context.map().on("drawn.intro", function() {
65936         reveal(
65937           ".main-map .surface",
65938           helpHtml("intro.navigation.features"),
65939           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65940         );
65941       });
65942       function continueTo(nextStep) {
65943         context.map().on("drawn.intro", null);
65944         nextStep();
65945       }
65946     }
65947     function pointsLinesAreas() {
65948       var onClick = function() {
65949         continueTo(nodesWays);
65950       };
65951       reveal(
65952         ".main-map .surface",
65953         helpHtml("intro.navigation.points_lines_areas"),
65954         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65955       );
65956       context.map().on("drawn.intro", function() {
65957         reveal(
65958           ".main-map .surface",
65959           helpHtml("intro.navigation.points_lines_areas"),
65960           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65961         );
65962       });
65963       function continueTo(nextStep) {
65964         context.map().on("drawn.intro", null);
65965         nextStep();
65966       }
65967     }
65968     function nodesWays() {
65969       var onClick = function() {
65970         continueTo(clickTownHall);
65971       };
65972       reveal(
65973         ".main-map .surface",
65974         helpHtml("intro.navigation.nodes_ways"),
65975         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65976       );
65977       context.map().on("drawn.intro", function() {
65978         reveal(
65979           ".main-map .surface",
65980           helpHtml("intro.navigation.nodes_ways"),
65981           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
65982         );
65983       });
65984       function continueTo(nextStep) {
65985         context.map().on("drawn.intro", null);
65986         nextStep();
65987       }
65988     }
65989     function clickTownHall() {
65990       context.enter(modeBrowse(context));
65991       context.history().reset("initial");
65992       var entity = context.hasEntity(hallId);
65993       if (!entity) return;
65994       reveal(null, null, { duration: 0 });
65995       context.map().centerZoomEase(entity.loc, 19, 500);
65996       timeout2(function() {
65997         var entity2 = context.hasEntity(hallId);
65998         if (!entity2) return;
65999         var box = pointBox(entity2.loc, context);
66000         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
66001         reveal(box, helpHtml("intro.navigation." + textId));
66002         context.map().on("move.intro drawn.intro", function() {
66003           var entity3 = context.hasEntity(hallId);
66004           if (!entity3) return;
66005           var box2 = pointBox(entity3.loc, context);
66006           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
66007         });
66008         context.on("enter.intro", function() {
66009           if (isTownHallSelected()) continueTo(selectedTownHall);
66010         });
66011       }, 550);
66012       context.history().on("change.intro", function() {
66013         if (!context.hasEntity(hallId)) {
66014           continueTo(clickTownHall);
66015         }
66016       });
66017       function continueTo(nextStep) {
66018         context.on("enter.intro", null);
66019         context.map().on("move.intro drawn.intro", null);
66020         context.history().on("change.intro", null);
66021         nextStep();
66022       }
66023     }
66024     function selectedTownHall() {
66025       if (!isTownHallSelected()) return clickTownHall();
66026       var entity = context.hasEntity(hallId);
66027       if (!entity) return clickTownHall();
66028       var box = pointBox(entity.loc, context);
66029       var onClick = function() {
66030         continueTo(editorTownHall);
66031       };
66032       reveal(
66033         box,
66034         helpHtml("intro.navigation.selected_townhall"),
66035         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66036       );
66037       context.map().on("move.intro drawn.intro", function() {
66038         var entity2 = context.hasEntity(hallId);
66039         if (!entity2) return;
66040         var box2 = pointBox(entity2.loc, context);
66041         reveal(
66042           box2,
66043           helpHtml("intro.navigation.selected_townhall"),
66044           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66045         );
66046       });
66047       context.history().on("change.intro", function() {
66048         if (!context.hasEntity(hallId)) {
66049           continueTo(clickTownHall);
66050         }
66051       });
66052       function continueTo(nextStep) {
66053         context.map().on("move.intro drawn.intro", null);
66054         context.history().on("change.intro", null);
66055         nextStep();
66056       }
66057     }
66058     function editorTownHall() {
66059       if (!isTownHallSelected()) return clickTownHall();
66060       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66061       var onClick = function() {
66062         continueTo(presetTownHall);
66063       };
66064       reveal(
66065         ".entity-editor-pane",
66066         helpHtml("intro.navigation.editor_townhall"),
66067         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66068       );
66069       context.on("exit.intro", function() {
66070         continueTo(clickTownHall);
66071       });
66072       context.history().on("change.intro", function() {
66073         if (!context.hasEntity(hallId)) {
66074           continueTo(clickTownHall);
66075         }
66076       });
66077       function continueTo(nextStep) {
66078         context.on("exit.intro", null);
66079         context.history().on("change.intro", null);
66080         context.container().select(".inspector-wrap").on("wheel.intro", null);
66081         nextStep();
66082       }
66083     }
66084     function presetTownHall() {
66085       if (!isTownHallSelected()) return clickTownHall();
66086       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66087       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66088       var entity = context.entity(context.selectedIDs()[0]);
66089       var preset = _mainPresetIndex.match(entity, context.graph());
66090       var onClick = function() {
66091         continueTo(fieldsTownHall);
66092       };
66093       reveal(
66094         ".entity-editor-pane .section-feature-type",
66095         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
66096         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66097       );
66098       context.on("exit.intro", function() {
66099         continueTo(clickTownHall);
66100       });
66101       context.history().on("change.intro", function() {
66102         if (!context.hasEntity(hallId)) {
66103           continueTo(clickTownHall);
66104         }
66105       });
66106       function continueTo(nextStep) {
66107         context.on("exit.intro", null);
66108         context.history().on("change.intro", null);
66109         context.container().select(".inspector-wrap").on("wheel.intro", null);
66110         nextStep();
66111       }
66112     }
66113     function fieldsTownHall() {
66114       if (!isTownHallSelected()) return clickTownHall();
66115       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66116       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66117       var onClick = function() {
66118         continueTo(closeTownHall);
66119       };
66120       reveal(
66121         ".entity-editor-pane .section-preset-fields",
66122         helpHtml("intro.navigation.fields_townhall"),
66123         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66124       );
66125       context.on("exit.intro", function() {
66126         continueTo(clickTownHall);
66127       });
66128       context.history().on("change.intro", function() {
66129         if (!context.hasEntity(hallId)) {
66130           continueTo(clickTownHall);
66131         }
66132       });
66133       function continueTo(nextStep) {
66134         context.on("exit.intro", null);
66135         context.history().on("change.intro", null);
66136         context.container().select(".inspector-wrap").on("wheel.intro", null);
66137         nextStep();
66138       }
66139     }
66140     function closeTownHall() {
66141       if (!isTownHallSelected()) return clickTownHall();
66142       var selector = ".entity-editor-pane button.close svg use";
66143       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66144       reveal(
66145         ".entity-editor-pane",
66146         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
66147       );
66148       context.on("exit.intro", function() {
66149         continueTo(searchStreet);
66150       });
66151       context.history().on("change.intro", function() {
66152         var selector2 = ".entity-editor-pane button.close svg use";
66153         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66154         reveal(
66155           ".entity-editor-pane",
66156           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
66157           { duration: 0 }
66158         );
66159       });
66160       function continueTo(nextStep) {
66161         context.on("exit.intro", null);
66162         context.history().on("change.intro", null);
66163         nextStep();
66164       }
66165     }
66166     function searchStreet() {
66167       context.enter(modeBrowse(context));
66168       context.history().reset("initial");
66169       var msec = transitionTime(springStreet, context.map().center());
66170       if (msec) {
66171         reveal(null, null, { duration: 0 });
66172       }
66173       context.map().centerZoomEase(springStreet, 19, msec);
66174       timeout2(function() {
66175         reveal(
66176           ".search-header input",
66177           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
66178         );
66179         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
66180       }, msec + 100);
66181     }
66182     function checkSearchResult() {
66183       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
66184       var firstName = first.select(".entity-name");
66185       var name = _t("intro.graph.name.spring-street");
66186       if (!firstName.empty() && firstName.html() === name) {
66187         reveal(
66188           first.node(),
66189           helpHtml("intro.navigation.choose_street", { name }),
66190           { duration: 300 }
66191         );
66192         context.on("exit.intro", function() {
66193           continueTo(selectedStreet);
66194         });
66195         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66196       }
66197       function continueTo(nextStep) {
66198         context.on("exit.intro", null);
66199         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
66200         nextStep();
66201       }
66202     }
66203     function selectedStreet() {
66204       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66205         return searchStreet();
66206       }
66207       var onClick = function() {
66208         continueTo(editorStreet);
66209       };
66210       var entity = context.entity(springStreetEndId);
66211       var box = pointBox(entity.loc, context);
66212       box.height = 500;
66213       reveal(
66214         box,
66215         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66216         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66217       );
66218       timeout2(function() {
66219         context.map().on("move.intro drawn.intro", function() {
66220           var entity2 = context.hasEntity(springStreetEndId);
66221           if (!entity2) return;
66222           var box2 = pointBox(entity2.loc, context);
66223           box2.height = 500;
66224           reveal(
66225             box2,
66226             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
66227             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
66228           );
66229         });
66230       }, 600);
66231       context.on("enter.intro", function(mode) {
66232         if (!context.hasEntity(springStreetId)) {
66233           return continueTo(searchStreet);
66234         }
66235         var ids = context.selectedIDs();
66236         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
66237           context.enter(modeSelect(context, [springStreetId]));
66238         }
66239       });
66240       context.history().on("change.intro", function() {
66241         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
66242           timeout2(function() {
66243             continueTo(searchStreet);
66244           }, 300);
66245         }
66246       });
66247       function continueTo(nextStep) {
66248         context.map().on("move.intro drawn.intro", null);
66249         context.on("enter.intro", null);
66250         context.history().on("change.intro", null);
66251         nextStep();
66252       }
66253     }
66254     function editorStreet() {
66255       var selector = ".entity-editor-pane button.close svg use";
66256       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66257       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66258         button: { html: icon(href, "inline") },
66259         field1: onewayField.title(),
66260         field2: maxspeedField.title()
66261       }));
66262       context.on("exit.intro", function() {
66263         continueTo(play);
66264       });
66265       context.history().on("change.intro", function() {
66266         var selector2 = ".entity-editor-pane button.close svg use";
66267         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
66268         reveal(
66269           ".entity-editor-pane",
66270           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
66271             button: { html: icon(href2, "inline") },
66272             field1: onewayField.title(),
66273             field2: maxspeedField.title()
66274           }),
66275           { duration: 0 }
66276         );
66277       });
66278       function continueTo(nextStep) {
66279         context.on("exit.intro", null);
66280         context.history().on("change.intro", null);
66281         nextStep();
66282       }
66283     }
66284     function play() {
66285       dispatch14.call("done");
66286       reveal(
66287         ".ideditor",
66288         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
66289         {
66290           tooltipBox: ".intro-nav-wrap .chapter-point",
66291           buttonText: _t.html("intro.ok"),
66292           buttonCallback: function() {
66293             reveal(".ideditor");
66294           }
66295         }
66296       );
66297     }
66298     chapter.enter = function() {
66299       dragMap();
66300     };
66301     chapter.exit = function() {
66302       timeouts.forEach(window.clearTimeout);
66303       context.on("enter.intro exit.intro", null);
66304       context.map().on("move.intro drawn.intro", null);
66305       context.history().on("change.intro", null);
66306       context.container().select(".inspector-wrap").on("wheel.intro", null);
66307       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
66308     };
66309     chapter.restart = function() {
66310       chapter.exit();
66311       chapter.enter();
66312     };
66313     return utilRebind(chapter, dispatch14, "on");
66314   }
66315   var init_navigation = __esm({
66316     "modules/ui/intro/navigation.js"() {
66317       "use strict";
66318       init_src4();
66319       init_src5();
66320       init_presets();
66321       init_localizer();
66322       init_browse();
66323       init_select5();
66324       init_rebind();
66325       init_helper();
66326     }
66327   });
66328
66329   // modules/ui/intro/point.js
66330   var point_exports = {};
66331   __export(point_exports, {
66332     uiIntroPoint: () => uiIntroPoint
66333   });
66334   function uiIntroPoint(context, reveal) {
66335     var dispatch14 = dispatch_default("done");
66336     var timeouts = [];
66337     var intersection2 = [-85.63279, 41.94394];
66338     var building = [-85.632422, 41.944045];
66339     var cafePreset = _mainPresetIndex.item("amenity/cafe");
66340     var _pointID = null;
66341     var chapter = {
66342       title: "intro.points.title"
66343     };
66344     function timeout2(f2, t2) {
66345       timeouts.push(window.setTimeout(f2, t2));
66346     }
66347     function eventCancel(d3_event) {
66348       d3_event.stopPropagation();
66349       d3_event.preventDefault();
66350     }
66351     function addPoint() {
66352       context.enter(modeBrowse(context));
66353       context.history().reset("initial");
66354       var msec = transitionTime(intersection2, context.map().center());
66355       if (msec) {
66356         reveal(null, null, { duration: 0 });
66357       }
66358       context.map().centerZoomEase(intersection2, 19, msec);
66359       timeout2(function() {
66360         var tooltip = reveal(
66361           "button.add-point",
66362           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
66363         );
66364         _pointID = null;
66365         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
66366         context.on("enter.intro", function(mode) {
66367           if (mode.id !== "add-point") return;
66368           continueTo(placePoint);
66369         });
66370       }, msec + 100);
66371       function continueTo(nextStep) {
66372         context.on("enter.intro", null);
66373         nextStep();
66374       }
66375     }
66376     function placePoint() {
66377       if (context.mode().id !== "add-point") {
66378         return chapter.restart();
66379       }
66380       var pointBox2 = pad2(building, 150, context);
66381       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
66382       reveal(pointBox2, helpHtml("intro.points." + textId));
66383       context.map().on("move.intro drawn.intro", function() {
66384         pointBox2 = pad2(building, 150, context);
66385         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
66386       });
66387       context.on("enter.intro", function(mode) {
66388         if (mode.id !== "select") return chapter.restart();
66389         _pointID = context.mode().selectedIDs()[0];
66390         if (context.graph().geometry(_pointID) === "vertex") {
66391           context.map().on("move.intro drawn.intro", null);
66392           context.on("enter.intro", null);
66393           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
66394             buttonText: _t.html("intro.ok"),
66395             buttonCallback: function() {
66396               return chapter.restart();
66397             }
66398           });
66399         } else {
66400           continueTo(searchPreset);
66401         }
66402       });
66403       function continueTo(nextStep) {
66404         context.map().on("move.intro drawn.intro", null);
66405         context.on("enter.intro", null);
66406         nextStep();
66407       }
66408     }
66409     function searchPreset() {
66410       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66411         return addPoint();
66412       }
66413       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66414       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66415       reveal(
66416         ".preset-search-input",
66417         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66418       );
66419       context.on("enter.intro", function(mode) {
66420         if (!_pointID || !context.hasEntity(_pointID)) {
66421           return continueTo(addPoint);
66422         }
66423         var ids = context.selectedIDs();
66424         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
66425           context.enter(modeSelect(context, [_pointID]));
66426           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66427           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66428           reveal(
66429             ".preset-search-input",
66430             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
66431           );
66432           context.history().on("change.intro", null);
66433         }
66434       });
66435       function checkPresetSearch() {
66436         var first = context.container().select(".preset-list-item:first-child");
66437         if (first.classed("preset-amenity-cafe")) {
66438           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66439           reveal(
66440             first.select(".preset-list-button").node(),
66441             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
66442             { duration: 300 }
66443           );
66444           context.history().on("change.intro", function() {
66445             continueTo(aboutFeatureEditor);
66446           });
66447         }
66448       }
66449       function continueTo(nextStep) {
66450         context.on("enter.intro", null);
66451         context.history().on("change.intro", null);
66452         context.container().select(".inspector-wrap").on("wheel.intro", null);
66453         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66454         nextStep();
66455       }
66456     }
66457     function aboutFeatureEditor() {
66458       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66459         return addPoint();
66460       }
66461       timeout2(function() {
66462         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
66463           tooltipClass: "intro-points-describe",
66464           buttonText: _t.html("intro.ok"),
66465           buttonCallback: function() {
66466             continueTo(addName);
66467           }
66468         });
66469       }, 400);
66470       context.on("exit.intro", function() {
66471         continueTo(reselectPoint);
66472       });
66473       function continueTo(nextStep) {
66474         context.on("exit.intro", null);
66475         nextStep();
66476       }
66477     }
66478     function addName() {
66479       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66480         return addPoint();
66481       }
66482       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66483       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name") + "{br}" + helpHtml("intro.points.add_reminder");
66484       timeout2(function() {
66485         var entity = context.entity(_pointID);
66486         if (entity.tags.name) {
66487           var tooltip = reveal(".entity-editor-pane", addNameString, {
66488             tooltipClass: "intro-points-describe",
66489             buttonText: _t.html("intro.ok"),
66490             buttonCallback: function() {
66491               continueTo(addCloseEditor);
66492             }
66493           });
66494           tooltip.select(".instruction").style("display", "none");
66495         } else {
66496           reveal(
66497             ".entity-editor-pane",
66498             addNameString,
66499             { tooltipClass: "intro-points-describe" }
66500           );
66501         }
66502       }, 400);
66503       context.history().on("change.intro", function() {
66504         continueTo(addCloseEditor);
66505       });
66506       context.on("exit.intro", function() {
66507         continueTo(reselectPoint);
66508       });
66509       function continueTo(nextStep) {
66510         context.on("exit.intro", null);
66511         context.history().on("change.intro", null);
66512         nextStep();
66513       }
66514     }
66515     function addCloseEditor() {
66516       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66517       var selector = ".entity-editor-pane button.close svg use";
66518       var href = select_default2(selector).attr("href") || "#iD-icon-close";
66519       context.on("exit.intro", function() {
66520         continueTo(reselectPoint);
66521       });
66522       reveal(
66523         ".entity-editor-pane",
66524         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
66525       );
66526       function continueTo(nextStep) {
66527         context.on("exit.intro", null);
66528         nextStep();
66529       }
66530     }
66531     function reselectPoint() {
66532       if (!_pointID) return chapter.restart();
66533       var entity = context.hasEntity(_pointID);
66534       if (!entity) return chapter.restart();
66535       var oldPreset = _mainPresetIndex.match(entity, context.graph());
66536       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
66537       context.enter(modeBrowse(context));
66538       var msec = transitionTime(entity.loc, context.map().center());
66539       if (msec) {
66540         reveal(null, null, { duration: 0 });
66541       }
66542       context.map().centerEase(entity.loc, msec);
66543       timeout2(function() {
66544         var box = pointBox(entity.loc, context);
66545         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
66546         timeout2(function() {
66547           context.map().on("move.intro drawn.intro", function() {
66548             var entity2 = context.hasEntity(_pointID);
66549             if (!entity2) return chapter.restart();
66550             var box2 = pointBox(entity2.loc, context);
66551             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
66552           });
66553         }, 600);
66554         context.on("enter.intro", function(mode) {
66555           if (mode.id !== "select") return;
66556           continueTo(updatePoint);
66557         });
66558       }, msec + 100);
66559       function continueTo(nextStep) {
66560         context.map().on("move.intro drawn.intro", null);
66561         context.on("enter.intro", null);
66562         nextStep();
66563       }
66564     }
66565     function updatePoint() {
66566       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66567         return continueTo(reselectPoint);
66568       }
66569       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66570       context.on("exit.intro", function() {
66571         continueTo(reselectPoint);
66572       });
66573       context.history().on("change.intro", function() {
66574         continueTo(updateCloseEditor);
66575       });
66576       timeout2(function() {
66577         reveal(
66578           ".entity-editor-pane",
66579           helpHtml("intro.points.update"),
66580           { tooltipClass: "intro-points-describe" }
66581         );
66582       }, 400);
66583       function continueTo(nextStep) {
66584         context.on("exit.intro", null);
66585         context.history().on("change.intro", null);
66586         nextStep();
66587       }
66588     }
66589     function updateCloseEditor() {
66590       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
66591         return continueTo(reselectPoint);
66592       }
66593       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66594       context.on("exit.intro", function() {
66595         continueTo(rightClickPoint);
66596       });
66597       timeout2(function() {
66598         reveal(
66599           ".entity-editor-pane",
66600           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
66601         );
66602       }, 500);
66603       function continueTo(nextStep) {
66604         context.on("exit.intro", null);
66605         nextStep();
66606       }
66607     }
66608     function rightClickPoint() {
66609       if (!_pointID) return chapter.restart();
66610       var entity = context.hasEntity(_pointID);
66611       if (!entity) return chapter.restart();
66612       context.enter(modeBrowse(context));
66613       var box = pointBox(entity.loc, context);
66614       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
66615       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
66616       timeout2(function() {
66617         context.map().on("move.intro", function() {
66618           var entity2 = context.hasEntity(_pointID);
66619           if (!entity2) return chapter.restart();
66620           var box2 = pointBox(entity2.loc, context);
66621           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
66622         });
66623       }, 600);
66624       context.on("enter.intro", function(mode) {
66625         if (mode.id !== "select") return;
66626         var ids = context.selectedIDs();
66627         if (ids.length !== 1 || ids[0] !== _pointID) return;
66628         timeout2(function() {
66629           var node = selectMenuItem(context, "delete").node();
66630           if (!node) return;
66631           continueTo(enterDelete);
66632         }, 50);
66633       });
66634       function continueTo(nextStep) {
66635         context.on("enter.intro", null);
66636         context.map().on("move.intro", null);
66637         nextStep();
66638       }
66639     }
66640     function enterDelete() {
66641       if (!_pointID) return chapter.restart();
66642       var entity = context.hasEntity(_pointID);
66643       if (!entity) return chapter.restart();
66644       var node = selectMenuItem(context, "delete").node();
66645       if (!node) {
66646         return continueTo(rightClickPoint);
66647       }
66648       reveal(
66649         ".edit-menu",
66650         helpHtml("intro.points.delete"),
66651         { padding: 50 }
66652       );
66653       timeout2(function() {
66654         context.map().on("move.intro", function() {
66655           if (selectMenuItem(context, "delete").empty()) {
66656             return continueTo(rightClickPoint);
66657           }
66658           reveal(
66659             ".edit-menu",
66660             helpHtml("intro.points.delete"),
66661             { duration: 0, padding: 50 }
66662           );
66663         });
66664       }, 300);
66665       context.on("exit.intro", function() {
66666         if (!_pointID) return chapter.restart();
66667         var entity2 = context.hasEntity(_pointID);
66668         if (entity2) return continueTo(rightClickPoint);
66669       });
66670       context.history().on("change.intro", function(changed) {
66671         if (changed.deleted().length) {
66672           continueTo(undo);
66673         }
66674       });
66675       function continueTo(nextStep) {
66676         context.map().on("move.intro", null);
66677         context.history().on("change.intro", null);
66678         context.on("exit.intro", null);
66679         nextStep();
66680       }
66681     }
66682     function undo() {
66683       context.history().on("change.intro", function() {
66684         continueTo(play);
66685       });
66686       reveal(
66687         ".top-toolbar button.undo-button",
66688         helpHtml("intro.points.undo")
66689       );
66690       function continueTo(nextStep) {
66691         context.history().on("change.intro", null);
66692         nextStep();
66693       }
66694     }
66695     function play() {
66696       dispatch14.call("done");
66697       reveal(
66698         ".ideditor",
66699         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
66700         {
66701           tooltipBox: ".intro-nav-wrap .chapter-area",
66702           buttonText: _t.html("intro.ok"),
66703           buttonCallback: function() {
66704             reveal(".ideditor");
66705           }
66706         }
66707       );
66708     }
66709     chapter.enter = function() {
66710       addPoint();
66711     };
66712     chapter.exit = function() {
66713       timeouts.forEach(window.clearTimeout);
66714       context.on("enter.intro exit.intro", null);
66715       context.map().on("move.intro drawn.intro", null);
66716       context.history().on("change.intro", null);
66717       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66718       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66719     };
66720     chapter.restart = function() {
66721       chapter.exit();
66722       chapter.enter();
66723     };
66724     return utilRebind(chapter, dispatch14, "on");
66725   }
66726   var init_point = __esm({
66727     "modules/ui/intro/point.js"() {
66728       "use strict";
66729       init_src4();
66730       init_src5();
66731       init_presets();
66732       init_localizer();
66733       init_change_preset();
66734       init_browse();
66735       init_select5();
66736       init_rebind();
66737       init_helper();
66738     }
66739   });
66740
66741   // modules/ui/intro/area.js
66742   var area_exports = {};
66743   __export(area_exports, {
66744     uiIntroArea: () => uiIntroArea
66745   });
66746   function uiIntroArea(context, reveal) {
66747     var dispatch14 = dispatch_default("done");
66748     var playground = [-85.63552, 41.94159];
66749     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
66750     var nameField = _mainPresetIndex.field("name");
66751     var descriptionField = _mainPresetIndex.field("description");
66752     var timeouts = [];
66753     var _areaID;
66754     var chapter = {
66755       title: "intro.areas.title"
66756     };
66757     function timeout2(f2, t2) {
66758       timeouts.push(window.setTimeout(f2, t2));
66759     }
66760     function eventCancel(d3_event) {
66761       d3_event.stopPropagation();
66762       d3_event.preventDefault();
66763     }
66764     function revealPlayground(center, text, options) {
66765       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
66766       var box = pad2(center, padding, context);
66767       reveal(box, text, options);
66768     }
66769     function addArea() {
66770       context.enter(modeBrowse(context));
66771       context.history().reset("initial");
66772       _areaID = null;
66773       var msec = transitionTime(playground, context.map().center());
66774       if (msec) {
66775         reveal(null, null, { duration: 0 });
66776       }
66777       context.map().centerZoomEase(playground, 19, msec);
66778       timeout2(function() {
66779         var tooltip = reveal(
66780           "button.add-area",
66781           helpHtml("intro.areas.add_playground")
66782         );
66783         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
66784         context.on("enter.intro", function(mode) {
66785           if (mode.id !== "add-area") return;
66786           continueTo(startPlayground);
66787         });
66788       }, msec + 100);
66789       function continueTo(nextStep) {
66790         context.on("enter.intro", null);
66791         nextStep();
66792       }
66793     }
66794     function startPlayground() {
66795       if (context.mode().id !== "add-area") {
66796         return chapter.restart();
66797       }
66798       _areaID = null;
66799       context.map().zoomEase(19.5, 500);
66800       timeout2(function() {
66801         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
66802         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
66803         revealPlayground(
66804           playground,
66805           startDrawString,
66806           { duration: 250 }
66807         );
66808         timeout2(function() {
66809           context.map().on("move.intro drawn.intro", function() {
66810             revealPlayground(
66811               playground,
66812               startDrawString,
66813               { duration: 0 }
66814             );
66815           });
66816           context.on("enter.intro", function(mode) {
66817             if (mode.id !== "draw-area") return chapter.restart();
66818             continueTo(continuePlayground);
66819           });
66820         }, 250);
66821       }, 550);
66822       function continueTo(nextStep) {
66823         context.map().on("move.intro drawn.intro", null);
66824         context.on("enter.intro", null);
66825         nextStep();
66826       }
66827     }
66828     function continuePlayground() {
66829       if (context.mode().id !== "draw-area") {
66830         return chapter.restart();
66831       }
66832       _areaID = null;
66833       revealPlayground(
66834         playground,
66835         helpHtml("intro.areas.continue_playground"),
66836         { duration: 250 }
66837       );
66838       timeout2(function() {
66839         context.map().on("move.intro drawn.intro", function() {
66840           revealPlayground(
66841             playground,
66842             helpHtml("intro.areas.continue_playground"),
66843             { duration: 0 }
66844           );
66845         });
66846       }, 250);
66847       context.on("enter.intro", function(mode) {
66848         if (mode.id === "draw-area") {
66849           var entity = context.hasEntity(context.selectedIDs()[0]);
66850           if (entity && entity.nodes.length >= 6) {
66851             return continueTo(finishPlayground);
66852           } else {
66853             return;
66854           }
66855         } else if (mode.id === "select") {
66856           _areaID = context.selectedIDs()[0];
66857           return continueTo(searchPresets);
66858         } else {
66859           return chapter.restart();
66860         }
66861       });
66862       function continueTo(nextStep) {
66863         context.map().on("move.intro drawn.intro", null);
66864         context.on("enter.intro", null);
66865         nextStep();
66866       }
66867     }
66868     function finishPlayground() {
66869       if (context.mode().id !== "draw-area") {
66870         return chapter.restart();
66871       }
66872       _areaID = null;
66873       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
66874       revealPlayground(
66875         playground,
66876         finishString,
66877         { duration: 250 }
66878       );
66879       timeout2(function() {
66880         context.map().on("move.intro drawn.intro", function() {
66881           revealPlayground(
66882             playground,
66883             finishString,
66884             { duration: 0 }
66885           );
66886         });
66887       }, 250);
66888       context.on("enter.intro", function(mode) {
66889         if (mode.id === "draw-area") {
66890           return;
66891         } else if (mode.id === "select") {
66892           _areaID = context.selectedIDs()[0];
66893           return continueTo(searchPresets);
66894         } else {
66895           return chapter.restart();
66896         }
66897       });
66898       function continueTo(nextStep) {
66899         context.map().on("move.intro drawn.intro", null);
66900         context.on("enter.intro", null);
66901         nextStep();
66902       }
66903     }
66904     function searchPresets() {
66905       if (!_areaID || !context.hasEntity(_areaID)) {
66906         return addArea();
66907       }
66908       var ids = context.selectedIDs();
66909       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66910         context.enter(modeSelect(context, [_areaID]));
66911       }
66912       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66913       timeout2(function() {
66914         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66915         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66916         reveal(
66917           ".preset-search-input",
66918           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66919         );
66920       }, 400);
66921       context.on("enter.intro", function(mode) {
66922         if (!_areaID || !context.hasEntity(_areaID)) {
66923           return continueTo(addArea);
66924         }
66925         var ids2 = context.selectedIDs();
66926         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
66927           context.enter(modeSelect(context, [_areaID]));
66928           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
66929           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66930           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
66931           reveal(
66932             ".preset-search-input",
66933             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
66934           );
66935           context.history().on("change.intro", null);
66936         }
66937       });
66938       function checkPresetSearch() {
66939         var first = context.container().select(".preset-list-item:first-child");
66940         if (first.classed("preset-leisure-playground")) {
66941           reveal(
66942             first.select(".preset-list-button").node(),
66943             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
66944             { duration: 300 }
66945           );
66946           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
66947           context.history().on("change.intro", function() {
66948             continueTo(clickAddField);
66949           });
66950         }
66951       }
66952       function continueTo(nextStep) {
66953         context.container().select(".inspector-wrap").on("wheel.intro", null);
66954         context.on("enter.intro", null);
66955         context.history().on("change.intro", null);
66956         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
66957         nextStep();
66958       }
66959     }
66960     function clickAddField() {
66961       if (!_areaID || !context.hasEntity(_areaID)) {
66962         return addArea();
66963       }
66964       var ids = context.selectedIDs();
66965       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
66966         return searchPresets();
66967       }
66968       if (!context.container().select(".form-field-description").empty()) {
66969         return continueTo(describePlayground);
66970       }
66971       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
66972       timeout2(function() {
66973         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
66974         var entity = context.entity(_areaID);
66975         if (entity.tags.description) {
66976           return continueTo(play);
66977         }
66978         var box = context.container().select(".more-fields").node().getBoundingClientRect();
66979         if (box.top > 300) {
66980           var pane = context.container().select(".entity-editor-pane .inspector-body");
66981           var start2 = pane.node().scrollTop;
66982           var end = start2 + (box.top - 300);
66983           pane.transition().duration(250).tween("scroll.inspector", function() {
66984             var node = this;
66985             var i3 = number_default(start2, end);
66986             return function(t2) {
66987               node.scrollTop = i3(t2);
66988             };
66989           });
66990         }
66991         timeout2(function() {
66992           reveal(
66993             ".more-fields .combobox-input",
66994             helpHtml("intro.areas.add_field", {
66995               name: nameField.title(),
66996               description: descriptionField.title()
66997             }),
66998             { duration: 300 }
66999           );
67000           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
67001             var watcher;
67002             watcher = window.setInterval(function() {
67003               if (!context.container().select("div.combobox").empty()) {
67004                 window.clearInterval(watcher);
67005                 continueTo(chooseDescriptionField);
67006               }
67007             }, 300);
67008           });
67009         }, 300);
67010       }, 400);
67011       context.on("exit.intro", function() {
67012         return continueTo(searchPresets);
67013       });
67014       function continueTo(nextStep) {
67015         context.container().select(".inspector-wrap").on("wheel.intro", null);
67016         context.container().select(".more-fields .combobox-input").on("click.intro", null);
67017         context.on("exit.intro", null);
67018         nextStep();
67019       }
67020     }
67021     function chooseDescriptionField() {
67022       if (!_areaID || !context.hasEntity(_areaID)) {
67023         return addArea();
67024       }
67025       var ids = context.selectedIDs();
67026       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67027         return searchPresets();
67028       }
67029       if (!context.container().select(".form-field-description").empty()) {
67030         return continueTo(describePlayground);
67031       }
67032       if (context.container().select("div.combobox").empty()) {
67033         return continueTo(clickAddField);
67034       }
67035       var watcher;
67036       watcher = window.setInterval(function() {
67037         if (context.container().select("div.combobox").empty()) {
67038           window.clearInterval(watcher);
67039           timeout2(function() {
67040             if (context.container().select(".form-field-description").empty()) {
67041               continueTo(retryChooseDescription);
67042             } else {
67043               continueTo(describePlayground);
67044             }
67045           }, 300);
67046         }
67047       }, 300);
67048       reveal(
67049         "div.combobox",
67050         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
67051         { duration: 300 }
67052       );
67053       context.on("exit.intro", function() {
67054         return continueTo(searchPresets);
67055       });
67056       function continueTo(nextStep) {
67057         if (watcher) window.clearInterval(watcher);
67058         context.on("exit.intro", null);
67059         nextStep();
67060       }
67061     }
67062     function describePlayground() {
67063       if (!_areaID || !context.hasEntity(_areaID)) {
67064         return addArea();
67065       }
67066       var ids = context.selectedIDs();
67067       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67068         return searchPresets();
67069       }
67070       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67071       if (context.container().select(".form-field-description").empty()) {
67072         return continueTo(retryChooseDescription);
67073       }
67074       context.on("exit.intro", function() {
67075         continueTo(play);
67076       });
67077       reveal(
67078         ".entity-editor-pane",
67079         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
67080         { duration: 300 }
67081       );
67082       function continueTo(nextStep) {
67083         context.on("exit.intro", null);
67084         nextStep();
67085       }
67086     }
67087     function retryChooseDescription() {
67088       if (!_areaID || !context.hasEntity(_areaID)) {
67089         return addArea();
67090       }
67091       var ids = context.selectedIDs();
67092       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
67093         return searchPresets();
67094       }
67095       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
67096       reveal(
67097         ".entity-editor-pane",
67098         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
67099         {
67100           buttonText: _t.html("intro.ok"),
67101           buttonCallback: function() {
67102             continueTo(clickAddField);
67103           }
67104         }
67105       );
67106       context.on("exit.intro", function() {
67107         return continueTo(searchPresets);
67108       });
67109       function continueTo(nextStep) {
67110         context.on("exit.intro", null);
67111         nextStep();
67112       }
67113     }
67114     function play() {
67115       dispatch14.call("done");
67116       reveal(
67117         ".ideditor",
67118         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
67119         {
67120           tooltipBox: ".intro-nav-wrap .chapter-line",
67121           buttonText: _t.html("intro.ok"),
67122           buttonCallback: function() {
67123             reveal(".ideditor");
67124           }
67125         }
67126       );
67127     }
67128     chapter.enter = function() {
67129       addArea();
67130     };
67131     chapter.exit = function() {
67132       timeouts.forEach(window.clearTimeout);
67133       context.on("enter.intro exit.intro", null);
67134       context.map().on("move.intro drawn.intro", null);
67135       context.history().on("change.intro", null);
67136       context.container().select(".inspector-wrap").on("wheel.intro", null);
67137       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
67138       context.container().select(".more-fields .combobox-input").on("click.intro", null);
67139     };
67140     chapter.restart = function() {
67141       chapter.exit();
67142       chapter.enter();
67143     };
67144     return utilRebind(chapter, dispatch14, "on");
67145   }
67146   var init_area4 = __esm({
67147     "modules/ui/intro/area.js"() {
67148       "use strict";
67149       init_src4();
67150       init_src8();
67151       init_presets();
67152       init_localizer();
67153       init_browse();
67154       init_select5();
67155       init_rebind();
67156       init_helper();
67157     }
67158   });
67159
67160   // modules/ui/intro/line.js
67161   var line_exports = {};
67162   __export(line_exports, {
67163     uiIntroLine: () => uiIntroLine
67164   });
67165   function uiIntroLine(context, reveal) {
67166     var dispatch14 = dispatch_default("done");
67167     var timeouts = [];
67168     var _tulipRoadID = null;
67169     var flowerRoadID = "w646";
67170     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
67171     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
67172     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
67173     var roadCategory = _mainPresetIndex.item("category-road_minor");
67174     var residentialPreset = _mainPresetIndex.item("highway/residential");
67175     var woodRoadID = "w525";
67176     var woodRoadEndID = "n2862";
67177     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
67178     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
67179     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
67180     var washingtonStreetID = "w522";
67181     var twelfthAvenueID = "w1";
67182     var eleventhAvenueEndID = "n3550";
67183     var twelfthAvenueEndID = "n5";
67184     var _washingtonSegmentID = null;
67185     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
67186     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
67187     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
67188     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
67189     var chapter = {
67190       title: "intro.lines.title"
67191     };
67192     function timeout2(f2, t2) {
67193       timeouts.push(window.setTimeout(f2, t2));
67194     }
67195     function eventCancel(d3_event) {
67196       d3_event.stopPropagation();
67197       d3_event.preventDefault();
67198     }
67199     function addLine() {
67200       context.enter(modeBrowse(context));
67201       context.history().reset("initial");
67202       var msec = transitionTime(tulipRoadStart, context.map().center());
67203       if (msec) {
67204         reveal(null, null, { duration: 0 });
67205       }
67206       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
67207       timeout2(function() {
67208         var tooltip = reveal(
67209           "button.add-line",
67210           helpHtml("intro.lines.add_line")
67211         );
67212         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
67213         context.on("enter.intro", function(mode) {
67214           if (mode.id !== "add-line") return;
67215           continueTo(startLine);
67216         });
67217       }, msec + 100);
67218       function continueTo(nextStep) {
67219         context.on("enter.intro", null);
67220         nextStep();
67221       }
67222     }
67223     function startLine() {
67224       if (context.mode().id !== "add-line") return chapter.restart();
67225       _tulipRoadID = null;
67226       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
67227       var box = pad2(tulipRoadStart, padding, context);
67228       box.height = box.height + 100;
67229       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
67230       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
67231       reveal(box, startLineString);
67232       context.map().on("move.intro drawn.intro", function() {
67233         padding = 70 * Math.pow(2, context.map().zoom() - 18);
67234         box = pad2(tulipRoadStart, padding, context);
67235         box.height = box.height + 100;
67236         reveal(box, startLineString, { duration: 0 });
67237       });
67238       context.on("enter.intro", function(mode) {
67239         if (mode.id !== "draw-line") return chapter.restart();
67240         continueTo(drawLine);
67241       });
67242       function continueTo(nextStep) {
67243         context.map().on("move.intro drawn.intro", null);
67244         context.on("enter.intro", null);
67245         nextStep();
67246       }
67247     }
67248     function drawLine() {
67249       if (context.mode().id !== "draw-line") return chapter.restart();
67250       _tulipRoadID = context.mode().selectedIDs()[0];
67251       context.map().centerEase(tulipRoadMidpoint, 500);
67252       timeout2(function() {
67253         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67254         var box = pad2(tulipRoadMidpoint, padding, context);
67255         box.height = box.height * 2;
67256         reveal(
67257           box,
67258           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
67259         );
67260         context.map().on("move.intro drawn.intro", function() {
67261           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
67262           box = pad2(tulipRoadMidpoint, padding, context);
67263           box.height = box.height * 2;
67264           reveal(
67265             box,
67266             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
67267             { duration: 0 }
67268           );
67269         });
67270       }, 550);
67271       context.history().on("change.intro", function() {
67272         if (isLineConnected()) {
67273           continueTo(continueLine);
67274         }
67275       });
67276       context.on("enter.intro", function(mode) {
67277         if (mode.id === "draw-line") {
67278           return;
67279         } else if (mode.id === "select") {
67280           continueTo(retryIntersect);
67281           return;
67282         } else {
67283           return chapter.restart();
67284         }
67285       });
67286       function continueTo(nextStep) {
67287         context.map().on("move.intro drawn.intro", null);
67288         context.history().on("change.intro", null);
67289         context.on("enter.intro", null);
67290         nextStep();
67291       }
67292     }
67293     function isLineConnected() {
67294       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67295       if (!entity) return false;
67296       var drawNodes = context.graph().childNodes(entity);
67297       return drawNodes.some(function(node) {
67298         return context.graph().parentWays(node).some(function(parent2) {
67299           return parent2.id === flowerRoadID;
67300         });
67301       });
67302     }
67303     function retryIntersect() {
67304       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
67305       var box = pad2(tulipRoadIntersection, 80, context);
67306       reveal(
67307         box,
67308         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
67309       );
67310       timeout2(chapter.restart, 3e3);
67311     }
67312     function continueLine() {
67313       if (context.mode().id !== "draw-line") return chapter.restart();
67314       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
67315       if (!entity) return chapter.restart();
67316       context.map().centerEase(tulipRoadIntersection, 500);
67317       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
67318       reveal(".main-map .surface", continueLineText);
67319       context.on("enter.intro", function(mode) {
67320         if (mode.id === "draw-line") {
67321           return;
67322         } else if (mode.id === "select") {
67323           return continueTo(chooseCategoryRoad);
67324         } else {
67325           return chapter.restart();
67326         }
67327       });
67328       function continueTo(nextStep) {
67329         context.on("enter.intro", null);
67330         nextStep();
67331       }
67332     }
67333     function chooseCategoryRoad() {
67334       if (context.mode().id !== "select") return chapter.restart();
67335       context.on("exit.intro", function() {
67336         return chapter.restart();
67337       });
67338       var button = context.container().select(".preset-category-road_minor .preset-list-button");
67339       if (button.empty()) return chapter.restart();
67340       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67341       timeout2(function() {
67342         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
67343         reveal(
67344           button.node(),
67345           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
67346         );
67347         button.on("click.intro", function() {
67348           continueTo(choosePresetResidential);
67349         });
67350       }, 400);
67351       function continueTo(nextStep) {
67352         context.container().select(".inspector-wrap").on("wheel.intro", null);
67353         context.container().select(".preset-list-button").on("click.intro", null);
67354         context.on("exit.intro", null);
67355         nextStep();
67356       }
67357     }
67358     function choosePresetResidential() {
67359       if (context.mode().id !== "select") return chapter.restart();
67360       context.on("exit.intro", function() {
67361         return chapter.restart();
67362       });
67363       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
67364       if (subgrid.empty()) return chapter.restart();
67365       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
67366         continueTo(retryPresetResidential);
67367       });
67368       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
67369         continueTo(nameRoad);
67370       });
67371       timeout2(function() {
67372         reveal(
67373           subgrid.node(),
67374           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
67375           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
67376         );
67377       }, 300);
67378       function continueTo(nextStep) {
67379         context.container().select(".preset-list-button").on("click.intro", null);
67380         context.on("exit.intro", null);
67381         nextStep();
67382       }
67383     }
67384     function retryPresetResidential() {
67385       if (context.mode().id !== "select") return chapter.restart();
67386       context.on("exit.intro", function() {
67387         return chapter.restart();
67388       });
67389       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
67390       timeout2(function() {
67391         var button = context.container().select(".entity-editor-pane .preset-list-button");
67392         reveal(
67393           button.node(),
67394           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
67395         );
67396         button.on("click.intro", function() {
67397           continueTo(chooseCategoryRoad);
67398         });
67399       }, 500);
67400       function continueTo(nextStep) {
67401         context.container().select(".inspector-wrap").on("wheel.intro", null);
67402         context.container().select(".preset-list-button").on("click.intro", null);
67403         context.on("exit.intro", null);
67404         nextStep();
67405       }
67406     }
67407     function nameRoad() {
67408       context.on("exit.intro", function() {
67409         continueTo(didNameRoad);
67410       });
67411       timeout2(function() {
67412         reveal(
67413           ".entity-editor-pane",
67414           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
67415           { tooltipClass: "intro-lines-name_road" }
67416         );
67417       }, 500);
67418       function continueTo(nextStep) {
67419         context.on("exit.intro", null);
67420         nextStep();
67421       }
67422     }
67423     function didNameRoad() {
67424       context.history().checkpoint("doneAddLine");
67425       timeout2(function() {
67426         reveal(".main-map .surface", helpHtml("intro.lines.did_name_road"), {
67427           buttonText: _t.html("intro.ok"),
67428           buttonCallback: function() {
67429             continueTo(updateLine);
67430           }
67431         });
67432       }, 500);
67433       function continueTo(nextStep) {
67434         nextStep();
67435       }
67436     }
67437     function updateLine() {
67438       context.history().reset("doneAddLine");
67439       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67440         return chapter.restart();
67441       }
67442       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
67443       if (msec) {
67444         reveal(null, null, { duration: 0 });
67445       }
67446       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
67447       timeout2(function() {
67448         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
67449         var box = pad2(woodRoadDragMidpoint, padding, context);
67450         var advance = function() {
67451           continueTo(addNode);
67452         };
67453         reveal(
67454           box,
67455           helpHtml("intro.lines.update_line"),
67456           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67457         );
67458         context.map().on("move.intro drawn.intro", function() {
67459           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
67460           var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67461           reveal(
67462             box2,
67463             helpHtml("intro.lines.update_line"),
67464             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67465           );
67466         });
67467       }, msec + 100);
67468       function continueTo(nextStep) {
67469         context.map().on("move.intro drawn.intro", null);
67470         nextStep();
67471       }
67472     }
67473     function addNode() {
67474       context.history().reset("doneAddLine");
67475       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67476         return chapter.restart();
67477       }
67478       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
67479       var box = pad2(woodRoadAddNode, padding, context);
67480       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67481       reveal(box, addNodeString);
67482       context.map().on("move.intro drawn.intro", function() {
67483         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
67484         var box2 = pad2(woodRoadAddNode, padding2, context);
67485         reveal(box2, addNodeString, { duration: 0 });
67486       });
67487       context.history().on("change.intro", function(changed) {
67488         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67489           return continueTo(updateLine);
67490         }
67491         if (changed.created().length === 1) {
67492           timeout2(function() {
67493             continueTo(startDragEndpoint);
67494           }, 500);
67495         }
67496       });
67497       context.on("enter.intro", function(mode) {
67498         if (mode.id !== "select") {
67499           continueTo(updateLine);
67500         }
67501       });
67502       function continueTo(nextStep) {
67503         context.map().on("move.intro drawn.intro", null);
67504         context.history().on("change.intro", null);
67505         context.on("enter.intro", null);
67506         nextStep();
67507       }
67508     }
67509     function startDragEndpoint() {
67510       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67511         return continueTo(updateLine);
67512       }
67513       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67514       var box = pad2(woodRoadDragEndpoint, padding, context);
67515       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
67516       reveal(box, startDragString);
67517       context.map().on("move.intro drawn.intro", function() {
67518         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67519           return continueTo(updateLine);
67520         }
67521         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67522         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67523         reveal(box2, startDragString, { duration: 0 });
67524         var entity = context.entity(woodRoadEndID);
67525         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
67526           continueTo(finishDragEndpoint);
67527         }
67528       });
67529       function continueTo(nextStep) {
67530         context.map().on("move.intro drawn.intro", null);
67531         nextStep();
67532       }
67533     }
67534     function finishDragEndpoint() {
67535       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67536         return continueTo(updateLine);
67537       }
67538       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67539       var box = pad2(woodRoadDragEndpoint, padding, context);
67540       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
67541       reveal(box, finishDragString);
67542       context.map().on("move.intro drawn.intro", function() {
67543         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67544           return continueTo(updateLine);
67545         }
67546         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67547         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67548         reveal(box2, finishDragString, { duration: 0 });
67549         var entity = context.entity(woodRoadEndID);
67550         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
67551           continueTo(startDragEndpoint);
67552         }
67553       });
67554       context.on("enter.intro", function() {
67555         continueTo(startDragMidpoint);
67556       });
67557       function continueTo(nextStep) {
67558         context.map().on("move.intro drawn.intro", null);
67559         context.on("enter.intro", null);
67560         nextStep();
67561       }
67562     }
67563     function startDragMidpoint() {
67564       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67565         return continueTo(updateLine);
67566       }
67567       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
67568         context.enter(modeSelect(context, [woodRoadID]));
67569       }
67570       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
67571       var box = pad2(woodRoadDragMidpoint, padding, context);
67572       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
67573       context.map().on("move.intro drawn.intro", function() {
67574         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67575           return continueTo(updateLine);
67576         }
67577         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
67578         var box2 = pad2(woodRoadDragMidpoint, padding2, context);
67579         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
67580       });
67581       context.history().on("change.intro", function(changed) {
67582         if (changed.created().length === 1) {
67583           continueTo(continueDragMidpoint);
67584         }
67585       });
67586       context.on("enter.intro", function(mode) {
67587         if (mode.id !== "select") {
67588           context.enter(modeSelect(context, [woodRoadID]));
67589         }
67590       });
67591       function continueTo(nextStep) {
67592         context.map().on("move.intro drawn.intro", null);
67593         context.history().on("change.intro", null);
67594         context.on("enter.intro", null);
67595         nextStep();
67596       }
67597     }
67598     function continueDragMidpoint() {
67599       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67600         return continueTo(updateLine);
67601       }
67602       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
67603       var box = pad2(woodRoadDragEndpoint, padding, context);
67604       box.height += 400;
67605       var advance = function() {
67606         context.history().checkpoint("doneUpdateLine");
67607         continueTo(deleteLines);
67608       };
67609       reveal(
67610         box,
67611         helpHtml("intro.lines.continue_drag_midpoint"),
67612         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67613       );
67614       context.map().on("move.intro drawn.intro", function() {
67615         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
67616           return continueTo(updateLine);
67617         }
67618         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
67619         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
67620         box2.height += 400;
67621         reveal(
67622           box2,
67623           helpHtml("intro.lines.continue_drag_midpoint"),
67624           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67625         );
67626       });
67627       function continueTo(nextStep) {
67628         context.map().on("move.intro drawn.intro", null);
67629         nextStep();
67630       }
67631     }
67632     function deleteLines() {
67633       context.history().reset("doneUpdateLine");
67634       context.enter(modeBrowse(context));
67635       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67636         return chapter.restart();
67637       }
67638       var msec = transitionTime(deleteLinesLoc, context.map().center());
67639       if (msec) {
67640         reveal(null, null, { duration: 0 });
67641       }
67642       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
67643       timeout2(function() {
67644         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67645         var box = pad2(deleteLinesLoc, padding, context);
67646         box.top -= 200;
67647         box.height += 400;
67648         var advance = function() {
67649           continueTo(rightClickIntersection);
67650         };
67651         reveal(
67652           box,
67653           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67654           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67655         );
67656         context.map().on("move.intro drawn.intro", function() {
67657           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67658           var box2 = pad2(deleteLinesLoc, padding2, context);
67659           box2.top -= 200;
67660           box2.height += 400;
67661           reveal(
67662             box2,
67663             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
67664             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67665           );
67666         });
67667         context.history().on("change.intro", function() {
67668           timeout2(function() {
67669             continueTo(deleteLines);
67670           }, 500);
67671         });
67672       }, msec + 100);
67673       function continueTo(nextStep) {
67674         context.map().on("move.intro drawn.intro", null);
67675         context.history().on("change.intro", null);
67676         nextStep();
67677       }
67678     }
67679     function rightClickIntersection() {
67680       context.history().reset("doneUpdateLine");
67681       context.enter(modeBrowse(context));
67682       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67683       var rightClickString = helpHtml("intro.lines.split_street", {
67684         street1: _t("intro.graph.name.11th-avenue"),
67685         street2: _t("intro.graph.name.washington-street")
67686       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
67687       timeout2(function() {
67688         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67689         var box = pad2(eleventhAvenueEnd, padding, context);
67690         reveal(box, rightClickString);
67691         context.map().on("move.intro drawn.intro", function() {
67692           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67693           var box2 = pad2(eleventhAvenueEnd, padding2, context);
67694           reveal(
67695             box2,
67696             rightClickString,
67697             { duration: 0 }
67698           );
67699         });
67700         context.on("enter.intro", function(mode) {
67701           if (mode.id !== "select") return;
67702           var ids = context.selectedIDs();
67703           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
67704           timeout2(function() {
67705             var node = selectMenuItem(context, "split").node();
67706             if (!node) return;
67707             continueTo(splitIntersection);
67708           }, 50);
67709         });
67710         context.history().on("change.intro", function() {
67711           timeout2(function() {
67712             continueTo(deleteLines);
67713           }, 300);
67714         });
67715       }, 600);
67716       function continueTo(nextStep) {
67717         context.map().on("move.intro drawn.intro", null);
67718         context.on("enter.intro", null);
67719         context.history().on("change.intro", null);
67720         nextStep();
67721       }
67722     }
67723     function splitIntersection() {
67724       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67725         return continueTo(deleteLines);
67726       }
67727       var node = selectMenuItem(context, "split").node();
67728       if (!node) {
67729         return continueTo(rightClickIntersection);
67730       }
67731       var wasChanged = false;
67732       _washingtonSegmentID = null;
67733       reveal(
67734         ".edit-menu",
67735         helpHtml(
67736           "intro.lines.split_intersection",
67737           { street: _t("intro.graph.name.washington-street") }
67738         ),
67739         { padding: 50 }
67740       );
67741       context.map().on("move.intro drawn.intro", function() {
67742         var node2 = selectMenuItem(context, "split").node();
67743         if (!wasChanged && !node2) {
67744           return continueTo(rightClickIntersection);
67745         }
67746         reveal(
67747           ".edit-menu",
67748           helpHtml(
67749             "intro.lines.split_intersection",
67750             { street: _t("intro.graph.name.washington-street") }
67751           ),
67752           { duration: 0, padding: 50 }
67753         );
67754       });
67755       context.history().on("change.intro", function(changed) {
67756         wasChanged = true;
67757         timeout2(function() {
67758           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
67759             _washingtonSegmentID = changed.created()[0].id;
67760             continueTo(didSplit);
67761           } else {
67762             _washingtonSegmentID = null;
67763             continueTo(retrySplit);
67764           }
67765         }, 300);
67766       });
67767       function continueTo(nextStep) {
67768         context.map().on("move.intro drawn.intro", null);
67769         context.history().on("change.intro", null);
67770         nextStep();
67771       }
67772     }
67773     function retrySplit() {
67774       context.enter(modeBrowse(context));
67775       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
67776       var advance = function() {
67777         continueTo(rightClickIntersection);
67778       };
67779       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
67780       var box = pad2(eleventhAvenueEnd, padding, context);
67781       reveal(
67782         box,
67783         helpHtml("intro.lines.retry_split"),
67784         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
67785       );
67786       context.map().on("move.intro drawn.intro", function() {
67787         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
67788         var box2 = pad2(eleventhAvenueEnd, padding2, context);
67789         reveal(
67790           box2,
67791           helpHtml("intro.lines.retry_split"),
67792           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
67793         );
67794       });
67795       function continueTo(nextStep) {
67796         context.map().on("move.intro drawn.intro", null);
67797         nextStep();
67798       }
67799     }
67800     function didSplit() {
67801       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67802         return continueTo(rightClickIntersection);
67803       }
67804       var ids = context.selectedIDs();
67805       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
67806       var street = _t("intro.graph.name.washington-street");
67807       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67808       var box = pad2(twelfthAvenue, padding, context);
67809       box.width = box.width / 2;
67810       reveal(
67811         box,
67812         helpHtml(string, { street1: street, street2: street }),
67813         { duration: 500 }
67814       );
67815       timeout2(function() {
67816         context.map().centerZoomEase(twelfthAvenue, 18, 500);
67817         context.map().on("move.intro drawn.intro", function() {
67818           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67819           var box2 = pad2(twelfthAvenue, padding2, context);
67820           box2.width = box2.width / 2;
67821           reveal(
67822             box2,
67823             helpHtml(string, { street1: street, street2: street }),
67824             { duration: 0 }
67825           );
67826         });
67827       }, 600);
67828       context.on("enter.intro", function() {
67829         var ids2 = context.selectedIDs();
67830         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
67831           continueTo(multiSelect2);
67832         }
67833       });
67834       context.history().on("change.intro", function() {
67835         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67836           return continueTo(rightClickIntersection);
67837         }
67838       });
67839       function continueTo(nextStep) {
67840         context.map().on("move.intro drawn.intro", null);
67841         context.on("enter.intro", null);
67842         context.history().on("change.intro", null);
67843         nextStep();
67844       }
67845     }
67846     function multiSelect2() {
67847       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67848         return continueTo(rightClickIntersection);
67849       }
67850       var ids = context.selectedIDs();
67851       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
67852       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
67853       if (hasWashington && hasTwelfth) {
67854         return continueTo(multiRightClick);
67855       } else if (!hasWashington && !hasTwelfth) {
67856         return continueTo(didSplit);
67857       }
67858       context.map().centerZoomEase(twelfthAvenue, 18, 500);
67859       timeout2(function() {
67860         var selected, other, padding, box;
67861         if (hasWashington) {
67862           selected = _t("intro.graph.name.washington-street");
67863           other = _t("intro.graph.name.12th-avenue");
67864           padding = 60 * Math.pow(2, context.map().zoom() - 18);
67865           box = pad2(twelfthAvenueEnd, padding, context);
67866           box.width *= 3;
67867         } else {
67868           selected = _t("intro.graph.name.12th-avenue");
67869           other = _t("intro.graph.name.washington-street");
67870           padding = 200 * Math.pow(2, context.map().zoom() - 18);
67871           box = pad2(twelfthAvenue, padding, context);
67872           box.width /= 2;
67873         }
67874         reveal(
67875           box,
67876           helpHtml(
67877             "intro.lines.multi_select",
67878             { selected, other1: other }
67879           ) + " " + helpHtml(
67880             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67881             { selected, other2: other }
67882           )
67883         );
67884         context.map().on("move.intro drawn.intro", function() {
67885           if (hasWashington) {
67886             selected = _t("intro.graph.name.washington-street");
67887             other = _t("intro.graph.name.12th-avenue");
67888             padding = 60 * Math.pow(2, context.map().zoom() - 18);
67889             box = pad2(twelfthAvenueEnd, padding, context);
67890             box.width *= 3;
67891           } else {
67892             selected = _t("intro.graph.name.12th-avenue");
67893             other = _t("intro.graph.name.washington-street");
67894             padding = 200 * Math.pow(2, context.map().zoom() - 18);
67895             box = pad2(twelfthAvenue, padding, context);
67896             box.width /= 2;
67897           }
67898           reveal(
67899             box,
67900             helpHtml(
67901               "intro.lines.multi_select",
67902               { selected, other1: other }
67903             ) + " " + helpHtml(
67904               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
67905               { selected, other2: other }
67906             ),
67907             { duration: 0 }
67908           );
67909         });
67910         context.on("enter.intro", function() {
67911           continueTo(multiSelect2);
67912         });
67913         context.history().on("change.intro", function() {
67914           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67915             return continueTo(rightClickIntersection);
67916           }
67917         });
67918       }, 600);
67919       function continueTo(nextStep) {
67920         context.map().on("move.intro drawn.intro", null);
67921         context.on("enter.intro", null);
67922         context.history().on("change.intro", null);
67923         nextStep();
67924       }
67925     }
67926     function multiRightClick() {
67927       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67928         return continueTo(rightClickIntersection);
67929       }
67930       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
67931       var box = pad2(twelfthAvenue, padding, context);
67932       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
67933       reveal(box, rightClickString);
67934       context.map().on("move.intro drawn.intro", function() {
67935         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
67936         var box2 = pad2(twelfthAvenue, padding2, context);
67937         reveal(box2, rightClickString, { duration: 0 });
67938       });
67939       context.ui().editMenu().on("toggled.intro", function(open) {
67940         if (!open) return;
67941         timeout2(function() {
67942           var ids = context.selectedIDs();
67943           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67944             var node = selectMenuItem(context, "delete").node();
67945             if (!node) return;
67946             continueTo(multiDelete);
67947           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
67948             return continueTo(multiSelect2);
67949           } else {
67950             return continueTo(didSplit);
67951           }
67952         }, 300);
67953       });
67954       context.history().on("change.intro", function() {
67955         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67956           return continueTo(rightClickIntersection);
67957         }
67958       });
67959       function continueTo(nextStep) {
67960         context.map().on("move.intro drawn.intro", null);
67961         context.ui().editMenu().on("toggled.intro", null);
67962         context.history().on("change.intro", null);
67963         nextStep();
67964       }
67965     }
67966     function multiDelete() {
67967       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
67968         return continueTo(rightClickIntersection);
67969       }
67970       var node = selectMenuItem(context, "delete").node();
67971       if (!node) return continueTo(multiRightClick);
67972       reveal(
67973         ".edit-menu",
67974         helpHtml("intro.lines.multi_delete"),
67975         { padding: 50 }
67976       );
67977       context.map().on("move.intro drawn.intro", function() {
67978         reveal(
67979           ".edit-menu",
67980           helpHtml("intro.lines.multi_delete"),
67981           { duration: 0, padding: 50 }
67982         );
67983       });
67984       context.on("exit.intro", function() {
67985         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67986           return continueTo(multiSelect2);
67987         }
67988       });
67989       context.history().on("change.intro", function() {
67990         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
67991           continueTo(retryDelete);
67992         } else {
67993           continueTo(play);
67994         }
67995       });
67996       function continueTo(nextStep) {
67997         context.map().on("move.intro drawn.intro", null);
67998         context.on("exit.intro", null);
67999         context.history().on("change.intro", null);
68000         nextStep();
68001       }
68002     }
68003     function retryDelete() {
68004       context.enter(modeBrowse(context));
68005       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
68006       var box = pad2(twelfthAvenue, padding, context);
68007       reveal(box, helpHtml("intro.lines.retry_delete"), {
68008         buttonText: _t.html("intro.ok"),
68009         buttonCallback: function() {
68010           continueTo(multiSelect2);
68011         }
68012       });
68013       function continueTo(nextStep) {
68014         nextStep();
68015       }
68016     }
68017     function play() {
68018       dispatch14.call("done");
68019       reveal(
68020         ".ideditor",
68021         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
68022         {
68023           tooltipBox: ".intro-nav-wrap .chapter-building",
68024           buttonText: _t.html("intro.ok"),
68025           buttonCallback: function() {
68026             reveal(".ideditor");
68027           }
68028         }
68029       );
68030     }
68031     chapter.enter = function() {
68032       addLine();
68033     };
68034     chapter.exit = function() {
68035       timeouts.forEach(window.clearTimeout);
68036       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
68037       context.on("enter.intro exit.intro", null);
68038       context.map().on("move.intro drawn.intro", null);
68039       context.history().on("change.intro", null);
68040       context.container().select(".inspector-wrap").on("wheel.intro", null);
68041       context.container().select(".preset-list-button").on("click.intro", null);
68042     };
68043     chapter.restart = function() {
68044       chapter.exit();
68045       chapter.enter();
68046     };
68047     return utilRebind(chapter, dispatch14, "on");
68048   }
68049   var init_line2 = __esm({
68050     "modules/ui/intro/line.js"() {
68051       "use strict";
68052       init_src4();
68053       init_src5();
68054       init_presets();
68055       init_localizer();
68056       init_geo2();
68057       init_browse();
68058       init_select5();
68059       init_rebind();
68060       init_helper();
68061     }
68062   });
68063
68064   // modules/ui/intro/building.js
68065   var building_exports = {};
68066   __export(building_exports, {
68067     uiIntroBuilding: () => uiIntroBuilding
68068   });
68069   function uiIntroBuilding(context, reveal) {
68070     var dispatch14 = dispatch_default("done");
68071     var house = [-85.62815, 41.95638];
68072     var tank = [-85.62732, 41.95347];
68073     var buildingCatetory = _mainPresetIndex.item("category-building");
68074     var housePreset = _mainPresetIndex.item("building/house");
68075     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
68076     var timeouts = [];
68077     var _houseID = null;
68078     var _tankID = null;
68079     var chapter = {
68080       title: "intro.buildings.title"
68081     };
68082     function timeout2(f2, t2) {
68083       timeouts.push(window.setTimeout(f2, t2));
68084     }
68085     function eventCancel(d3_event) {
68086       d3_event.stopPropagation();
68087       d3_event.preventDefault();
68088     }
68089     function revealHouse(center, text, options) {
68090       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
68091       var box = pad2(center, padding, context);
68092       reveal(box, text, options);
68093     }
68094     function revealTank(center, text, options) {
68095       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
68096       var box = pad2(center, padding, context);
68097       reveal(box, text, options);
68098     }
68099     function addHouse() {
68100       context.enter(modeBrowse(context));
68101       context.history().reset("initial");
68102       _houseID = null;
68103       var msec = transitionTime(house, context.map().center());
68104       if (msec) {
68105         reveal(null, null, { duration: 0 });
68106       }
68107       context.map().centerZoomEase(house, 19, msec);
68108       timeout2(function() {
68109         var tooltip = reveal(
68110           "button.add-area",
68111           helpHtml("intro.buildings.add_building")
68112         );
68113         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
68114         context.on("enter.intro", function(mode) {
68115           if (mode.id !== "add-area") return;
68116           continueTo(startHouse);
68117         });
68118       }, msec + 100);
68119       function continueTo(nextStep) {
68120         context.on("enter.intro", null);
68121         nextStep();
68122       }
68123     }
68124     function startHouse() {
68125       if (context.mode().id !== "add-area") {
68126         return continueTo(addHouse);
68127       }
68128       _houseID = null;
68129       context.map().zoomEase(20, 500);
68130       timeout2(function() {
68131         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68132         revealHouse(house, startString);
68133         context.map().on("move.intro drawn.intro", function() {
68134           revealHouse(house, startString, { duration: 0 });
68135         });
68136         context.on("enter.intro", function(mode) {
68137           if (mode.id !== "draw-area") return chapter.restart();
68138           continueTo(continueHouse);
68139         });
68140       }, 550);
68141       function continueTo(nextStep) {
68142         context.map().on("move.intro drawn.intro", null);
68143         context.on("enter.intro", null);
68144         nextStep();
68145       }
68146     }
68147     function continueHouse() {
68148       if (context.mode().id !== "draw-area") {
68149         return continueTo(addHouse);
68150       }
68151       _houseID = null;
68152       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
68153       revealHouse(house, continueString);
68154       context.map().on("move.intro drawn.intro", function() {
68155         revealHouse(house, continueString, { duration: 0 });
68156       });
68157       context.on("enter.intro", function(mode) {
68158         if (mode.id === "draw-area") {
68159           return;
68160         } else if (mode.id === "select") {
68161           var graph = context.graph();
68162           var way = context.entity(context.selectedIDs()[0]);
68163           var nodes = graph.childNodes(way);
68164           var points = utilArrayUniq(nodes).map(function(n3) {
68165             return context.projection(n3.loc);
68166           });
68167           if (isMostlySquare(points)) {
68168             _houseID = way.id;
68169             return continueTo(chooseCategoryBuilding);
68170           } else {
68171             return continueTo(retryHouse);
68172           }
68173         } else {
68174           return chapter.restart();
68175         }
68176       });
68177       function continueTo(nextStep) {
68178         context.map().on("move.intro drawn.intro", null);
68179         context.on("enter.intro", null);
68180         nextStep();
68181       }
68182     }
68183     function retryHouse() {
68184       var onClick = function() {
68185         continueTo(addHouse);
68186       };
68187       revealHouse(
68188         house,
68189         helpHtml("intro.buildings.retry_building"),
68190         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68191       );
68192       context.map().on("move.intro drawn.intro", function() {
68193         revealHouse(
68194           house,
68195           helpHtml("intro.buildings.retry_building"),
68196           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
68197         );
68198       });
68199       function continueTo(nextStep) {
68200         context.map().on("move.intro drawn.intro", null);
68201         nextStep();
68202       }
68203     }
68204     function chooseCategoryBuilding() {
68205       if (!_houseID || !context.hasEntity(_houseID)) {
68206         return addHouse();
68207       }
68208       var ids = context.selectedIDs();
68209       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68210         context.enter(modeSelect(context, [_houseID]));
68211       }
68212       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68213       timeout2(function() {
68214         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68215         var button = context.container().select(".preset-category-building .preset-list-button");
68216         reveal(
68217           button.node(),
68218           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
68219         );
68220         button.on("click.intro", function() {
68221           button.on("click.intro", null);
68222           continueTo(choosePresetHouse);
68223         });
68224       }, 400);
68225       context.on("enter.intro", function(mode) {
68226         if (!_houseID || !context.hasEntity(_houseID)) {
68227           return continueTo(addHouse);
68228         }
68229         var ids2 = context.selectedIDs();
68230         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68231           return continueTo(chooseCategoryBuilding);
68232         }
68233       });
68234       function continueTo(nextStep) {
68235         context.container().select(".inspector-wrap").on("wheel.intro", null);
68236         context.container().select(".preset-list-button").on("click.intro", null);
68237         context.on("enter.intro", null);
68238         nextStep();
68239       }
68240     }
68241     function choosePresetHouse() {
68242       if (!_houseID || !context.hasEntity(_houseID)) {
68243         return addHouse();
68244       }
68245       var ids = context.selectedIDs();
68246       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68247         context.enter(modeSelect(context, [_houseID]));
68248       }
68249       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68250       timeout2(function() {
68251         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68252         var button = context.container().select(".preset-building-house .preset-list-button");
68253         reveal(
68254           button.node(),
68255           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
68256           { duration: 300 }
68257         );
68258         button.on("click.intro", function() {
68259           button.on("click.intro", null);
68260           continueTo(closeEditorHouse);
68261         });
68262       }, 400);
68263       context.on("enter.intro", function(mode) {
68264         if (!_houseID || !context.hasEntity(_houseID)) {
68265           return continueTo(addHouse);
68266         }
68267         var ids2 = context.selectedIDs();
68268         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
68269           return continueTo(chooseCategoryBuilding);
68270         }
68271       });
68272       function continueTo(nextStep) {
68273         context.container().select(".inspector-wrap").on("wheel.intro", null);
68274         context.container().select(".preset-list-button").on("click.intro", null);
68275         context.on("enter.intro", null);
68276         nextStep();
68277       }
68278     }
68279     function closeEditorHouse() {
68280       if (!_houseID || !context.hasEntity(_houseID)) {
68281         return addHouse();
68282       }
68283       var ids = context.selectedIDs();
68284       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
68285         context.enter(modeSelect(context, [_houseID]));
68286       }
68287       context.history().checkpoint("hasHouse");
68288       context.on("exit.intro", function() {
68289         continueTo(rightClickHouse);
68290       });
68291       timeout2(function() {
68292         reveal(
68293           ".entity-editor-pane",
68294           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68295         );
68296       }, 500);
68297       function continueTo(nextStep) {
68298         context.on("exit.intro", null);
68299         nextStep();
68300       }
68301     }
68302     function rightClickHouse() {
68303       if (!_houseID) return chapter.restart();
68304       context.enter(modeBrowse(context));
68305       context.history().reset("hasHouse");
68306       var zoom = context.map().zoom();
68307       if (zoom < 20) {
68308         zoom = 20;
68309       }
68310       context.map().centerZoomEase(house, zoom, 500);
68311       context.on("enter.intro", function(mode) {
68312         if (mode.id !== "select") return;
68313         var ids = context.selectedIDs();
68314         if (ids.length !== 1 || ids[0] !== _houseID) return;
68315         timeout2(function() {
68316           var node = selectMenuItem(context, "orthogonalize").node();
68317           if (!node) return;
68318           continueTo(clickSquare);
68319         }, 50);
68320       });
68321       context.map().on("move.intro drawn.intro", function() {
68322         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
68323         revealHouse(house, rightclickString, { duration: 0 });
68324       });
68325       context.history().on("change.intro", function() {
68326         continueTo(rightClickHouse);
68327       });
68328       function continueTo(nextStep) {
68329         context.on("enter.intro", null);
68330         context.map().on("move.intro drawn.intro", null);
68331         context.history().on("change.intro", null);
68332         nextStep();
68333       }
68334     }
68335     function clickSquare() {
68336       if (!_houseID) return chapter.restart();
68337       var entity = context.hasEntity(_houseID);
68338       if (!entity) return continueTo(rightClickHouse);
68339       var node = selectMenuItem(context, "orthogonalize").node();
68340       if (!node) {
68341         return continueTo(rightClickHouse);
68342       }
68343       var wasChanged = false;
68344       reveal(
68345         ".edit-menu",
68346         helpHtml("intro.buildings.square_building"),
68347         { padding: 50 }
68348       );
68349       context.on("enter.intro", function(mode) {
68350         if (mode.id === "browse") {
68351           continueTo(rightClickHouse);
68352         } else if (mode.id === "move" || mode.id === "rotate") {
68353           continueTo(retryClickSquare);
68354         }
68355       });
68356       context.map().on("move.intro", function() {
68357         var node2 = selectMenuItem(context, "orthogonalize").node();
68358         if (!wasChanged && !node2) {
68359           return continueTo(rightClickHouse);
68360         }
68361         reveal(
68362           ".edit-menu",
68363           helpHtml("intro.buildings.square_building"),
68364           { duration: 0, padding: 50 }
68365         );
68366       });
68367       context.history().on("change.intro", function() {
68368         wasChanged = true;
68369         context.history().on("change.intro", null);
68370         timeout2(function() {
68371           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
68372             continueTo(doneSquare);
68373           } else {
68374             continueTo(retryClickSquare);
68375           }
68376         }, 500);
68377       });
68378       function continueTo(nextStep) {
68379         context.on("enter.intro", null);
68380         context.map().on("move.intro", null);
68381         context.history().on("change.intro", null);
68382         nextStep();
68383       }
68384     }
68385     function retryClickSquare() {
68386       context.enter(modeBrowse(context));
68387       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
68388         buttonText: _t.html("intro.ok"),
68389         buttonCallback: function() {
68390           continueTo(rightClickHouse);
68391         }
68392       });
68393       function continueTo(nextStep) {
68394         nextStep();
68395       }
68396     }
68397     function doneSquare() {
68398       context.history().checkpoint("doneSquare");
68399       revealHouse(house, helpHtml("intro.buildings.done_square"), {
68400         buttonText: _t.html("intro.ok"),
68401         buttonCallback: function() {
68402           continueTo(addTank);
68403         }
68404       });
68405       function continueTo(nextStep) {
68406         nextStep();
68407       }
68408     }
68409     function addTank() {
68410       context.enter(modeBrowse(context));
68411       context.history().reset("doneSquare");
68412       _tankID = null;
68413       var msec = transitionTime(tank, context.map().center());
68414       if (msec) {
68415         reveal(null, null, { duration: 0 });
68416       }
68417       context.map().centerZoomEase(tank, 19.5, msec);
68418       timeout2(function() {
68419         reveal(
68420           "button.add-area",
68421           helpHtml("intro.buildings.add_tank")
68422         );
68423         context.on("enter.intro", function(mode) {
68424           if (mode.id !== "add-area") return;
68425           continueTo(startTank);
68426         });
68427       }, msec + 100);
68428       function continueTo(nextStep) {
68429         context.on("enter.intro", null);
68430         nextStep();
68431       }
68432     }
68433     function startTank() {
68434       if (context.mode().id !== "add-area") {
68435         return continueTo(addTank);
68436       }
68437       _tankID = null;
68438       timeout2(function() {
68439         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
68440         revealTank(tank, startString);
68441         context.map().on("move.intro drawn.intro", function() {
68442           revealTank(tank, startString, { duration: 0 });
68443         });
68444         context.on("enter.intro", function(mode) {
68445           if (mode.id !== "draw-area") return chapter.restart();
68446           continueTo(continueTank);
68447         });
68448       }, 550);
68449       function continueTo(nextStep) {
68450         context.map().on("move.intro drawn.intro", null);
68451         context.on("enter.intro", null);
68452         nextStep();
68453       }
68454     }
68455     function continueTank() {
68456       if (context.mode().id !== "draw-area") {
68457         return continueTo(addTank);
68458       }
68459       _tankID = null;
68460       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
68461       revealTank(tank, continueString);
68462       context.map().on("move.intro drawn.intro", function() {
68463         revealTank(tank, continueString, { duration: 0 });
68464       });
68465       context.on("enter.intro", function(mode) {
68466         if (mode.id === "draw-area") {
68467           return;
68468         } else if (mode.id === "select") {
68469           _tankID = context.selectedIDs()[0];
68470           return continueTo(searchPresetTank);
68471         } else {
68472           return continueTo(addTank);
68473         }
68474       });
68475       function continueTo(nextStep) {
68476         context.map().on("move.intro drawn.intro", null);
68477         context.on("enter.intro", null);
68478         nextStep();
68479       }
68480     }
68481     function searchPresetTank() {
68482       if (!_tankID || !context.hasEntity(_tankID)) {
68483         return addTank();
68484       }
68485       var ids = context.selectedIDs();
68486       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68487         context.enter(modeSelect(context, [_tankID]));
68488       }
68489       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68490       timeout2(function() {
68491         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68492         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68493         reveal(
68494           ".preset-search-input",
68495           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68496         );
68497       }, 400);
68498       context.on("enter.intro", function(mode) {
68499         if (!_tankID || !context.hasEntity(_tankID)) {
68500           return continueTo(addTank);
68501         }
68502         var ids2 = context.selectedIDs();
68503         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
68504           context.enter(modeSelect(context, [_tankID]));
68505           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
68506           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
68507           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
68508           reveal(
68509             ".preset-search-input",
68510             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
68511           );
68512           context.history().on("change.intro", null);
68513         }
68514       });
68515       function checkPresetSearch() {
68516         var first = context.container().select(".preset-list-item:first-child");
68517         if (first.classed("preset-man_made-storage_tank")) {
68518           reveal(
68519             first.select(".preset-list-button").node(),
68520             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
68521             { duration: 300 }
68522           );
68523           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
68524           context.history().on("change.intro", function() {
68525             continueTo(closeEditorTank);
68526           });
68527         }
68528       }
68529       function continueTo(nextStep) {
68530         context.container().select(".inspector-wrap").on("wheel.intro", null);
68531         context.on("enter.intro", null);
68532         context.history().on("change.intro", null);
68533         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68534         nextStep();
68535       }
68536     }
68537     function closeEditorTank() {
68538       if (!_tankID || !context.hasEntity(_tankID)) {
68539         return addTank();
68540       }
68541       var ids = context.selectedIDs();
68542       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
68543         context.enter(modeSelect(context, [_tankID]));
68544       }
68545       context.history().checkpoint("hasTank");
68546       context.on("exit.intro", function() {
68547         continueTo(rightClickTank);
68548       });
68549       timeout2(function() {
68550         reveal(
68551           ".entity-editor-pane",
68552           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
68553         );
68554       }, 500);
68555       function continueTo(nextStep) {
68556         context.on("exit.intro", null);
68557         nextStep();
68558       }
68559     }
68560     function rightClickTank() {
68561       if (!_tankID) return continueTo(addTank);
68562       context.enter(modeBrowse(context));
68563       context.history().reset("hasTank");
68564       context.map().centerEase(tank, 500);
68565       timeout2(function() {
68566         context.on("enter.intro", function(mode) {
68567           if (mode.id !== "select") return;
68568           var ids = context.selectedIDs();
68569           if (ids.length !== 1 || ids[0] !== _tankID) return;
68570           timeout2(function() {
68571             var node = selectMenuItem(context, "circularize").node();
68572             if (!node) return;
68573             continueTo(clickCircle);
68574           }, 50);
68575         });
68576         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
68577         revealTank(tank, rightclickString);
68578         context.map().on("move.intro drawn.intro", function() {
68579           revealTank(tank, rightclickString, { duration: 0 });
68580         });
68581         context.history().on("change.intro", function() {
68582           continueTo(rightClickTank);
68583         });
68584       }, 600);
68585       function continueTo(nextStep) {
68586         context.on("enter.intro", null);
68587         context.map().on("move.intro drawn.intro", null);
68588         context.history().on("change.intro", null);
68589         nextStep();
68590       }
68591     }
68592     function clickCircle() {
68593       if (!_tankID) return chapter.restart();
68594       var entity = context.hasEntity(_tankID);
68595       if (!entity) return continueTo(rightClickTank);
68596       var node = selectMenuItem(context, "circularize").node();
68597       if (!node) {
68598         return continueTo(rightClickTank);
68599       }
68600       var wasChanged = false;
68601       reveal(
68602         ".edit-menu",
68603         helpHtml("intro.buildings.circle_tank"),
68604         { padding: 50 }
68605       );
68606       context.on("enter.intro", function(mode) {
68607         if (mode.id === "browse") {
68608           continueTo(rightClickTank);
68609         } else if (mode.id === "move" || mode.id === "rotate") {
68610           continueTo(retryClickCircle);
68611         }
68612       });
68613       context.map().on("move.intro", function() {
68614         var node2 = selectMenuItem(context, "circularize").node();
68615         if (!wasChanged && !node2) {
68616           return continueTo(rightClickTank);
68617         }
68618         reveal(
68619           ".edit-menu",
68620           helpHtml("intro.buildings.circle_tank"),
68621           { duration: 0, padding: 50 }
68622         );
68623       });
68624       context.history().on("change.intro", function() {
68625         wasChanged = true;
68626         context.history().on("change.intro", null);
68627         timeout2(function() {
68628           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
68629             continueTo(play);
68630           } else {
68631             continueTo(retryClickCircle);
68632           }
68633         }, 500);
68634       });
68635       function continueTo(nextStep) {
68636         context.on("enter.intro", null);
68637         context.map().on("move.intro", null);
68638         context.history().on("change.intro", null);
68639         nextStep();
68640       }
68641     }
68642     function retryClickCircle() {
68643       context.enter(modeBrowse(context));
68644       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
68645         buttonText: _t.html("intro.ok"),
68646         buttonCallback: function() {
68647           continueTo(rightClickTank);
68648         }
68649       });
68650       function continueTo(nextStep) {
68651         nextStep();
68652       }
68653     }
68654     function play() {
68655       dispatch14.call("done");
68656       reveal(
68657         ".ideditor",
68658         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
68659         {
68660           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
68661           buttonText: _t.html("intro.ok"),
68662           buttonCallback: function() {
68663             reveal(".ideditor");
68664           }
68665         }
68666       );
68667     }
68668     chapter.enter = function() {
68669       addHouse();
68670     };
68671     chapter.exit = function() {
68672       timeouts.forEach(window.clearTimeout);
68673       context.on("enter.intro exit.intro", null);
68674       context.map().on("move.intro drawn.intro", null);
68675       context.history().on("change.intro", null);
68676       context.container().select(".inspector-wrap").on("wheel.intro", null);
68677       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
68678       context.container().select(".more-fields .combobox-input").on("click.intro", null);
68679     };
68680     chapter.restart = function() {
68681       chapter.exit();
68682       chapter.enter();
68683     };
68684     return utilRebind(chapter, dispatch14, "on");
68685   }
68686   var init_building = __esm({
68687     "modules/ui/intro/building.js"() {
68688       "use strict";
68689       init_src4();
68690       init_presets();
68691       init_localizer();
68692       init_browse();
68693       init_select5();
68694       init_util();
68695       init_helper();
68696     }
68697   });
68698
68699   // modules/ui/intro/start_editing.js
68700   var start_editing_exports = {};
68701   __export(start_editing_exports, {
68702     uiIntroStartEditing: () => uiIntroStartEditing
68703   });
68704   function uiIntroStartEditing(context, reveal) {
68705     var dispatch14 = dispatch_default("done", "startEditing");
68706     var modalSelection = select_default2(null);
68707     var chapter = {
68708       title: "intro.startediting.title"
68709     };
68710     function showHelp() {
68711       reveal(
68712         ".map-control.help-control",
68713         helpHtml("intro.startediting.help"),
68714         {
68715           buttonText: _t.html("intro.ok"),
68716           buttonCallback: function() {
68717             shortcuts();
68718           }
68719         }
68720       );
68721     }
68722     function shortcuts() {
68723       reveal(
68724         ".map-control.help-control",
68725         helpHtml("intro.startediting.shortcuts"),
68726         {
68727           buttonText: _t.html("intro.ok"),
68728           buttonCallback: function() {
68729             showSave();
68730           }
68731         }
68732       );
68733     }
68734     function showSave() {
68735       context.container().selectAll(".shaded").remove();
68736       reveal(
68737         ".top-toolbar button.save",
68738         helpHtml("intro.startediting.save"),
68739         {
68740           buttonText: _t.html("intro.ok"),
68741           buttonCallback: function() {
68742             showStart();
68743           }
68744         }
68745       );
68746     }
68747     function showStart() {
68748       context.container().selectAll(".shaded").remove();
68749       modalSelection = uiModal(context.container());
68750       modalSelection.select(".modal").attr("class", "modal-splash modal");
68751       modalSelection.selectAll(".close").remove();
68752       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
68753         modalSelection.remove();
68754       });
68755       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68756       startbutton.append("h2").call(_t.append("intro.startediting.start"));
68757       dispatch14.call("startEditing");
68758     }
68759     chapter.enter = function() {
68760       showHelp();
68761     };
68762     chapter.exit = function() {
68763       modalSelection.remove();
68764       context.container().selectAll(".shaded").remove();
68765     };
68766     return utilRebind(chapter, dispatch14, "on");
68767   }
68768   var init_start_editing = __esm({
68769     "modules/ui/intro/start_editing.js"() {
68770       "use strict";
68771       init_src4();
68772       init_src5();
68773       init_localizer();
68774       init_helper();
68775       init_modal();
68776       init_rebind();
68777     }
68778   });
68779
68780   // modules/ui/intro/intro.js
68781   var intro_exports = {};
68782   __export(intro_exports, {
68783     uiIntro: () => uiIntro
68784   });
68785   function uiIntro(context) {
68786     const INTRO_IMAGERY = "Bing";
68787     let _introGraph = {};
68788     let _currChapter;
68789     function intro(selection2) {
68790       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
68791         for (let id2 in dataIntroGraph) {
68792           if (!_introGraph[id2]) {
68793             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
68794           }
68795         }
68796         selection2.call(startIntro);
68797       }).catch(function() {
68798       });
68799     }
68800     function startIntro(selection2) {
68801       context.enter(modeBrowse(context));
68802       let osm = context.connection();
68803       let history = context.history().toJSON();
68804       let hash2 = window.location.hash;
68805       let center = context.map().center();
68806       let zoom = context.map().zoom();
68807       let background = context.background().baseLayerSource();
68808       let overlays = context.background().overlayLayerSources();
68809       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
68810       let caches = osm && osm.caches();
68811       let baseEntities = context.history().graph().base().entities;
68812       context.ui().sidebar.expand();
68813       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
68814       context.inIntro(true);
68815       if (osm) {
68816         osm.toggle(false).reset();
68817       }
68818       context.history().reset();
68819       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
68820       context.history().checkpoint("initial");
68821       let imagery = context.background().findSource(INTRO_IMAGERY);
68822       if (imagery) {
68823         context.background().baseLayerSource(imagery);
68824       } else {
68825         context.background().bing();
68826       }
68827       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68828       let layers = context.layers();
68829       layers.all().forEach((item) => {
68830         if (typeof item.layer.enabled === "function") {
68831           item.layer.enabled(item.id === "osm");
68832         }
68833       });
68834       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
68835       let curtain = uiCurtain(context.container().node());
68836       selection2.call(curtain);
68837       corePreferences("walkthrough_started", "yes");
68838       let storedProgress = corePreferences("walkthrough_progress") || "";
68839       let progress = storedProgress.split(";").filter(Boolean);
68840       let chapters = chapterFlow.map((chapter, i3) => {
68841         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
68842           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
68843           if (i3 < chapterFlow.length - 1) {
68844             const next = chapterFlow[i3 + 1];
68845             context.container().select(`button.chapter-${next}`).classed("next", true);
68846           }
68847           progress.push(chapter);
68848           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68849         });
68850         return s2;
68851       });
68852       chapters[chapters.length - 1].on("startEditing", () => {
68853         progress.push("startEditing");
68854         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
68855         let incomplete = utilArrayDifference(chapterFlow, progress);
68856         if (!incomplete.length) {
68857           corePreferences("walkthrough_completed", "yes");
68858         }
68859         curtain.remove();
68860         navwrap.remove();
68861         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
68862         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
68863         if (osm) {
68864           osm.toggle(true).reset().caches(caches);
68865         }
68866         context.history().reset().merge(Object.values(baseEntities));
68867         context.background().baseLayerSource(background);
68868         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
68869         if (history) {
68870           context.history().fromJSON(history, false);
68871         }
68872         context.map().centerZoom(center, zoom);
68873         window.history.replaceState(null, "", hash2);
68874         context.inIntro(false);
68875       });
68876       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
68877       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
68878       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
68879       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
68880       buttons.append("span").html((d2) => _t.html(d2.title));
68881       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
68882       enterChapter(null, chapters[0]);
68883       function enterChapter(d3_event, newChapter) {
68884         if (_currChapter) {
68885           _currChapter.exit();
68886         }
68887         context.enter(modeBrowse(context));
68888         _currChapter = newChapter;
68889         _currChapter.enter();
68890         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
68891       }
68892     }
68893     return intro;
68894   }
68895   var chapterUi, chapterFlow;
68896   var init_intro = __esm({
68897     "modules/ui/intro/intro.js"() {
68898       "use strict";
68899       init_localizer();
68900       init_helper();
68901       init_preferences();
68902       init_file_fetcher();
68903       init_graph();
68904       init_browse();
68905       init_entity();
68906       init_icon();
68907       init_curtain();
68908       init_util();
68909       init_welcome();
68910       init_navigation();
68911       init_point();
68912       init_area4();
68913       init_line2();
68914       init_building();
68915       init_start_editing();
68916       chapterUi = {
68917         welcome: uiIntroWelcome,
68918         navigation: uiIntroNavigation,
68919         point: uiIntroPoint,
68920         area: uiIntroArea,
68921         line: uiIntroLine,
68922         building: uiIntroBuilding,
68923         startEditing: uiIntroStartEditing
68924       };
68925       chapterFlow = [
68926         "welcome",
68927         "navigation",
68928         "point",
68929         "area",
68930         "line",
68931         "building",
68932         "startEditing"
68933       ];
68934     }
68935   });
68936
68937   // modules/ui/intro/index.js
68938   var intro_exports2 = {};
68939   __export(intro_exports2, {
68940     uiIntro: () => uiIntro
68941   });
68942   var init_intro2 = __esm({
68943     "modules/ui/intro/index.js"() {
68944       "use strict";
68945       init_intro();
68946     }
68947   });
68948
68949   // modules/ui/issues_info.js
68950   var issues_info_exports = {};
68951   __export(issues_info_exports, {
68952     uiIssuesInfo: () => uiIssuesInfo
68953   });
68954   function uiIssuesInfo(context) {
68955     var warningsItem = {
68956       id: "warnings",
68957       count: 0,
68958       iconID: "iD-icon-alert",
68959       descriptionID: "issues.warnings_and_errors"
68960     };
68961     var resolvedItem = {
68962       id: "resolved",
68963       count: 0,
68964       iconID: "iD-icon-apply",
68965       descriptionID: "issues.user_resolved_issues"
68966     };
68967     function update(selection2) {
68968       var shownItems = [];
68969       var liveIssues = context.validator().getIssues({
68970         what: corePreferences("validate-what") || "edited",
68971         where: corePreferences("validate-where") || "all"
68972       });
68973       if (liveIssues.length) {
68974         warningsItem.count = liveIssues.length;
68975         shownItems.push(warningsItem);
68976       }
68977       if (corePreferences("validate-what") === "all") {
68978         var resolvedIssues = context.validator().getResolvedIssues();
68979         if (resolvedIssues.length) {
68980           resolvedItem.count = resolvedIssues.length;
68981           shownItems.push(resolvedItem);
68982         }
68983       }
68984       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
68985         return d2.id;
68986       });
68987       chips.exit().remove();
68988       var enter = chips.enter().append("a").attr("class", function(d2) {
68989         return "chip " + d2.id + "-count";
68990       }).attr("href", "#").each(function(d2) {
68991         var chipSelection = select_default2(this);
68992         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
68993         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
68994           d3_event.preventDefault();
68995           tooltipBehavior.hide(select_default2(this));
68996           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
68997         });
68998         chipSelection.call(svgIcon("#" + d2.iconID));
68999       });
69000       enter.append("span").attr("class", "count");
69001       enter.merge(chips).selectAll("span.count").text(function(d2) {
69002         return d2.count.toString();
69003       });
69004     }
69005     return function(selection2) {
69006       update(selection2);
69007       context.validator().on("validated.infobox", function() {
69008         update(selection2);
69009       });
69010     };
69011   }
69012   var init_issues_info = __esm({
69013     "modules/ui/issues_info.js"() {
69014       "use strict";
69015       init_src5();
69016       init_preferences();
69017       init_icon();
69018       init_localizer();
69019       init_tooltip();
69020     }
69021   });
69022
69023   // modules/util/IntervalTasksQueue.js
69024   var IntervalTasksQueue_exports = {};
69025   __export(IntervalTasksQueue_exports, {
69026     IntervalTasksQueue: () => IntervalTasksQueue
69027   });
69028   var IntervalTasksQueue;
69029   var init_IntervalTasksQueue = __esm({
69030     "modules/util/IntervalTasksQueue.js"() {
69031       "use strict";
69032       IntervalTasksQueue = class {
69033         /**
69034          * Interval in milliseconds inside which only 1 task can execute.
69035          * e.g. if interval is 200ms, and 5 async tasks are unqueued,
69036          * they will complete in ~1s if not cleared
69037          * @param {number} intervalInMs
69038          */
69039         constructor(intervalInMs) {
69040           this.intervalInMs = intervalInMs;
69041           this.pendingHandles = [];
69042           this.time = 0;
69043         }
69044         enqueue(task) {
69045           let taskTimeout = this.time;
69046           this.time += this.intervalInMs;
69047           this.pendingHandles.push(setTimeout(() => {
69048             this.time -= this.intervalInMs;
69049             task();
69050           }, taskTimeout));
69051         }
69052         clear() {
69053           this.pendingHandles.forEach((timeoutHandle) => {
69054             clearTimeout(timeoutHandle);
69055           });
69056           this.pendingHandles = [];
69057           this.time = 0;
69058         }
69059       };
69060     }
69061   });
69062
69063   // modules/renderer/background_source.js
69064   var background_source_exports = {};
69065   __export(background_source_exports, {
69066     rendererBackgroundSource: () => rendererBackgroundSource
69067   });
69068   function localeDateString(s2) {
69069     if (!s2) return null;
69070     var options = { day: "numeric", month: "short", year: "numeric" };
69071     var d2 = new Date(s2);
69072     if (isNaN(d2.getTime())) return null;
69073     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options);
69074   }
69075   function vintageRange(vintage) {
69076     var s2;
69077     if (vintage.start || vintage.end) {
69078       s2 = vintage.start || "?";
69079       if (vintage.start !== vintage.end) {
69080         s2 += " - " + (vintage.end || "?");
69081       }
69082     }
69083     return s2;
69084   }
69085   function rendererBackgroundSource(data) {
69086     var source = Object.assign({}, data);
69087     var _offset = [0, 0];
69088     var _name = source.name;
69089     var _description = source.description;
69090     var _best = !!source.best;
69091     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
69092     source.tileSize = data.tileSize || 256;
69093     source.zoomExtent = data.zoomExtent || [0, 22];
69094     source.overzoom = data.overzoom !== false;
69095     source.offset = function(val) {
69096       if (!arguments.length) return _offset;
69097       _offset = val;
69098       return source;
69099     };
69100     source.nudge = function(val, zoomlevel) {
69101       _offset[0] += val[0] / Math.pow(2, zoomlevel);
69102       _offset[1] += val[1] / Math.pow(2, zoomlevel);
69103       return source;
69104     };
69105     source.name = function() {
69106       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69107       return _t("imagery." + id_safe + ".name", { default: escape_default(_name) });
69108     };
69109     source.label = function() {
69110       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69111       return _t.append("imagery." + id_safe + ".name", { default: escape_default(_name) });
69112     };
69113     source.hasDescription = function() {
69114       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69115       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: escape_default(_description) }).text;
69116       return descriptionText !== "";
69117     };
69118     source.description = function() {
69119       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
69120       return _t.append("imagery." + id_safe + ".description", { default: escape_default(_description) });
69121     };
69122     source.best = function() {
69123       return _best;
69124     };
69125     source.area = function() {
69126       if (!data.polygon) return Number.MAX_VALUE;
69127       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
69128       return isNaN(area) ? 0 : area;
69129     };
69130     source.imageryUsed = function() {
69131       return _name || source.id;
69132     };
69133     source.template = function(val) {
69134       if (!arguments.length) return _template;
69135       if (source.id === "custom" || source.id === "Bing") {
69136         _template = val;
69137       }
69138       return source;
69139     };
69140     source.url = function(coord2) {
69141       var result = _template.replace(/#[\s\S]*/u, "");
69142       if (result === "") return result;
69143       if (!source.type || source.id === "custom") {
69144         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
69145           source.type = "wms";
69146           source.projection = "EPSG:3857";
69147         } else if (/\{(x|y)\}/.test(result)) {
69148           source.type = "tms";
69149         } else if (/\{u\}/.test(result)) {
69150           source.type = "bing";
69151         }
69152       }
69153       if (source.type === "wms") {
69154         var tileToProjectedCoords = function(x2, y2, z3) {
69155           var zoomSize = Math.pow(2, z3);
69156           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
69157           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
69158           switch (source.projection) {
69159             case "EPSG:4326":
69160               return {
69161                 x: lon * 180 / Math.PI,
69162                 y: lat * 180 / Math.PI
69163               };
69164             default:
69165               var mercCoords = mercatorRaw(lon, lat);
69166               return {
69167                 x: 2003750834e-2 / Math.PI * mercCoords[0],
69168                 y: 2003750834e-2 / Math.PI * mercCoords[1]
69169               };
69170           }
69171         };
69172         var tileSize = source.tileSize;
69173         var projection2 = source.projection;
69174         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
69175         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
69176         result = result.replace(/\{(\w+)\}/g, function(token, key) {
69177           switch (key) {
69178             case "width":
69179             case "height":
69180               return tileSize;
69181             case "proj":
69182               return projection2;
69183             case "wkid":
69184               return projection2.replace(/^EPSG:/, "");
69185             case "bbox":
69186               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
69187               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
69188                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
69189               } else {
69190                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
69191               }
69192             case "w":
69193               return minXmaxY.x;
69194             case "s":
69195               return maxXminY.y;
69196             case "n":
69197               return maxXminY.x;
69198             case "e":
69199               return minXmaxY.y;
69200             default:
69201               return token;
69202           }
69203         });
69204       } else if (source.type === "tms") {
69205         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" : "");
69206       } else if (source.type === "bing") {
69207         result = result.replace("{u}", function() {
69208           var u2 = "";
69209           for (var zoom = coord2[2]; zoom > 0; zoom--) {
69210             var b3 = 0;
69211             var mask = 1 << zoom - 1;
69212             if ((coord2[0] & mask) !== 0) b3++;
69213             if ((coord2[1] & mask) !== 0) b3 += 2;
69214             u2 += b3.toString();
69215           }
69216           return u2;
69217         });
69218       }
69219       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
69220         var subdomains = r2.split(",");
69221         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
69222       });
69223       return result;
69224     };
69225     source.validZoom = function(z3, underzoom) {
69226       if (underzoom === void 0) underzoom = 0;
69227       return source.zoomExtent[0] - underzoom <= z3 && (source.overzoom || source.zoomExtent[1] > z3);
69228     };
69229     source.isLocatorOverlay = function() {
69230       return source.id === "mapbox_locator_overlay";
69231     };
69232     source.isHidden = function() {
69233       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
69234     };
69235     source.copyrightNotices = function() {
69236     };
69237     source.getMetadata = function(center, tileCoord, callback) {
69238       var vintage = {
69239         start: localeDateString(source.startDate),
69240         end: localeDateString(source.endDate)
69241       };
69242       vintage.range = vintageRange(vintage);
69243       var metadata = { vintage };
69244       callback(null, metadata);
69245     };
69246     return source;
69247   }
69248   var isRetina, _a3;
69249   var init_background_source = __esm({
69250     "modules/renderer/background_source.js"() {
69251       "use strict";
69252       init_src2();
69253       init_src18();
69254       init_lodash();
69255       init_localizer();
69256       init_geo2();
69257       init_util();
69258       init_aes();
69259       init_IntervalTasksQueue();
69260       isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69261       (_a3 = window.matchMedia) == null ? void 0 : _a3.call(window, `
69262         (-webkit-min-device-pixel-ratio: 2), /* Safari */
69263         (min-resolution: 2dppx),             /* standard */
69264         (min-resolution: 192dpi)             /* fallback */
69265     `).addListener(function() {
69266         isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
69267       });
69268       rendererBackgroundSource.Bing = function(data, dispatch14) {
69269         data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
69270         var bing = rendererBackgroundSource(data);
69271         var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
69272         const strictParam = "n";
69273         var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
69274         var cache = {};
69275         var inflight = {};
69276         var providers = [];
69277         var taskQueue = new IntervalTasksQueue(250);
69278         var metadataLastZoom = -1;
69279         json_default(url).then(function(json) {
69280           let imageryResource = json.resourceSets[0].resources[0];
69281           let template = imageryResource.imageUrl;
69282           let subDomains = imageryResource.imageUrlSubdomains;
69283           let subDomainNumbers = subDomains.map((subDomain) => {
69284             return subDomain.substring(1);
69285           }).join(",");
69286           template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
69287           if (!new URLSearchParams(template).has(strictParam)) {
69288             template += `&${strictParam}=z`;
69289           }
69290           bing.template(template);
69291           providers = imageryResource.imageryProviders.map(function(provider) {
69292             return {
69293               attribution: provider.attribution,
69294               areas: provider.coverageAreas.map(function(area) {
69295                 return {
69296                   zoom: [area.zoomMin, area.zoomMax],
69297                   extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
69298                 };
69299               })
69300             };
69301           });
69302           dispatch14.call("change");
69303         }).catch(function() {
69304         });
69305         bing.copyrightNotices = function(zoom, extent) {
69306           zoom = Math.min(zoom, 21);
69307           return providers.filter(function(provider) {
69308             return provider.areas.some(function(area) {
69309               return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
69310             });
69311           }).map(function(provider) {
69312             return provider.attribution;
69313           }).join(", ");
69314         };
69315         bing.getMetadata = function(center, tileCoord, callback) {
69316           var tileID = tileCoord.slice(0, 3).join("/");
69317           var zoom = Math.min(tileCoord[2], 21);
69318           var centerPoint = center[1] + "," + center[0];
69319           var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
69320           if (inflight[tileID]) return;
69321           if (!cache[tileID]) {
69322             cache[tileID] = {};
69323           }
69324           if (cache[tileID] && cache[tileID].metadata) {
69325             return callback(null, cache[tileID].metadata);
69326           }
69327           inflight[tileID] = true;
69328           if (metadataLastZoom !== tileCoord[2]) {
69329             metadataLastZoom = tileCoord[2];
69330             taskQueue.clear();
69331           }
69332           taskQueue.enqueue(() => {
69333             json_default(url2).then(function(result) {
69334               delete inflight[tileID];
69335               if (!result) {
69336                 throw new Error("Unknown Error");
69337               }
69338               var vintage = {
69339                 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
69340                 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
69341               };
69342               vintage.range = vintageRange(vintage);
69343               var metadata = { vintage };
69344               cache[tileID].metadata = metadata;
69345               if (callback) callback(null, metadata);
69346             }).catch(function(err) {
69347               delete inflight[tileID];
69348               if (callback) callback(err.message);
69349             });
69350           });
69351         };
69352         bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
69353         return bing;
69354       };
69355       rendererBackgroundSource.Esri = function(data) {
69356         if (data.template.match(/blankTile/) === null) {
69357           data.template = data.template + "?blankTile=false";
69358         }
69359         var esri = rendererBackgroundSource(data);
69360         var cache = {};
69361         var inflight = {};
69362         var _prevCenter;
69363         esri.fetchTilemap = function(center) {
69364           if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
69365           _prevCenter = center;
69366           var z3 = 20;
69367           var dummyUrl = esri.url([1, 2, 3]);
69368           var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z3));
69369           var y2 = 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, z3));
69370           var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z3 + "/" + y2 + "/" + x2 + "/8/8";
69371           json_default(tilemapUrl).then(function(tilemap) {
69372             if (!tilemap) {
69373               throw new Error("Unknown Error");
69374             }
69375             var hasTiles = true;
69376             for (var i3 = 0; i3 < tilemap.data.length; i3++) {
69377               if (!tilemap.data[i3]) {
69378                 hasTiles = false;
69379                 break;
69380               }
69381             }
69382             esri.zoomExtent[1] = hasTiles ? 22 : 19;
69383           }).catch(function() {
69384           });
69385         };
69386         esri.getMetadata = function(center, tileCoord, callback) {
69387           if (esri.id !== "EsriWorldImagery") {
69388             return callback(null, {});
69389           }
69390           var tileID = tileCoord.slice(0, 3).join("/");
69391           var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
69392           var centerPoint = center[0] + "," + center[1];
69393           var unknown = _t("info_panels.background.unknown");
69394           var vintage = {};
69395           var metadata = {};
69396           if (inflight[tileID]) return;
69397           var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
69398           url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
69399           if (!cache[tileID]) {
69400             cache[tileID] = {};
69401           }
69402           if (cache[tileID] && cache[tileID].metadata) {
69403             return callback(null, cache[tileID].metadata);
69404           }
69405           inflight[tileID] = true;
69406           json_default(url).then(function(result) {
69407             delete inflight[tileID];
69408             result = result.features.map((f2) => f2.attributes).filter((a4) => a4.MinMapLevel <= zoom && a4.MaxMapLevel >= zoom)[0];
69409             if (!result) {
69410               throw new Error("Unknown Error");
69411             } else if (result.features && result.features.length < 1) {
69412               throw new Error("No Results");
69413             } else if (result.error && result.error.message) {
69414               throw new Error(result.error.message);
69415             }
69416             var captureDate = localeDateString(result.SRC_DATE2);
69417             vintage = {
69418               start: captureDate,
69419               end: captureDate,
69420               range: captureDate
69421             };
69422             metadata = {
69423               vintage,
69424               source: clean2(result.NICE_NAME),
69425               description: clean2(result.NICE_DESC),
69426               resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
69427               accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
69428             };
69429             if (isFinite(metadata.resolution)) {
69430               metadata.resolution += " m";
69431             }
69432             if (isFinite(metadata.accuracy)) {
69433               metadata.accuracy += " m";
69434             }
69435             cache[tileID].metadata = metadata;
69436             if (callback) callback(null, metadata);
69437           }).catch(function(err) {
69438             delete inflight[tileID];
69439             if (callback) callback(err.message);
69440           });
69441           function clean2(val) {
69442             return String(val).trim() || unknown;
69443           }
69444         };
69445         return esri;
69446       };
69447       rendererBackgroundSource.None = function() {
69448         var source = rendererBackgroundSource({ id: "none", template: "" });
69449         source.name = function() {
69450           return _t("background.none");
69451         };
69452         source.label = function() {
69453           return _t.append("background.none");
69454         };
69455         source.imageryUsed = function() {
69456           return null;
69457         };
69458         source.area = function() {
69459           return -1;
69460         };
69461         return source;
69462       };
69463       rendererBackgroundSource.Custom = function(template) {
69464         var source = rendererBackgroundSource({ id: "custom", template });
69465         source.name = function() {
69466           return _t("background.custom");
69467         };
69468         source.label = function() {
69469           return _t.append("background.custom");
69470         };
69471         source.imageryUsed = function() {
69472           var cleaned = source.template();
69473           if (cleaned.indexOf("?") !== -1) {
69474             var parts = cleaned.split("?", 2);
69475             var qs = utilStringQs(parts[1]);
69476             ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
69477               if (qs[param]) {
69478                 qs[param] = "{apikey}";
69479               }
69480             });
69481             cleaned = parts[0] + "?" + utilQsString(qs, true);
69482           }
69483           cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
69484           return "Custom (" + cleaned + " )";
69485         };
69486         source.area = function() {
69487           return -2;
69488         };
69489         return source;
69490       };
69491     }
69492   });
69493
69494   // node_modules/@turf/meta/dist/esm/index.js
69495   function coordEach(geojson, callback, excludeWrapCoord) {
69496     if (geojson === null) return;
69497     var j3, k3, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
69498     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
69499       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
69500       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
69501       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
69502       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
69503         var multiFeatureIndex = 0;
69504         var geometryIndex = 0;
69505         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
69506         if (geometry === null) continue;
69507         coords = geometry.coordinates;
69508         var geomType = geometry.type;
69509         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
69510         switch (geomType) {
69511           case null:
69512             break;
69513           case "Point":
69514             if (callback(
69515               coords,
69516               coordIndex,
69517               featureIndex,
69518               multiFeatureIndex,
69519               geometryIndex
69520             ) === false)
69521               return false;
69522             coordIndex++;
69523             multiFeatureIndex++;
69524             break;
69525           case "LineString":
69526           case "MultiPoint":
69527             for (j3 = 0; j3 < coords.length; j3++) {
69528               if (callback(
69529                 coords[j3],
69530                 coordIndex,
69531                 featureIndex,
69532                 multiFeatureIndex,
69533                 geometryIndex
69534               ) === false)
69535                 return false;
69536               coordIndex++;
69537               if (geomType === "MultiPoint") multiFeatureIndex++;
69538             }
69539             if (geomType === "LineString") multiFeatureIndex++;
69540             break;
69541           case "Polygon":
69542           case "MultiLineString":
69543             for (j3 = 0; j3 < coords.length; j3++) {
69544               for (k3 = 0; k3 < coords[j3].length - wrapShrink; k3++) {
69545                 if (callback(
69546                   coords[j3][k3],
69547                   coordIndex,
69548                   featureIndex,
69549                   multiFeatureIndex,
69550                   geometryIndex
69551                 ) === false)
69552                   return false;
69553                 coordIndex++;
69554               }
69555               if (geomType === "MultiLineString") multiFeatureIndex++;
69556               if (geomType === "Polygon") geometryIndex++;
69557             }
69558             if (geomType === "Polygon") multiFeatureIndex++;
69559             break;
69560           case "MultiPolygon":
69561             for (j3 = 0; j3 < coords.length; j3++) {
69562               geometryIndex = 0;
69563               for (k3 = 0; k3 < coords[j3].length; k3++) {
69564                 for (l2 = 0; l2 < coords[j3][k3].length - wrapShrink; l2++) {
69565                   if (callback(
69566                     coords[j3][k3][l2],
69567                     coordIndex,
69568                     featureIndex,
69569                     multiFeatureIndex,
69570                     geometryIndex
69571                   ) === false)
69572                     return false;
69573                   coordIndex++;
69574                 }
69575                 geometryIndex++;
69576               }
69577               multiFeatureIndex++;
69578             }
69579             break;
69580           case "GeometryCollection":
69581             for (j3 = 0; j3 < geometry.geometries.length; j3++)
69582               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
69583                 return false;
69584             break;
69585           default:
69586             throw new Error("Unknown Geometry Type");
69587         }
69588       }
69589     }
69590   }
69591   var init_esm6 = __esm({
69592     "node_modules/@turf/meta/dist/esm/index.js"() {
69593     }
69594   });
69595
69596   // node_modules/@turf/bbox/dist/esm/index.js
69597   function bbox(geojson, options = {}) {
69598     if (geojson.bbox != null && true !== options.recompute) {
69599       return geojson.bbox;
69600     }
69601     const result = [Infinity, Infinity, -Infinity, -Infinity];
69602     coordEach(geojson, (coord2) => {
69603       if (result[0] > coord2[0]) {
69604         result[0] = coord2[0];
69605       }
69606       if (result[1] > coord2[1]) {
69607         result[1] = coord2[1];
69608       }
69609       if (result[2] < coord2[0]) {
69610         result[2] = coord2[0];
69611       }
69612       if (result[3] < coord2[1]) {
69613         result[3] = coord2[1];
69614       }
69615     });
69616     return result;
69617   }
69618   var turf_bbox_default;
69619   var init_esm7 = __esm({
69620     "node_modules/@turf/bbox/dist/esm/index.js"() {
69621       init_esm6();
69622       turf_bbox_default = bbox;
69623     }
69624   });
69625
69626   // modules/renderer/tile_layer.js
69627   var tile_layer_exports = {};
69628   __export(tile_layer_exports, {
69629     rendererTileLayer: () => rendererTileLayer
69630   });
69631   function rendererTileLayer(context) {
69632     var transformProp = utilPrefixCSSProperty("Transform");
69633     var tiler8 = utilTiler();
69634     var _tileSize = 256;
69635     var _projection;
69636     var _cache5 = {};
69637     var _tileOrigin;
69638     var _zoom;
69639     var _source;
69640     var _underzoom = 0;
69641     function tileSizeAtZoom(d2, z3) {
69642       return d2.tileSize * Math.pow(2, z3 - d2[2]) / d2.tileSize;
69643     }
69644     function atZoom(t2, distance) {
69645       var power = Math.pow(2, distance);
69646       return [
69647         Math.floor(t2[0] * power),
69648         Math.floor(t2[1] * power),
69649         t2[2] + distance
69650       ];
69651     }
69652     function lookUp(d2) {
69653       for (var up = -1; up > -d2[2]; up--) {
69654         var tile = atZoom(d2, up);
69655         if (_cache5[_source.url(tile)] !== false) {
69656           return tile;
69657         }
69658       }
69659     }
69660     function uniqueBy(a4, n3) {
69661       var o2 = [];
69662       var seen = {};
69663       for (var i3 = 0; i3 < a4.length; i3++) {
69664         if (seen[a4[i3][n3]] === void 0) {
69665           o2.push(a4[i3]);
69666           seen[a4[i3][n3]] = true;
69667         }
69668       }
69669       return o2;
69670     }
69671     function addSource(d2) {
69672       d2.url = _source.url(d2);
69673       d2.tileSize = _tileSize;
69674       d2.source = _source;
69675       return d2;
69676     }
69677     function background(selection2) {
69678       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
69679       var pixelOffset;
69680       if (_source) {
69681         pixelOffset = [
69682           _source.offset()[0] * Math.pow(2, _zoom),
69683           _source.offset()[1] * Math.pow(2, _zoom)
69684         ];
69685       } else {
69686         pixelOffset = [0, 0];
69687       }
69688       tiler8.scale(_projection.scale() * 2 * Math.PI).translate([
69689         _projection.translate()[0] + pixelOffset[0],
69690         _projection.translate()[1] + pixelOffset[1]
69691       ]);
69692       _tileOrigin = [
69693         _projection.scale() * Math.PI - _projection.translate()[0],
69694         _projection.scale() * Math.PI - _projection.translate()[1]
69695       ];
69696       render(selection2);
69697     }
69698     function render(selection2) {
69699       if (!_source) return;
69700       var requests = [];
69701       var showDebug = context.getDebug("tile") && !_source.overlay;
69702       if (_source.validZoom(_zoom, _underzoom)) {
69703         tiler8.skipNullIsland(!!_source.overlay);
69704         tiler8().forEach(function(d2) {
69705           addSource(d2);
69706           if (d2.url === "") return;
69707           if (typeof d2.url !== "string") return;
69708           requests.push(d2);
69709           if (_cache5[d2.url] === false && lookUp(d2)) {
69710             requests.push(addSource(lookUp(d2)));
69711           }
69712         });
69713         requests = uniqueBy(requests, "url").filter(function(r2) {
69714           return _cache5[r2.url] !== false;
69715         });
69716       }
69717       function load(d3_event, d2) {
69718         _cache5[d2.url] = true;
69719         select_default2(this).on("error", null).on("load", null);
69720         render(selection2);
69721       }
69722       function error(d3_event, d2) {
69723         _cache5[d2.url] = false;
69724         select_default2(this).on("error", null).on("load", null).remove();
69725         render(selection2);
69726       }
69727       function imageTransform(d2) {
69728         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69729         var scale = tileSizeAtZoom(d2, _zoom);
69730         return "translate(" + ((d2[0] * ts + d2.source.offset()[0] * Math.pow(2, _zoom)) * _tileSize / d2.tileSize - _tileOrigin[0]) + "px," + ((d2[1] * ts + d2.source.offset()[1] * Math.pow(2, _zoom)) * _tileSize / d2.tileSize - _tileOrigin[1]) + "px) scale(" + scale * _tileSize / d2.tileSize + "," + scale * _tileSize / d2.tileSize + ")";
69731       }
69732       function tileCenter(d2) {
69733         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
69734         return [
69735           d2[0] * ts - _tileOrigin[0] + ts / 2,
69736           d2[1] * ts - _tileOrigin[1] + ts / 2
69737         ];
69738       }
69739       function debugTransform(d2) {
69740         var coord2 = tileCenter(d2);
69741         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
69742       }
69743       var dims = tiler8.size();
69744       var mapCenter = [dims[0] / 2, dims[1] / 2];
69745       var minDist = Math.max(dims[0], dims[1]);
69746       var nearCenter;
69747       requests.forEach(function(d2) {
69748         var c2 = tileCenter(d2);
69749         var dist = geoVecLength(c2, mapCenter);
69750         if (dist < minDist) {
69751           minDist = dist;
69752           nearCenter = d2;
69753         }
69754       });
69755       var image = selection2.selectAll("img").data(requests, function(d2) {
69756         return d2.url;
69757       });
69758       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).on("transitionend", function() {
69759         const tile = select_default2(this);
69760         if (tile.classed("tile-removing")) {
69761           tile.remove();
69762         }
69763       });
69764       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
69765         return d2.url;
69766       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
69767         return d2 === nearCenter;
69768       }).sort((a4, b3) => a4[2] - b3[2]);
69769       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
69770         return d2.url;
69771       });
69772       debug2.exit().remove();
69773       if (showDebug) {
69774         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
69775         debugEnter.append("div").attr("class", "tile-label-debug-coord");
69776         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
69777         debug2 = debug2.merge(debugEnter);
69778         debug2.style(transformProp, debugTransform);
69779         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
69780           return d2[2] + " / " + d2[0] + " / " + d2[1];
69781         });
69782         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
69783           var span = select_default2(this);
69784           var center = context.projection.invert(tileCenter(d2));
69785           _source.getMetadata(center, d2, function(err, result) {
69786             if (result && result.vintage && result.vintage.range) {
69787               span.text(result.vintage.range);
69788             } else {
69789               span.text("");
69790               span.call(_t.append("info_panels.background.vintage"));
69791               span.append("span").text(": ");
69792               span.call(_t.append("info_panels.background.unknown"));
69793             }
69794           });
69795         });
69796       }
69797     }
69798     background.projection = function(val) {
69799       if (!arguments.length) return _projection;
69800       _projection = val;
69801       return background;
69802     };
69803     background.dimensions = function(val) {
69804       if (!arguments.length) return tiler8.size();
69805       tiler8.size(val);
69806       return background;
69807     };
69808     background.source = function(val) {
69809       if (!arguments.length) return _source;
69810       _source = val;
69811       _tileSize = _source.tileSize;
69812       _cache5 = {};
69813       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
69814       return background;
69815     };
69816     background.underzoom = function(amount) {
69817       if (!arguments.length) return _underzoom;
69818       _underzoom = amount;
69819       return background;
69820     };
69821     return background;
69822   }
69823   var init_tile_layer = __esm({
69824     "modules/renderer/tile_layer.js"() {
69825       "use strict";
69826       init_src5();
69827       init_localizer();
69828       init_geo2();
69829       init_util();
69830     }
69831   });
69832
69833   // modules/renderer/background.js
69834   var background_exports2 = {};
69835   __export(background_exports2, {
69836     rendererBackground: () => rendererBackground
69837   });
69838   function rendererBackground(context) {
69839     const dispatch14 = dispatch_default("change");
69840     const baseLayer = rendererTileLayer(context).projection(context.projection);
69841     let _checkedBlocklists = [];
69842     let _isValid = true;
69843     let _overlayLayers = [];
69844     let _brightness = 1;
69845     let _contrast = 1;
69846     let _saturation = 1;
69847     let _sharpness = 1;
69848     function ensureImageryIndex() {
69849       return _mainFileFetcher.get("imagery").then((sources) => {
69850         if (_imageryIndex) return _imageryIndex;
69851         _imageryIndex = {
69852           imagery: sources,
69853           features: {}
69854         };
69855         const features = sources.map((source) => {
69856           if (!source.polygon) return null;
69857           const rings = source.polygon.map((ring) => [ring]);
69858           const feature3 = {
69859             type: "Feature",
69860             properties: { id: source.id },
69861             geometry: { type: "MultiPolygon", coordinates: rings }
69862           };
69863           _imageryIndex.features[source.id] = feature3;
69864           return feature3;
69865         }).filter(Boolean);
69866         _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features });
69867         _imageryIndex.backgrounds = sources.map((source) => {
69868           if (source.type === "bing") {
69869             return rendererBackgroundSource.Bing(source, dispatch14);
69870           } else if (/^EsriWorldImagery/.test(source.id)) {
69871             return rendererBackgroundSource.Esri(source);
69872           } else {
69873             return rendererBackgroundSource(source);
69874           }
69875         });
69876         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
69877         let template = corePreferences("background-custom-template") || "";
69878         const custom = rendererBackgroundSource.Custom(template);
69879         _imageryIndex.backgrounds.unshift(custom);
69880         return _imageryIndex;
69881       });
69882     }
69883     function background(selection2) {
69884       const currSource = baseLayer.source();
69885       if (context.map().zoom() > 18) {
69886         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
69887           const center = context.map().center();
69888           currSource.fetchTilemap(center);
69889         }
69890       }
69891       const sources = background.sources(context.map().extent());
69892       const wasValid = _isValid;
69893       _isValid = !!sources.filter((d2) => d2 === currSource).length;
69894       if (wasValid !== _isValid) {
69895         background.updateImagery();
69896       }
69897       let baseFilter = "";
69898       if (_brightness !== 1) {
69899         baseFilter += ` brightness(${_brightness})`;
69900       }
69901       if (_contrast !== 1) {
69902         baseFilter += ` contrast(${_contrast})`;
69903       }
69904       if (_saturation !== 1) {
69905         baseFilter += ` saturate(${_saturation})`;
69906       }
69907       if (_sharpness < 1) {
69908         const blur = number_default(0.5, 5)(1 - _sharpness);
69909         baseFilter += ` blur(${blur}px)`;
69910       }
69911       let base = selection2.selectAll(".layer-background").data([0]);
69912       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
69913       base.style("filter", baseFilter || null);
69914       let imagery = base.selectAll(".layer-imagery").data([0]);
69915       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
69916       let maskFilter = "";
69917       let mixBlendMode = "";
69918       if (_sharpness > 1) {
69919         mixBlendMode = "overlay";
69920         maskFilter = "saturate(0) blur(3px) invert(1)";
69921         let contrast = _sharpness - 1;
69922         maskFilter += ` contrast(${contrast})`;
69923         let brightness = number_default(1, 0.85)(_sharpness - 1);
69924         maskFilter += ` brightness(${brightness})`;
69925       }
69926       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
69927       mask.exit().remove();
69928       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);
69929       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
69930       overlays.exit().remove();
69931       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
69932     }
69933     background.updateImagery = function() {
69934       let currSource = baseLayer.source();
69935       if (context.inIntro() || !currSource) return;
69936       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
69937       const meters = geoOffsetToMeters(currSource.offset());
69938       const EPSILON = 0.01;
69939       const x2 = +meters[0].toFixed(2);
69940       const y2 = +meters[1].toFixed(2);
69941       let hash2 = utilStringQs(window.location.hash);
69942       let id2 = currSource.id;
69943       if (id2 === "custom") {
69944         id2 = `custom:${currSource.template()}`;
69945       }
69946       if (id2) {
69947         hash2.background = id2;
69948       } else {
69949         delete hash2.background;
69950       }
69951       if (o2) {
69952         hash2.overlays = o2;
69953       } else {
69954         delete hash2.overlays;
69955       }
69956       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
69957         hash2.offset = `${x2},${y2}`;
69958       } else {
69959         delete hash2.offset;
69960       }
69961       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
69962       let imageryUsed = [];
69963       let photoOverlaysUsed = [];
69964       const currUsed = currSource.imageryUsed();
69965       if (currUsed && _isValid) {
69966         imageryUsed.push(currUsed);
69967       }
69968       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
69969       const dataLayer = context.layers().layer("data");
69970       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
69971         imageryUsed.push(dataLayer.getSrc());
69972       }
69973       const photoOverlayLayers = {
69974         streetside: "Bing Streetside",
69975         mapillary: "Mapillary Images",
69976         "mapillary-map-features": "Mapillary Map Features",
69977         "mapillary-signs": "Mapillary Signs",
69978         kartaview: "KartaView Images",
69979         vegbilder: "Norwegian Road Administration Images",
69980         mapilio: "Mapilio Images",
69981         panoramax: "Panoramax Images"
69982       };
69983       for (let layerID in photoOverlayLayers) {
69984         const layer = context.layers().layer(layerID);
69985         if (layer && layer.enabled()) {
69986           photoOverlaysUsed.push(layerID);
69987           imageryUsed.push(photoOverlayLayers[layerID]);
69988         }
69989       }
69990       context.history().imageryUsed(imageryUsed);
69991       context.history().photoOverlaysUsed(photoOverlaysUsed);
69992     };
69993     background.sources = (extent, zoom, includeCurrent) => {
69994       if (!_imageryIndex) return [];
69995       let visible = {};
69996       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
69997       const currSource = baseLayer.source();
69998       const osm = context.connection();
69999       const blocklists = osm && osm.imageryBlocklists() || [];
70000       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
70001       if (blocklistChanged) {
70002         _imageryIndex.backgrounds.forEach((source) => {
70003           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
70004         });
70005         _checkedBlocklists = blocklists.map((regex) => String(regex));
70006       }
70007       return _imageryIndex.backgrounds.filter((source) => {
70008         if (includeCurrent && currSource === source) return true;
70009         if (source.isBlocked) return false;
70010         if (!source.polygon) return true;
70011         if (zoom && zoom < 6) return false;
70012         return visible[source.id];
70013       });
70014     };
70015     background.dimensions = (val) => {
70016       if (!val) return;
70017       baseLayer.dimensions(val);
70018       _overlayLayers.forEach((layer) => layer.dimensions(val));
70019     };
70020     background.baseLayerSource = function(d2) {
70021       if (!arguments.length) return baseLayer.source();
70022       const osm = context.connection();
70023       if (!osm) return background;
70024       const blocklists = osm.imageryBlocklists();
70025       const template = d2.template();
70026       let fail = false;
70027       let tested = 0;
70028       let regex;
70029       for (let i3 = 0; i3 < blocklists.length; i3++) {
70030         regex = blocklists[i3];
70031         fail = regex.test(template);
70032         tested++;
70033         if (fail) break;
70034       }
70035       if (!tested) {
70036         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
70037         fail = regex.test(template);
70038       }
70039       baseLayer.source(!fail ? d2 : background.findSource("none"));
70040       dispatch14.call("change");
70041       background.updateImagery();
70042       return background;
70043     };
70044     background.findSource = (id2) => {
70045       if (!id2 || !_imageryIndex) return null;
70046       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
70047     };
70048     background.bing = () => {
70049       background.baseLayerSource(background.findSource("Bing"));
70050     };
70051     background.showsLayer = (d2) => {
70052       const currSource = baseLayer.source();
70053       if (!d2 || !currSource) return false;
70054       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
70055     };
70056     background.overlayLayerSources = () => {
70057       return _overlayLayers.map((layer) => layer.source());
70058     };
70059     background.toggleOverlayLayer = (d2) => {
70060       let layer;
70061       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
70062         layer = _overlayLayers[i3];
70063         if (layer.source() === d2) {
70064           _overlayLayers.splice(i3, 1);
70065           dispatch14.call("change");
70066           background.updateImagery();
70067           return;
70068         }
70069       }
70070       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
70071         baseLayer.dimensions()
70072       );
70073       _overlayLayers.push(layer);
70074       dispatch14.call("change");
70075       background.updateImagery();
70076     };
70077     background.nudge = (d2, zoom) => {
70078       const currSource = baseLayer.source();
70079       if (currSource) {
70080         currSource.nudge(d2, zoom);
70081         dispatch14.call("change");
70082         background.updateImagery();
70083       }
70084       return background;
70085     };
70086     background.offset = function(d2) {
70087       const currSource = baseLayer.source();
70088       if (!arguments.length) {
70089         return currSource && currSource.offset() || [0, 0];
70090       }
70091       if (currSource) {
70092         currSource.offset(d2);
70093         dispatch14.call("change");
70094         background.updateImagery();
70095       }
70096       return background;
70097     };
70098     background.brightness = function(d2) {
70099       if (!arguments.length) return _brightness;
70100       _brightness = d2;
70101       if (context.mode()) dispatch14.call("change");
70102       return background;
70103     };
70104     background.contrast = function(d2) {
70105       if (!arguments.length) return _contrast;
70106       _contrast = d2;
70107       if (context.mode()) dispatch14.call("change");
70108       return background;
70109     };
70110     background.saturation = function(d2) {
70111       if (!arguments.length) return _saturation;
70112       _saturation = d2;
70113       if (context.mode()) dispatch14.call("change");
70114       return background;
70115     };
70116     background.sharpness = function(d2) {
70117       if (!arguments.length) return _sharpness;
70118       _sharpness = d2;
70119       if (context.mode()) dispatch14.call("change");
70120       return background;
70121     };
70122     let _loadPromise;
70123     background.ensureLoaded = () => {
70124       if (_loadPromise) return _loadPromise;
70125       return _loadPromise = ensureImageryIndex();
70126     };
70127     background.init = () => {
70128       const loadPromise = background.ensureLoaded();
70129       const hash2 = utilStringQs(window.location.hash);
70130       const requestedBackground = hash2.background || hash2.layer;
70131       const lastUsedBackground = corePreferences("background-last-used");
70132       return loadPromise.then((imageryIndex) => {
70133         const extent = context.map().extent();
70134         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
70135         const first = validBackgrounds.length && validBackgrounds[0];
70136         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
70137         let best;
70138         if (!requestedBackground && extent) {
70139           const viewArea = extent.area();
70140           best = validBackgrounds.find((s2) => {
70141             if (!s2.best() || s2.overlay) return false;
70142             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
70143               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
70144               extent.rectangle()
70145             ));
70146             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
70147             return area / viewArea > 0.5;
70148           });
70149         }
70150         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
70151           const template = requestedBackground.replace(/^custom:/, "");
70152           const custom = background.findSource("custom");
70153           background.baseLayerSource(custom.template(template));
70154           corePreferences("background-custom-template", template);
70155         } else {
70156           background.baseLayerSource(
70157             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
70158           );
70159         }
70160         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
70161         if (locator) {
70162           background.toggleOverlayLayer(locator);
70163         }
70164         const overlays = (hash2.overlays || "").split(",");
70165         overlays.forEach((overlay) => {
70166           overlay = background.findSource(overlay);
70167           if (overlay) {
70168             background.toggleOverlayLayer(overlay);
70169           }
70170         });
70171         if (hash2.gpx) {
70172           const gpx2 = context.layers().layer("data");
70173           if (gpx2) {
70174             gpx2.url(hash2.gpx, ".gpx");
70175           }
70176         }
70177         if (hash2.offset) {
70178           const offset = hash2.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
70179           if (offset.length === 2) {
70180             background.offset(geoMetersToOffset(offset));
70181           }
70182         }
70183       }).catch((err) => {
70184         console.error(err);
70185       });
70186     };
70187     return utilRebind(background, dispatch14, "on");
70188   }
70189   var import_which_polygon4, _imageryIndex;
70190   var init_background2 = __esm({
70191     "modules/renderer/background.js"() {
70192       "use strict";
70193       init_src4();
70194       init_src8();
70195       init_src5();
70196       init_esm5();
70197       init_esm7();
70198       import_which_polygon4 = __toESM(require_which_polygon());
70199       init_preferences();
70200       init_file_fetcher();
70201       init_geo2();
70202       init_background_source();
70203       init_tile_layer();
70204       init_util();
70205       init_rebind();
70206       _imageryIndex = null;
70207     }
70208   });
70209
70210   // modules/renderer/features.js
70211   var features_exports = {};
70212   __export(features_exports, {
70213     rendererFeatures: () => rendererFeatures
70214   });
70215   function rendererFeatures(context) {
70216     var dispatch14 = dispatch_default("change", "redraw");
70217     const features = {};
70218     var _deferred2 = /* @__PURE__ */ new Set();
70219     var traffic_roads = {
70220       "motorway": true,
70221       "motorway_link": true,
70222       "trunk": true,
70223       "trunk_link": true,
70224       "primary": true,
70225       "primary_link": true,
70226       "secondary": true,
70227       "secondary_link": true,
70228       "tertiary": true,
70229       "tertiary_link": true,
70230       "residential": true,
70231       "unclassified": true,
70232       "living_street": true,
70233       "busway": true
70234     };
70235     var service_roads = {
70236       "service": true,
70237       "road": true,
70238       "track": true
70239     };
70240     var paths = {
70241       "path": true,
70242       "footway": true,
70243       "cycleway": true,
70244       "bridleway": true,
70245       "steps": true,
70246       "ladder": true,
70247       "pedestrian": true
70248     };
70249     var _cullFactor = 1;
70250     var _cache5 = {};
70251     var _rules = {};
70252     var _stats = {};
70253     var _keys = [];
70254     var _hidden = [];
70255     var _forceVisible = {};
70256     function update() {
70257       const hash2 = utilStringQs(window.location.hash);
70258       const disabled = features.disabled();
70259       if (disabled.length) {
70260         hash2.disable_features = disabled.join(",");
70261       } else {
70262         delete hash2.disable_features;
70263       }
70264       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
70265       corePreferences("disabled-features", disabled.join(","));
70266       _hidden = features.hidden();
70267       dispatch14.call("change");
70268       dispatch14.call("redraw");
70269     }
70270     function defineRule(k3, filter2, max3) {
70271       var isEnabled = true;
70272       _keys.push(k3);
70273       _rules[k3] = {
70274         filter: filter2,
70275         enabled: isEnabled,
70276         // whether the user wants it enabled..
70277         count: 0,
70278         currentMax: max3 || Infinity,
70279         defaultMax: max3 || Infinity,
70280         enable: function() {
70281           this.enabled = true;
70282           this.currentMax = this.defaultMax;
70283         },
70284         disable: function() {
70285           this.enabled = false;
70286           this.currentMax = 0;
70287         },
70288         hidden: function() {
70289           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
70290         },
70291         autoHidden: function() {
70292           return this.hidden() && this.currentMax > 0;
70293         }
70294       };
70295     }
70296     function isAddressPoint2(tags, geometry) {
70297       const keys2 = Object.keys(tags);
70298       return geometry === "point" && keys2.length > 0 && keys2.every(
70299         (key) => key.startsWith("addr:") || !osmIsInterestingTag(key)
70300       );
70301     }
70302     defineRule("address_points", isAddressPoint2, 100);
70303     defineRule("points", function isPoint(tags, geometry) {
70304       return geometry === "point" && !isAddressPoint2(tags, geometry);
70305     }, 200);
70306     defineRule("traffic_roads", function isTrafficRoad(tags) {
70307       return traffic_roads[tags.highway];
70308     });
70309     defineRule("service_roads", function isServiceRoad(tags) {
70310       return service_roads[tags.highway];
70311     });
70312     defineRule("paths", function isPath(tags) {
70313       return paths[tags.highway];
70314     });
70315     defineRule("buildings", function isBuilding(tags) {
70316       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
70317     }, 250);
70318     defineRule("building_parts", function isBuildingPart(tags) {
70319       return !!tags["building:part"];
70320     });
70321     defineRule("indoor", function isIndoor(tags) {
70322       return !!tags.indoor && tags.indoor !== "no" || !!tags.indoormark && tags.indoormark !== "no";
70323     });
70324     defineRule("landuse", function isLanduse(tags, geometry) {
70325       return geometry === "area" && (!!tags.landuse || !!tags.natural || !!tags.leisure || !!tags.amenity) && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
70326     });
70327     defineRule("boundaries", function isBoundary(tags, geometry) {
70328       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);
70329     });
70330     defineRule("water", function isWater(tags) {
70331       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";
70332     });
70333     defineRule("rail", function isRail(tags) {
70334       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
70335     });
70336     defineRule("pistes", function isPiste(tags) {
70337       return tags["piste:type"];
70338     });
70339     defineRule("aerialways", function isAerialways(tags) {
70340       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
70341     });
70342     defineRule("power", function isPower(tags) {
70343       return !!tags.power;
70344     });
70345     defineRule("past_future", function isPastFuture(tags) {
70346       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
70347         return false;
70348       }
70349       const keys2 = Object.keys(tags);
70350       for (const key of keys2) {
70351         if (osmLifecyclePrefixes[tags[key]]) return true;
70352         const parts = key.split(":");
70353         if (parts.length === 1) continue;
70354         const prefix = parts[0];
70355         if (osmLifecyclePrefixes[prefix]) return true;
70356       }
70357       return false;
70358     });
70359     defineRule("others", function isOther(tags, geometry) {
70360       return geometry === "line" || geometry === "area";
70361     });
70362     features.features = function() {
70363       return _rules;
70364     };
70365     features.keys = function() {
70366       return _keys;
70367     };
70368     features.enabled = function(k3) {
70369       if (!arguments.length) {
70370         return _keys.filter(function(k4) {
70371           return _rules[k4].enabled;
70372         });
70373       }
70374       return _rules[k3] && _rules[k3].enabled;
70375     };
70376     features.disabled = function(k3) {
70377       if (!arguments.length) {
70378         return _keys.filter(function(k4) {
70379           return !_rules[k4].enabled;
70380         });
70381       }
70382       return _rules[k3] && !_rules[k3].enabled;
70383     };
70384     features.hidden = function(k3) {
70385       var _a4;
70386       if (!arguments.length) {
70387         return _keys.filter(function(k4) {
70388           return _rules[k4].hidden();
70389         });
70390       }
70391       return (_a4 = _rules[k3]) == null ? void 0 : _a4.hidden();
70392     };
70393     features.autoHidden = function(k3) {
70394       if (!arguments.length) {
70395         return _keys.filter(function(k4) {
70396           return _rules[k4].autoHidden();
70397         });
70398       }
70399       return _rules[k3] && _rules[k3].autoHidden();
70400     };
70401     features.enable = function(k3) {
70402       if (_rules[k3] && !_rules[k3].enabled) {
70403         _rules[k3].enable();
70404         update();
70405       }
70406     };
70407     features.enableAll = function() {
70408       var didEnable = false;
70409       for (var k3 in _rules) {
70410         if (!_rules[k3].enabled) {
70411           didEnable = true;
70412           _rules[k3].enable();
70413         }
70414       }
70415       if (didEnable) update();
70416     };
70417     features.disable = function(k3) {
70418       if (_rules[k3] && _rules[k3].enabled) {
70419         _rules[k3].disable();
70420         update();
70421       }
70422     };
70423     features.disableAll = function() {
70424       var didDisable = false;
70425       for (var k3 in _rules) {
70426         if (_rules[k3].enabled) {
70427           didDisable = true;
70428           _rules[k3].disable();
70429         }
70430       }
70431       if (didDisable) update();
70432     };
70433     features.toggle = function(k3) {
70434       if (_rules[k3]) {
70435         (function(f2) {
70436           return f2.enabled ? f2.disable() : f2.enable();
70437         })(_rules[k3]);
70438         update();
70439       }
70440     };
70441     features.resetStats = function() {
70442       for (var i3 = 0; i3 < _keys.length; i3++) {
70443         _rules[_keys[i3]].count = 0;
70444       }
70445       dispatch14.call("change");
70446     };
70447     features.gatherStats = function(d2, resolver, dimensions) {
70448       var needsRedraw = false;
70449       var types = utilArrayGroupBy(d2, "type");
70450       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70451       var currHidden, geometry, matches, i3, j3;
70452       for (i3 = 0; i3 < _keys.length; i3++) {
70453         _rules[_keys[i3]].count = 0;
70454       }
70455       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
70456       for (i3 = 0; i3 < entities.length; i3++) {
70457         geometry = entities[i3].geometry(resolver);
70458         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
70459         for (j3 = 0; j3 < matches.length; j3++) {
70460           _rules[matches[j3]].count++;
70461         }
70462       }
70463       currHidden = features.hidden();
70464       if (currHidden !== _hidden) {
70465         _hidden = currHidden;
70466         needsRedraw = true;
70467         dispatch14.call("change");
70468       }
70469       return needsRedraw;
70470     };
70471     features.stats = function() {
70472       for (var i3 = 0; i3 < _keys.length; i3++) {
70473         _stats[_keys[i3]] = _rules[_keys[i3]].count;
70474       }
70475       return _stats;
70476     };
70477     features.clear = function(d2) {
70478       for (var i3 = 0; i3 < d2.length; i3++) {
70479         features.clearEntity(d2[i3]);
70480       }
70481     };
70482     features.clearEntity = function(entity) {
70483       delete _cache5[osmEntity.key(entity)];
70484     };
70485     features.reset = function() {
70486       Array.from(_deferred2).forEach(function(handle) {
70487         window.cancelIdleCallback(handle);
70488         _deferred2.delete(handle);
70489       });
70490       _cache5 = {};
70491     };
70492     function relationShouldBeChecked(relation) {
70493       return relation.tags.type === "boundary";
70494     }
70495     features.getMatches = function(entity, resolver, geometry) {
70496       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
70497       var ent = osmEntity.key(entity);
70498       if (!_cache5[ent]) {
70499         _cache5[ent] = {};
70500       }
70501       if (!_cache5[ent].matches) {
70502         var matches = {};
70503         var hasMatch = false;
70504         for (var i3 = 0; i3 < _keys.length; i3++) {
70505           if (_keys[i3] === "others") {
70506             if (hasMatch) continue;
70507             if (entity.type === "way") {
70508               var parents = features.getParents(entity, resolver, geometry);
70509               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
70510               parents.length > 0 && parents.every(function(parent2) {
70511                 return parent2.tags.type === "boundary";
70512               })) {
70513                 var pkey = osmEntity.key(parents[0]);
70514                 if (_cache5[pkey] && _cache5[pkey].matches) {
70515                   matches = Object.assign({}, _cache5[pkey].matches);
70516                   continue;
70517                 }
70518               }
70519             }
70520           }
70521           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
70522             matches[_keys[i3]] = hasMatch = true;
70523           }
70524         }
70525         _cache5[ent].matches = matches;
70526       }
70527       return _cache5[ent].matches;
70528     };
70529     features.getParents = function(entity, resolver, geometry) {
70530       if (geometry === "point") return [];
70531       var ent = osmEntity.key(entity);
70532       if (!_cache5[ent]) {
70533         _cache5[ent] = {};
70534       }
70535       if (!_cache5[ent].parents) {
70536         var parents = [];
70537         if (geometry === "vertex") {
70538           parents = resolver.parentWays(entity);
70539         } else {
70540           parents = resolver.parentRelations(entity);
70541         }
70542         _cache5[ent].parents = parents;
70543       }
70544       return _cache5[ent].parents;
70545     };
70546     features.isHiddenPreset = function(preset, geometry) {
70547       if (!_hidden.length) return false;
70548       if (!preset.tags) return false;
70549       var test = preset.setTags({}, geometry);
70550       for (var key in _rules) {
70551         if (_rules[key].filter(test, geometry)) {
70552           if (_hidden.indexOf(key) !== -1) {
70553             return key;
70554           }
70555           return false;
70556         }
70557       }
70558       return false;
70559     };
70560     features.isHiddenFeature = function(entity, resolver, geometry) {
70561       if (!_hidden.length) return false;
70562       if (!entity.version) return false;
70563       if (_forceVisible[entity.id]) return false;
70564       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
70565       return matches.length && matches.every(function(k3) {
70566         return features.hidden(k3);
70567       });
70568     };
70569     features.isHiddenChild = function(entity, resolver, geometry) {
70570       if (!_hidden.length) return false;
70571       if (!entity.version || geometry === "point") return false;
70572       if (_forceVisible[entity.id]) return false;
70573       var parents = features.getParents(entity, resolver, geometry);
70574       if (!parents.length) return false;
70575       for (var i3 = 0; i3 < parents.length; i3++) {
70576         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
70577           return false;
70578         }
70579       }
70580       return true;
70581     };
70582     features.hasHiddenConnections = function(entity, resolver) {
70583       if (!_hidden.length) return false;
70584       var childNodes, connections;
70585       if (entity.type === "midpoint") {
70586         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
70587         connections = [];
70588       } else {
70589         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
70590         connections = features.getParents(entity, resolver, entity.geometry(resolver));
70591       }
70592       connections = childNodes.reduce(function(result, e3) {
70593         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
70594       }, connections);
70595       return connections.some(function(e3) {
70596         return features.isHidden(e3, resolver, e3.geometry(resolver));
70597       });
70598     };
70599     features.isHidden = function(entity, resolver, geometry) {
70600       if (!_hidden.length) return false;
70601       if (!entity.version) return false;
70602       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
70603       return fn(entity, resolver, geometry);
70604     };
70605     features.filter = function(d2, resolver) {
70606       if (!_hidden.length) return d2;
70607       var result = [];
70608       for (var i3 = 0; i3 < d2.length; i3++) {
70609         var entity = d2[i3];
70610         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
70611           result.push(entity);
70612         }
70613       }
70614       return result;
70615     };
70616     features.forceVisible = function(entityIDs) {
70617       if (!arguments.length) return Object.keys(_forceVisible);
70618       _forceVisible = {};
70619       for (var i3 = 0; i3 < entityIDs.length; i3++) {
70620         _forceVisible[entityIDs[i3]] = true;
70621         var entity = context.hasEntity(entityIDs[i3]);
70622         if (entity && entity.type === "relation") {
70623           for (var j3 in entity.members) {
70624             _forceVisible[entity.members[j3].id] = true;
70625           }
70626         }
70627       }
70628       return features;
70629     };
70630     features.init = function() {
70631       var storage = corePreferences("disabled-features");
70632       if (storage) {
70633         var storageDisabled = storage.replace(/;/g, ",").split(",");
70634         storageDisabled.forEach(features.disable);
70635       }
70636       var hash2 = utilStringQs(window.location.hash);
70637       if (hash2.disable_features) {
70638         var hashDisabled = hash2.disable_features.replace(/;/g, ",").split(",");
70639         hashDisabled.forEach(features.disable);
70640       }
70641     };
70642     context.history().on("merge.features", function(newEntities) {
70643       if (!newEntities) return;
70644       var handle = window.requestIdleCallback(function() {
70645         var graph = context.graph();
70646         var types = utilArrayGroupBy(newEntities, "type");
70647         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
70648         for (var i3 = 0; i3 < entities.length; i3++) {
70649           var geometry = entities[i3].geometry(graph);
70650           features.getMatches(entities[i3], graph, geometry);
70651         }
70652       });
70653       _deferred2.add(handle);
70654     });
70655     return utilRebind(features, dispatch14, "on");
70656   }
70657   var init_features = __esm({
70658     "modules/renderer/features.js"() {
70659       "use strict";
70660       init_src4();
70661       init_preferences();
70662       init_osm();
70663       init_rebind();
70664       init_util();
70665     }
70666   });
70667
70668   // modules/util/bind_once.js
70669   var bind_once_exports = {};
70670   __export(bind_once_exports, {
70671     utilBindOnce: () => utilBindOnce
70672   });
70673   function utilBindOnce(target, type2, listener, capture) {
70674     var typeOnce = type2 + ".once";
70675     function one2() {
70676       target.on(typeOnce, null);
70677       listener.apply(this, arguments);
70678     }
70679     target.on(typeOnce, one2, capture);
70680     return this;
70681   }
70682   var init_bind_once = __esm({
70683     "modules/util/bind_once.js"() {
70684       "use strict";
70685     }
70686   });
70687
70688   // modules/util/zoom_pan.js
70689   var zoom_pan_exports = {};
70690   __export(zoom_pan_exports, {
70691     utilZoomPan: () => utilZoomPan
70692   });
70693   function defaultFilter3(d3_event) {
70694     return !d3_event.ctrlKey && !d3_event.button;
70695   }
70696   function defaultExtent2() {
70697     var e3 = this;
70698     if (e3 instanceof SVGElement) {
70699       e3 = e3.ownerSVGElement || e3;
70700       if (e3.hasAttribute("viewBox")) {
70701         e3 = e3.viewBox.baseVal;
70702         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
70703       }
70704       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
70705     }
70706     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
70707   }
70708   function defaultWheelDelta2(d3_event) {
70709     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
70710   }
70711   function defaultConstrain2(transform2, extent, translateExtent) {
70712     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];
70713     return transform2.translate(
70714       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
70715       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
70716     );
70717   }
70718   function utilZoomPan() {
70719     var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch14 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
70720     function zoom(selection2) {
70721       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
70722       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
70723     }
70724     zoom.transform = function(collection, transform2, point) {
70725       var selection2 = collection.selection ? collection.selection() : collection;
70726       if (collection !== selection2) {
70727         schedule(collection, transform2, point);
70728       } else {
70729         selection2.interrupt().each(function() {
70730           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
70731         });
70732       }
70733     };
70734     zoom.scaleBy = function(selection2, k3, p2) {
70735       zoom.scaleTo(selection2, function() {
70736         var k0 = _transform.k, k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
70737         return k0 * k1;
70738       }, p2);
70739     };
70740     zoom.scaleTo = function(selection2, k3, p2) {
70741       zoom.transform(selection2, function() {
70742         var e3 = extent.apply(this, arguments), t02 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t02.invert(p02), k1 = typeof k3 === "function" ? k3.apply(this, arguments) : k3;
70743         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
70744       }, p2);
70745     };
70746     zoom.translateBy = function(selection2, x2, y2) {
70747       zoom.transform(selection2, function() {
70748         return constrain(_transform.translate(
70749           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
70750           typeof y2 === "function" ? y2.apply(this, arguments) : y2
70751         ), extent.apply(this, arguments), translateExtent);
70752       });
70753     };
70754     zoom.translateTo = function(selection2, x2, y2, p2) {
70755       zoom.transform(selection2, function() {
70756         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
70757         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
70758           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
70759           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
70760         ), e3, translateExtent);
70761       }, p2);
70762     };
70763     function scale(transform2, k3) {
70764       k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k3));
70765       return k3 === transform2.k ? transform2 : new Transform(k3, transform2.x, transform2.y);
70766     }
70767     function translate(transform2, p02, p1) {
70768       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
70769       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
70770     }
70771     function centroid(extent2) {
70772       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
70773     }
70774     function schedule(transition2, transform2, point) {
70775       transition2.on("start.zoom", function() {
70776         gesture(this, arguments).start(null);
70777       }).on("interrupt.zoom end.zoom", function() {
70778         gesture(this, arguments).end(null);
70779       }).tween("zoom", function() {
70780         var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w3 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a4 = _transform, b3 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a4.invert(p2).concat(w3 / a4.k), b3.invert(p2).concat(w3 / b3.k));
70781         return function(t2) {
70782           if (t2 === 1) {
70783             t2 = b3;
70784           } else {
70785             var l2 = i3(t2);
70786             var k3 = w3 / l2[2];
70787             t2 = new Transform(k3, p2[0] - l2[0] * k3, p2[1] - l2[1] * k3);
70788           }
70789           g3.zoom(null, null, t2);
70790         };
70791       });
70792     }
70793     function gesture(that, args, clean2) {
70794       return !clean2 && _activeGesture || new Gesture(that, args);
70795     }
70796     function Gesture(that, args) {
70797       this.that = that;
70798       this.args = args;
70799       this.active = 0;
70800       this.extent = extent.apply(that, args);
70801     }
70802     Gesture.prototype = {
70803       start: function(d3_event) {
70804         if (++this.active === 1) {
70805           _activeGesture = this;
70806           dispatch14.call("start", this, d3_event);
70807         }
70808         return this;
70809       },
70810       zoom: function(d3_event, key, transform2) {
70811         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
70812         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
70813         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
70814         _transform = transform2;
70815         dispatch14.call("zoom", this, d3_event, key, transform2);
70816         return this;
70817       },
70818       end: function(d3_event) {
70819         if (--this.active === 0) {
70820           _activeGesture = null;
70821           dispatch14.call("end", this, d3_event);
70822         }
70823         return this;
70824       }
70825     };
70826     function wheeled(d3_event) {
70827       if (!filter2.apply(this, arguments)) return;
70828       var g3 = gesture(this, arguments), t2 = _transform, k3 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
70829       if (g3.wheel) {
70830         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
70831           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
70832         }
70833         clearTimeout(g3.wheel);
70834       } else {
70835         g3.mouse = [p2, t2.invert(p2)];
70836         interrupt_default(this);
70837         g3.start(d3_event);
70838       }
70839       d3_event.preventDefault();
70840       d3_event.stopImmediatePropagation();
70841       g3.wheel = setTimeout(wheelidled, _wheelDelay);
70842       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k3), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
70843       function wheelidled() {
70844         g3.wheel = null;
70845         g3.end(d3_event);
70846       }
70847     }
70848     var _downPointerIDs = /* @__PURE__ */ new Set();
70849     var _pointerLocGetter;
70850     function pointerdown(d3_event) {
70851       _downPointerIDs.add(d3_event.pointerId);
70852       if (!filter2.apply(this, arguments)) return;
70853       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
70854       var started;
70855       d3_event.stopImmediatePropagation();
70856       _pointerLocGetter = utilFastMouse(this);
70857       var loc = _pointerLocGetter(d3_event);
70858       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
70859       if (!g3.pointer0) {
70860         g3.pointer0 = p2;
70861         started = true;
70862       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
70863         g3.pointer1 = p2;
70864       }
70865       if (started) {
70866         interrupt_default(this);
70867         g3.start(d3_event);
70868       }
70869     }
70870     function pointermove(d3_event) {
70871       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70872       if (!_activeGesture || !_pointerLocGetter) return;
70873       var g3 = gesture(this, arguments);
70874       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
70875       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
70876       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
70877         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
70878         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
70879         g3.end(d3_event);
70880         return;
70881       }
70882       d3_event.preventDefault();
70883       d3_event.stopImmediatePropagation();
70884       var loc = _pointerLocGetter(d3_event);
70885       var t2, p2, l2;
70886       if (isPointer0) g3.pointer0[0] = loc;
70887       else if (isPointer1) g3.pointer1[0] = loc;
70888       t2 = _transform;
70889       if (g3.pointer1) {
70890         var p02 = g3.pointer0[0], l0 = g3.pointer0[1], p1 = g3.pointer1[0], l1 = g3.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;
70891         t2 = scale(t2, Math.sqrt(dp / dl));
70892         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
70893         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
70894       } else if (g3.pointer0) {
70895         p2 = g3.pointer0[0];
70896         l2 = g3.pointer0[1];
70897       } else {
70898         return;
70899       }
70900       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
70901     }
70902     function pointerup(d3_event) {
70903       if (!_downPointerIDs.has(d3_event.pointerId)) return;
70904       _downPointerIDs.delete(d3_event.pointerId);
70905       if (!_activeGesture) return;
70906       var g3 = gesture(this, arguments);
70907       d3_event.stopImmediatePropagation();
70908       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
70909       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
70910       if (g3.pointer1 && !g3.pointer0) {
70911         g3.pointer0 = g3.pointer1;
70912         delete g3.pointer1;
70913       }
70914       if (g3.pointer0) {
70915         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
70916       } else {
70917         g3.end(d3_event);
70918       }
70919     }
70920     zoom.wheelDelta = function(_3) {
70921       return arguments.length ? (wheelDelta = utilFunctor(+_3), zoom) : wheelDelta;
70922     };
70923     zoom.filter = function(_3) {
70924       return arguments.length ? (filter2 = utilFunctor(!!_3), zoom) : filter2;
70925     };
70926     zoom.extent = function(_3) {
70927       return arguments.length ? (extent = utilFunctor([[+_3[0][0], +_3[0][1]], [+_3[1][0], +_3[1][1]]]), zoom) : extent;
70928     };
70929     zoom.scaleExtent = function(_3) {
70930       return arguments.length ? (scaleExtent[0] = +_3[0], scaleExtent[1] = +_3[1], zoom) : [scaleExtent[0], scaleExtent[1]];
70931     };
70932     zoom.translateExtent = function(_3) {
70933       return arguments.length ? (translateExtent[0][0] = +_3[0][0], translateExtent[1][0] = +_3[1][0], translateExtent[0][1] = +_3[0][1], translateExtent[1][1] = +_3[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
70934     };
70935     zoom.constrain = function(_3) {
70936       return arguments.length ? (constrain = _3, zoom) : constrain;
70937     };
70938     zoom.interpolate = function(_3) {
70939       return arguments.length ? (interpolate = _3, zoom) : interpolate;
70940     };
70941     zoom._transform = function(_3) {
70942       return arguments.length ? (_transform = _3, zoom) : _transform;
70943     };
70944     return utilRebind(zoom, dispatch14, "on");
70945   }
70946   var init_zoom_pan = __esm({
70947     "modules/util/zoom_pan.js"() {
70948       "use strict";
70949       init_src4();
70950       init_src8();
70951       init_src5();
70952       init_src11();
70953       init_src12();
70954       init_transform3();
70955       init_util2();
70956       init_rebind();
70957     }
70958   });
70959
70960   // modules/util/double_up.js
70961   var double_up_exports = {};
70962   __export(double_up_exports, {
70963     utilDoubleUp: () => utilDoubleUp
70964   });
70965   function utilDoubleUp() {
70966     var dispatch14 = dispatch_default("doubleUp");
70967     var _maxTimespan = 500;
70968     var _maxDistance = 20;
70969     var _pointer;
70970     function pointerIsValidFor(loc) {
70971       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
70972       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
70973     }
70974     function pointerdown(d3_event) {
70975       if (d3_event.ctrlKey || d3_event.button === 2) return;
70976       var loc = [d3_event.clientX, d3_event.clientY];
70977       if (_pointer && !pointerIsValidFor(loc)) {
70978         _pointer = void 0;
70979       }
70980       if (!_pointer) {
70981         _pointer = {
70982           startLoc: loc,
70983           startTime: (/* @__PURE__ */ new Date()).getTime(),
70984           upCount: 0,
70985           pointerId: d3_event.pointerId
70986         };
70987       } else {
70988         _pointer.pointerId = d3_event.pointerId;
70989       }
70990     }
70991     function pointerup(d3_event) {
70992       if (d3_event.ctrlKey || d3_event.button === 2) return;
70993       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
70994       _pointer.upCount += 1;
70995       if (_pointer.upCount === 2) {
70996         var loc = [d3_event.clientX, d3_event.clientY];
70997         if (pointerIsValidFor(loc)) {
70998           var locInThis = utilFastMouse(this)(d3_event);
70999           dispatch14.call("doubleUp", this, d3_event, locInThis);
71000         }
71001         _pointer = void 0;
71002       }
71003     }
71004     function doubleUp(selection2) {
71005       if ("PointerEvent" in window) {
71006         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
71007       } else {
71008         selection2.on("dblclick.doubleUp", function(d3_event) {
71009           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
71010         });
71011       }
71012     }
71013     doubleUp.off = function(selection2) {
71014       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
71015     };
71016     return utilRebind(doubleUp, dispatch14, "on");
71017   }
71018   var init_double_up = __esm({
71019     "modules/util/double_up.js"() {
71020       "use strict";
71021       init_src4();
71022       init_util2();
71023       init_rebind();
71024       init_vector();
71025     }
71026   });
71027
71028   // modules/renderer/map.js
71029   var map_exports = {};
71030   __export(map_exports, {
71031     rendererMap: () => rendererMap
71032   });
71033   function rendererMap(context) {
71034     var dispatch14 = dispatch_default(
71035       "move",
71036       "drawn",
71037       "crossEditableZoom",
71038       "hitMinZoom",
71039       "changeHighlighting",
71040       "changeAreaFill"
71041     );
71042     var projection2 = context.projection;
71043     var curtainProjection = context.curtainProjection;
71044     var drawLayers;
71045     var drawPoints;
71046     var drawVertices;
71047     var drawLines;
71048     var drawAreas;
71049     var drawMidpoints;
71050     var drawLabels;
71051     var _selection = select_default2(null);
71052     var supersurface = select_default2(null);
71053     var wrapper = select_default2(null);
71054     var surface = select_default2(null);
71055     var _dimensions = [1, 1];
71056     var _dblClickZoomEnabled = true;
71057     var _redrawEnabled = true;
71058     var _gestureTransformStart;
71059     var _transformStart = projection2.transform();
71060     var _transformLast;
71061     var _isTransformed = false;
71062     var _minzoom = 0;
71063     var _getMouseCoords;
71064     var _lastPointerEvent;
71065     var _lastWithinEditableZoom;
71066     var _pointerDown = false;
71067     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71068     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
71069     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
71070       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
71071     }).on("end.map", function() {
71072       _pointerDown = false;
71073     });
71074     var _doubleUpHandler = utilDoubleUp();
71075     var scheduleRedraw = throttle_default(redraw, 750);
71076     function cancelPendingRedraw() {
71077       scheduleRedraw.cancel();
71078     }
71079     function map2(selection2) {
71080       _selection = selection2;
71081       context.on("change.map", immediateRedraw);
71082       var osm = context.connection();
71083       if (osm) {
71084         osm.on("change.map", immediateRedraw);
71085       }
71086       function didUndoOrRedo(targetTransform) {
71087         var mode = context.mode().id;
71088         if (mode !== "browse" && mode !== "select") return;
71089         if (targetTransform) {
71090           map2.transformEase(targetTransform);
71091         }
71092       }
71093       context.history().on("merge.map", function() {
71094         scheduleRedraw();
71095       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
71096         didUndoOrRedo(fromStack.transform);
71097       }).on("redone.map", function(stack) {
71098         didUndoOrRedo(stack.transform);
71099       });
71100       context.background().on("change.map", immediateRedraw);
71101       context.features().on("redraw.map", immediateRedraw);
71102       drawLayers.on("change.map", function() {
71103         context.background().updateImagery();
71104         immediateRedraw();
71105       });
71106       selection2.on("wheel.map mousewheel.map", function(d3_event) {
71107         d3_event.preventDefault();
71108       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
71109       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
71110       wrapper = supersurface.append("div").attr("class", "layer layer-data");
71111       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
71112       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
71113         _lastPointerEvent = d3_event;
71114         if (d3_event.button === 2) {
71115           d3_event.stopPropagation();
71116         }
71117       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
71118         _lastPointerEvent = d3_event;
71119         if (resetTransform()) {
71120           immediateRedraw();
71121         }
71122       }).on(_pointerPrefix + "move.map", function(d3_event) {
71123         _lastPointerEvent = d3_event;
71124       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
71125         if (map2.editableDataEnabled() && !_isTransformed) {
71126           var hover = d3_event.target.__data__;
71127           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71128           dispatch14.call("drawn", this, { full: false });
71129         }
71130       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
71131         if (map2.editableDataEnabled() && !_isTransformed) {
71132           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
71133           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
71134           dispatch14.call("drawn", this, { full: false });
71135         }
71136       });
71137       var detected = utilDetect();
71138       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
71139       // but we only need to do this on desktop Safari anyway. – #7694
71140       !detected.isMobileWebKit) {
71141         surface.on("gesturestart.surface", function(d3_event) {
71142           d3_event.preventDefault();
71143           _gestureTransformStart = projection2.transform();
71144         }).on("gesturechange.surface", gestureChange);
71145       }
71146       updateAreaFill();
71147       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
71148         if (!_dblClickZoomEnabled) return;
71149         if (typeof d3_event.target.__data__ === "object" && // or area fills
71150         !select_default2(d3_event.target).classed("fill")) return;
71151         var zoomOut2 = d3_event.shiftKey;
71152         var t2 = projection2.transform();
71153         var p1 = t2.invert(p02);
71154         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
71155         t2.x = p02[0] - p1[0] * t2.k;
71156         t2.y = p02[1] - p1[1] * t2.k;
71157         map2.transformEase(t2);
71158       });
71159       context.on("enter.map", function() {
71160         if (!map2.editableDataEnabled(
71161           true
71162           /* skip zoom check */
71163         )) return;
71164         if (_isTransformed) return;
71165         var graph = context.graph();
71166         var selectedAndParents = {};
71167         context.selectedIDs().forEach(function(id2) {
71168           var entity = graph.hasEntity(id2);
71169           if (entity) {
71170             selectedAndParents[entity.id] = entity;
71171             if (entity.type === "node") {
71172               graph.parentWays(entity).forEach(function(parent2) {
71173                 selectedAndParents[parent2.id] = parent2;
71174               });
71175             }
71176           }
71177         });
71178         var data = Object.values(selectedAndParents);
71179         var filter2 = function(d2) {
71180           return d2.id in selectedAndParents;
71181         };
71182         data = context.features().filter(data, graph);
71183         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
71184         dispatch14.call("drawn", this, { full: false });
71185         scheduleRedraw();
71186       });
71187       map2.dimensions(utilGetDimensions(selection2));
71188     }
71189     function zoomEventFilter(d3_event) {
71190       if (d3_event.type === "mousedown") {
71191         var hasOrphan = false;
71192         var listeners = window.__on;
71193         for (var i3 = 0; i3 < listeners.length; i3++) {
71194           var listener = listeners[i3];
71195           if (listener.name === "zoom" && listener.type === "mouseup") {
71196             hasOrphan = true;
71197             break;
71198           }
71199         }
71200         if (hasOrphan) {
71201           var event = window.CustomEvent;
71202           if (event) {
71203             event = new event("mouseup");
71204           } else {
71205             event = window.document.createEvent("Event");
71206             event.initEvent("mouseup", false, false);
71207           }
71208           event.view = window;
71209           window.dispatchEvent(event);
71210         }
71211       }
71212       return d3_event.button !== 2;
71213     }
71214     function pxCenter() {
71215       return [_dimensions[0] / 2, _dimensions[1] / 2];
71216     }
71217     function drawEditable(difference2, extent) {
71218       var mode = context.mode();
71219       var graph = context.graph();
71220       var features = context.features();
71221       var all = context.history().intersects(map2.extent());
71222       var fullRedraw = false;
71223       var data;
71224       var set4;
71225       var filter2;
71226       var applyFeatureLayerFilters = true;
71227       if (map2.isInWideSelection()) {
71228         data = [];
71229         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
71230           var entity = context.hasEntity(id2);
71231           if (entity) data.push(entity);
71232         });
71233         fullRedraw = true;
71234         filter2 = utilFunctor(true);
71235         applyFeatureLayerFilters = false;
71236       } else if (difference2) {
71237         var complete = difference2.complete(map2.extent());
71238         data = Object.values(complete).filter(Boolean);
71239         set4 = new Set(Object.keys(complete));
71240         filter2 = function(d2) {
71241           return set4.has(d2.id);
71242         };
71243         features.clear(data);
71244       } else {
71245         if (features.gatherStats(all, graph, _dimensions)) {
71246           extent = void 0;
71247         }
71248         if (extent) {
71249           data = context.history().intersects(map2.extent().intersection(extent));
71250           set4 = new Set(data.map(function(entity) {
71251             return entity.id;
71252           }));
71253           filter2 = function(d2) {
71254             return set4.has(d2.id);
71255           };
71256         } else {
71257           data = all;
71258           fullRedraw = true;
71259           filter2 = utilFunctor(true);
71260         }
71261       }
71262       if (applyFeatureLayerFilters) {
71263         data = features.filter(data, graph);
71264       } else {
71265         context.features().resetStats();
71266       }
71267       if (mode && mode.id === "select") {
71268         surface.call(drawVertices.drawSelected, graph, map2.extent());
71269       }
71270       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(drawPoints, graph, data, filter2).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw);
71271       dispatch14.call("drawn", this, { full: true });
71272     }
71273     map2.init = function() {
71274       drawLayers = svgLayers(projection2, context);
71275       drawPoints = svgPoints(projection2, context);
71276       drawVertices = svgVertices(projection2, context);
71277       drawLines = svgLines(projection2, context);
71278       drawAreas = svgAreas(projection2, context);
71279       drawMidpoints = svgMidpoints(projection2, context);
71280       drawLabels = svgLabels(projection2, context);
71281     };
71282     function editOff() {
71283       context.features().resetStats();
71284       surface.selectAll(".layer-osm *").remove();
71285       surface.selectAll(".layer-touch:not(.markers) *").remove();
71286       var allowed = {
71287         "browse": true,
71288         "save": true,
71289         "select-note": true,
71290         "select-data": true,
71291         "select-error": true
71292       };
71293       var mode = context.mode();
71294       if (mode && !allowed[mode.id]) {
71295         context.enter(modeBrowse(context));
71296       }
71297       dispatch14.call("drawn", this, { full: true });
71298     }
71299     function gestureChange(d3_event) {
71300       var e3 = d3_event;
71301       e3.preventDefault();
71302       var props = {
71303         deltaMode: 0,
71304         // dummy values to ignore in zoomPan
71305         deltaY: 1,
71306         // dummy values to ignore in zoomPan
71307         clientX: e3.clientX,
71308         clientY: e3.clientY,
71309         screenX: e3.screenX,
71310         screenY: e3.screenY,
71311         x: e3.x,
71312         y: e3.y
71313       };
71314       var e22 = new WheelEvent("wheel", props);
71315       e22._scale = e3.scale;
71316       e22._rotation = e3.rotation;
71317       _selection.node().dispatchEvent(e22);
71318     }
71319     function zoomPan2(event, key, transform2) {
71320       var source = event && event.sourceEvent || event;
71321       var eventTransform = transform2 || event && event.transform;
71322       var x2 = eventTransform.x;
71323       var y2 = eventTransform.y;
71324       var k3 = eventTransform.k;
71325       if (source && source.type === "wheel") {
71326         if (_pointerDown) return;
71327         var detected = utilDetect();
71328         var dX = source.deltaX;
71329         var dY = source.deltaY;
71330         var x22 = x2;
71331         var y22 = y2;
71332         var k22 = k3;
71333         var t02, p02, p1;
71334         if (source.deltaMode === 1) {
71335           var lines = Math.abs(source.deltaY);
71336           var sign2 = source.deltaY > 0 ? 1 : -1;
71337           dY = sign2 * clamp_default(
71338             lines * 18.001,
71339             4.000244140625,
71340             // min
71341             350.000244140625
71342             // max
71343           );
71344           t02 = _isTransformed ? _transformLast : _transformStart;
71345           p02 = _getMouseCoords(source);
71346           p1 = t02.invert(p02);
71347           k22 = t02.k * Math.pow(2, -dY / 500);
71348           k22 = clamp_default(k22, kMin, kMax);
71349           x22 = p02[0] - p1[0] * k22;
71350           y22 = p02[1] - p1[1] * k22;
71351         } else if (source._scale) {
71352           t02 = _gestureTransformStart;
71353           p02 = _getMouseCoords(source);
71354           p1 = t02.invert(p02);
71355           k22 = t02.k * source._scale;
71356           k22 = clamp_default(k22, kMin, kMax);
71357           x22 = p02[0] - p1[0] * k22;
71358           y22 = p02[1] - p1[1] * k22;
71359         } else if (source.ctrlKey && !isInteger(dY)) {
71360           dY *= 6;
71361           t02 = _isTransformed ? _transformLast : _transformStart;
71362           p02 = _getMouseCoords(source);
71363           p1 = t02.invert(p02);
71364           k22 = t02.k * Math.pow(2, -dY / 500);
71365           k22 = clamp_default(k22, kMin, kMax);
71366           x22 = p02[0] - p1[0] * k22;
71367           y22 = p02[1] - p1[1] * k22;
71368         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
71369           t02 = _isTransformed ? _transformLast : _transformStart;
71370           p02 = _getMouseCoords(source);
71371           p1 = t02.invert(p02);
71372           k22 = t02.k * Math.pow(2, -dY / 500);
71373           k22 = clamp_default(k22, kMin, kMax);
71374           x22 = p02[0] - p1[0] * k22;
71375           y22 = p02[1] - p1[1] * k22;
71376         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
71377           p1 = projection2.translate();
71378           x22 = p1[0] - dX;
71379           y22 = p1[1] - dY;
71380           k22 = projection2.scale();
71381           k22 = clamp_default(k22, kMin, kMax);
71382         }
71383         if (x22 !== x2 || y22 !== y2 || k22 !== k3) {
71384           x2 = x22;
71385           y2 = y22;
71386           k3 = k22;
71387           eventTransform = identity2.translate(x22, y22).scale(k22);
71388           if (_zoomerPanner._transform) {
71389             _zoomerPanner._transform(eventTransform);
71390           } else {
71391             _selection.node().__zoom = eventTransform;
71392           }
71393         }
71394       }
71395       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k3) {
71396         return;
71397       }
71398       if (geoScaleToZoom(k3, TILESIZE) < _minzoom) {
71399         surface.interrupt();
71400         dispatch14.call("hitMinZoom", this, map2);
71401         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
71402         scheduleRedraw();
71403         dispatch14.call("move", this, map2);
71404         return;
71405       }
71406       projection2.transform(eventTransform);
71407       var withinEditableZoom = map2.withinEditableZoom();
71408       if (_lastWithinEditableZoom !== withinEditableZoom) {
71409         if (_lastWithinEditableZoom !== void 0) {
71410           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
71411         }
71412         _lastWithinEditableZoom = withinEditableZoom;
71413       }
71414       var scale = k3 / _transformStart.k;
71415       var tX = (x2 / scale - _transformStart.x) * scale;
71416       var tY = (y2 / scale - _transformStart.y) * scale;
71417       if (context.inIntro()) {
71418         curtainProjection.transform({
71419           x: x2 - tX,
71420           y: y2 - tY,
71421           k: k3
71422         });
71423       }
71424       if (source) {
71425         _lastPointerEvent = event;
71426       }
71427       _isTransformed = true;
71428       _transformLast = eventTransform;
71429       utilSetTransform(supersurface, tX, tY, scale);
71430       scheduleRedraw();
71431       dispatch14.call("move", this, map2);
71432       function isInteger(val) {
71433         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
71434       }
71435     }
71436     function resetTransform() {
71437       if (!_isTransformed) return false;
71438       utilSetTransform(supersurface, 0, 0);
71439       _isTransformed = false;
71440       if (context.inIntro()) {
71441         curtainProjection.transform(projection2.transform());
71442       }
71443       return true;
71444     }
71445     function redraw(difference2, extent) {
71446       if (typeof window === "undefined") return;
71447       if (surface.empty() || !_redrawEnabled) return;
71448       if (resetTransform()) {
71449         difference2 = extent = void 0;
71450       }
71451       var zoom = map2.zoom();
71452       var z3 = String(~~zoom);
71453       if (surface.attr("data-zoom") !== z3) {
71454         surface.attr("data-zoom", z3);
71455       }
71456       var lat = map2.center()[1];
71457       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
71458       surface.classed("low-zoom", zoom <= lowzoom(lat));
71459       if (!difference2) {
71460         supersurface.call(context.background());
71461         wrapper.call(drawLayers);
71462       }
71463       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
71464         context.loadTiles(projection2);
71465         drawEditable(difference2, extent);
71466       } else {
71467         editOff();
71468       }
71469       _transformStart = projection2.transform();
71470       return map2;
71471     }
71472     var immediateRedraw = function(difference2, extent) {
71473       if (!difference2 && !extent) cancelPendingRedraw();
71474       redraw(difference2, extent);
71475     };
71476     map2.lastPointerEvent = function() {
71477       return _lastPointerEvent;
71478     };
71479     map2.mouse = function(d3_event) {
71480       var event = d3_event || _lastPointerEvent;
71481       if (event) {
71482         var s2;
71483         while (s2 = event.sourceEvent) {
71484           event = s2;
71485         }
71486         return _getMouseCoords(event);
71487       }
71488       return null;
71489     };
71490     map2.mouseCoordinates = function() {
71491       var coord2 = map2.mouse() || pxCenter();
71492       return projection2.invert(coord2);
71493     };
71494     map2.dblclickZoomEnable = function(val) {
71495       if (!arguments.length) return _dblClickZoomEnabled;
71496       _dblClickZoomEnabled = val;
71497       return map2;
71498     };
71499     map2.redrawEnable = function(val) {
71500       if (!arguments.length) return _redrawEnabled;
71501       _redrawEnabled = val;
71502       return map2;
71503     };
71504     map2.isTransformed = function() {
71505       return _isTransformed;
71506     };
71507     function setTransform(t2, duration, force) {
71508       var t3 = projection2.transform();
71509       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
71510       if (duration) {
71511         _selection.transition().duration(duration).on("start", function() {
71512           map2.startEase();
71513         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
71514       } else {
71515         projection2.transform(t2);
71516         _transformStart = t2;
71517         _selection.call(_zoomerPanner.transform, _transformStart);
71518       }
71519       return true;
71520     }
71521     function setCenterZoom(loc2, z22, duration, force) {
71522       var c2 = map2.center();
71523       var z3 = map2.zoom();
71524       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z22 === z3 && !force) return false;
71525       var proj = geoRawMercator().transform(projection2.transform());
71526       var k22 = clamp_default(geoZoomToScale(z22, TILESIZE), kMin, kMax);
71527       proj.scale(k22);
71528       var t2 = proj.translate();
71529       var point = proj(loc2);
71530       var center = pxCenter();
71531       t2[0] += center[0] - point[0];
71532       t2[1] += center[1] - point[1];
71533       return setTransform(identity2.translate(t2[0], t2[1]).scale(k22), duration, force);
71534     }
71535     map2.pan = function(delta, duration) {
71536       var t2 = projection2.translate();
71537       var k3 = projection2.scale();
71538       t2[0] += delta[0];
71539       t2[1] += delta[1];
71540       if (duration) {
71541         _selection.transition().duration(duration).on("start", function() {
71542           map2.startEase();
71543         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k3));
71544       } else {
71545         projection2.translate(t2);
71546         _transformStart = projection2.transform();
71547         _selection.call(_zoomerPanner.transform, _transformStart);
71548         dispatch14.call("move", this, map2);
71549         immediateRedraw();
71550       }
71551       return map2;
71552     };
71553     map2.dimensions = function(val) {
71554       if (!arguments.length) return _dimensions;
71555       _dimensions = val;
71556       drawLayers.dimensions(_dimensions);
71557       context.background().dimensions(_dimensions);
71558       projection2.clipExtent([[0, 0], _dimensions]);
71559       _getMouseCoords = utilFastMouse(supersurface.node());
71560       scheduleRedraw();
71561       return map2;
71562     };
71563     function zoomIn(delta) {
71564       setCenterZoom(map2.center(), Math.trunc(map2.zoom() + 0.45) + delta, 150, true);
71565     }
71566     function zoomOut(delta) {
71567       setCenterZoom(map2.center(), Math.ceil(map2.zoom() - 0.45) - delta, 150, true);
71568     }
71569     map2.zoomIn = function() {
71570       zoomIn(1);
71571     };
71572     map2.zoomInFurther = function() {
71573       zoomIn(4);
71574     };
71575     map2.canZoomIn = function() {
71576       return map2.zoom() < maxZoom;
71577     };
71578     map2.zoomOut = function() {
71579       zoomOut(1);
71580     };
71581     map2.zoomOutFurther = function() {
71582       zoomOut(4);
71583     };
71584     map2.canZoomOut = function() {
71585       return map2.zoom() > minZoom4;
71586     };
71587     map2.center = function(loc2) {
71588       if (!arguments.length) {
71589         return projection2.invert(pxCenter());
71590       }
71591       if (setCenterZoom(loc2, map2.zoom())) {
71592         dispatch14.call("move", this, map2);
71593       }
71594       scheduleRedraw();
71595       return map2;
71596     };
71597     map2.unobscuredCenterZoomEase = function(loc, zoom) {
71598       var offset = map2.unobscuredOffsetPx();
71599       var proj = geoRawMercator().transform(projection2.transform());
71600       proj.scale(geoZoomToScale(zoom, TILESIZE));
71601       var locPx = proj(loc);
71602       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
71603       var offsetLoc = proj.invert(offsetLocPx);
71604       map2.centerZoomEase(offsetLoc, zoom);
71605     };
71606     map2.unobscuredOffsetPx = function() {
71607       var openPane = context.container().select(".map-panes .map-pane.shown");
71608       if (!openPane.empty()) {
71609         return [openPane.node().offsetWidth / 2, 0];
71610       }
71611       return [0, 0];
71612     };
71613     map2.zoom = function(z22) {
71614       if (!arguments.length) {
71615         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
71616       }
71617       if (z22 < _minzoom) {
71618         surface.interrupt();
71619         dispatch14.call("hitMinZoom", this, map2);
71620         z22 = context.minEditableZoom();
71621       }
71622       if (setCenterZoom(map2.center(), z22)) {
71623         dispatch14.call("move", this, map2);
71624       }
71625       scheduleRedraw();
71626       return map2;
71627     };
71628     map2.centerZoom = function(loc2, z22) {
71629       if (setCenterZoom(loc2, z22)) {
71630         dispatch14.call("move", this, map2);
71631       }
71632       scheduleRedraw();
71633       return map2;
71634     };
71635     map2.zoomTo = function(entities) {
71636       if (!isArray_default(entities)) {
71637         entities = [entities];
71638       }
71639       if (entities.length === 0) return map2;
71640       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a4, b3) => a4.extend(b3));
71641       if (!isFinite(extent.area())) return map2;
71642       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71643       return map2.centerZoom(extent.center(), z22);
71644     };
71645     map2.centerEase = function(loc2, duration) {
71646       duration = duration || 250;
71647       setCenterZoom(loc2, map2.zoom(), duration);
71648       return map2;
71649     };
71650     map2.zoomEase = function(z22, duration) {
71651       duration = duration || 250;
71652       setCenterZoom(map2.center(), z22, duration, false);
71653       return map2;
71654     };
71655     map2.centerZoomEase = function(loc2, z22, duration) {
71656       duration = duration || 250;
71657       setCenterZoom(loc2, z22, duration, false);
71658       return map2;
71659     };
71660     map2.transformEase = function(t2, duration) {
71661       duration = duration || 250;
71662       setTransform(
71663         t2,
71664         duration,
71665         false
71666         /* don't force */
71667       );
71668       return map2;
71669     };
71670     map2.zoomToEase = function(obj, duration) {
71671       var extent;
71672       if (Array.isArray(obj)) {
71673         obj.forEach(function(entity) {
71674           var entityExtent = entity.extent(context.graph());
71675           if (!extent) {
71676             extent = entityExtent;
71677           } else {
71678             extent = extent.extend(entityExtent);
71679           }
71680         });
71681       } else {
71682         extent = obj.extent(context.graph());
71683       }
71684       if (!isFinite(extent.area())) return map2;
71685       var z22 = clamp_default(map2.trimmedExtentZoom(extent), 0, 20);
71686       return map2.centerZoomEase(extent.center(), z22, duration);
71687     };
71688     map2.startEase = function() {
71689       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
71690         map2.cancelEase();
71691       });
71692       return map2;
71693     };
71694     map2.cancelEase = function() {
71695       _selection.interrupt();
71696       return map2;
71697     };
71698     map2.extent = function(val) {
71699       if (!arguments.length) {
71700         return new geoExtent(
71701           projection2.invert([0, _dimensions[1]]),
71702           projection2.invert([_dimensions[0], 0])
71703         );
71704       } else {
71705         var extent = geoExtent(val);
71706         map2.centerZoom(extent.center(), map2.extentZoom(extent));
71707       }
71708     };
71709     map2.trimmedExtent = function(val) {
71710       if (!arguments.length) {
71711         var headerY = 71;
71712         var footerY = 30;
71713         var pad3 = 10;
71714         return new geoExtent(
71715           projection2.invert([pad3, _dimensions[1] - footerY - pad3]),
71716           projection2.invert([_dimensions[0] - pad3, headerY + pad3])
71717         );
71718       } else {
71719         var extent = geoExtent(val);
71720         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
71721       }
71722     };
71723     function calcExtentZoom(extent, dim) {
71724       var tl = projection2([extent[0][0], extent[1][1]]);
71725       var br = projection2([extent[1][0], extent[0][1]]);
71726       var hFactor = (br[0] - tl[0]) / dim[0];
71727       var vFactor = (br[1] - tl[1]) / dim[1];
71728       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
71729       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
71730       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
71731       return newZoom;
71732     }
71733     map2.extentZoom = function(val) {
71734       return calcExtentZoom(geoExtent(val), _dimensions);
71735     };
71736     map2.trimmedExtentZoom = function(val) {
71737       var trimY = 120;
71738       var trimX = 40;
71739       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
71740       return calcExtentZoom(geoExtent(val), trimmed);
71741     };
71742     map2.withinEditableZoom = function() {
71743       return map2.zoom() >= context.minEditableZoom();
71744     };
71745     map2.isInWideSelection = function() {
71746       return !map2.withinEditableZoom() && context.selectedIDs().length;
71747     };
71748     map2.editableDataEnabled = function(skipZoomCheck) {
71749       var layer = context.layers().layer("osm");
71750       if (!layer || !layer.enabled()) return false;
71751       return skipZoomCheck || map2.withinEditableZoom();
71752     };
71753     map2.notesEditable = function() {
71754       var layer = context.layers().layer("notes");
71755       if (!layer || !layer.enabled()) return false;
71756       return map2.withinEditableZoom();
71757     };
71758     map2.minzoom = function(val) {
71759       if (!arguments.length) return _minzoom;
71760       _minzoom = val;
71761       return map2;
71762     };
71763     map2.toggleHighlightEdited = function() {
71764       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
71765       map2.pan([0, 0]);
71766       dispatch14.call("changeHighlighting", this);
71767     };
71768     map2.areaFillOptions = ["wireframe", "partial", "full"];
71769     map2.activeAreaFill = function(val) {
71770       if (!arguments.length) return corePreferences("area-fill") || "partial";
71771       corePreferences("area-fill", val);
71772       if (val !== "wireframe") {
71773         corePreferences("area-fill-toggle", val);
71774       }
71775       updateAreaFill();
71776       map2.pan([0, 0]);
71777       dispatch14.call("changeAreaFill", this);
71778       return map2;
71779     };
71780     map2.toggleWireframe = function() {
71781       var activeFill = map2.activeAreaFill();
71782       if (activeFill === "wireframe") {
71783         activeFill = corePreferences("area-fill-toggle") || "partial";
71784       } else {
71785         activeFill = "wireframe";
71786       }
71787       map2.activeAreaFill(activeFill);
71788     };
71789     function updateAreaFill() {
71790       var activeFill = map2.activeAreaFill();
71791       map2.areaFillOptions.forEach(function(opt) {
71792         surface.classed("fill-" + opt, Boolean(opt === activeFill));
71793       });
71794     }
71795     map2.layers = () => drawLayers;
71796     map2.doubleUpHandler = function() {
71797       return _doubleUpHandler;
71798     };
71799     return utilRebind(map2, dispatch14, "on");
71800   }
71801   var TILESIZE, minZoom4, maxZoom, kMin, kMax;
71802   var init_map = __esm({
71803     "modules/renderer/map.js"() {
71804       "use strict";
71805       init_throttle();
71806       init_src4();
71807       init_src8();
71808       init_src16();
71809       init_src5();
71810       init_src12();
71811       init_preferences();
71812       init_geo2();
71813       init_browse();
71814       init_svg();
71815       init_util2();
71816       init_bind_once();
71817       init_detect();
71818       init_dimensions();
71819       init_rebind();
71820       init_zoom_pan();
71821       init_double_up();
71822       init_lodash();
71823       TILESIZE = 256;
71824       minZoom4 = 2;
71825       maxZoom = 24;
71826       kMin = geoZoomToScale(minZoom4, TILESIZE);
71827       kMax = geoZoomToScale(maxZoom, TILESIZE);
71828     }
71829   });
71830
71831   // modules/renderer/photos.js
71832   var photos_exports = {};
71833   __export(photos_exports, {
71834     rendererPhotos: () => rendererPhotos
71835   });
71836   function rendererPhotos(context) {
71837     var dispatch14 = dispatch_default("change");
71838     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
71839     var _allPhotoTypes = ["flat", "panoramic"];
71840     var _shownPhotoTypes = _allPhotoTypes.slice();
71841     var _dateFilters = ["fromDate", "toDate"];
71842     var _fromDate;
71843     var _toDate;
71844     var _usernames;
71845     function photos() {
71846     }
71847     function updateStorage() {
71848       var hash2 = utilStringQs(window.location.hash);
71849       var enabled = context.layers().all().filter(function(d2) {
71850         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
71851       }).map(function(d2) {
71852         return d2.id;
71853       });
71854       if (enabled.length) {
71855         hash2.photo_overlay = enabled.join(",");
71856       } else {
71857         delete hash2.photo_overlay;
71858       }
71859       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71860     }
71861     photos.overlayLayerIDs = function() {
71862       return _layerIDs;
71863     };
71864     photos.allPhotoTypes = function() {
71865       return _allPhotoTypes;
71866     };
71867     photos.dateFilters = function() {
71868       return _dateFilters;
71869     };
71870     photos.dateFilterValue = function(val) {
71871       return val === _dateFilters[0] ? _fromDate : _toDate;
71872     };
71873     photos.setDateFilter = function(type2, val, updateUrl) {
71874       var date = val && new Date(val);
71875       if (date && !isNaN(date)) {
71876         val = date.toISOString().slice(0, 10);
71877       } else {
71878         val = null;
71879       }
71880       if (type2 === _dateFilters[0]) {
71881         _fromDate = val;
71882         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71883           _toDate = _fromDate;
71884         }
71885       }
71886       if (type2 === _dateFilters[1]) {
71887         _toDate = val;
71888         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
71889           _fromDate = _toDate;
71890         }
71891       }
71892       dispatch14.call("change", this);
71893       if (updateUrl) {
71894         var rangeString;
71895         if (_fromDate || _toDate) {
71896           rangeString = (_fromDate || "") + "_" + (_toDate || "");
71897         }
71898         setUrlFilterValue("photo_dates", rangeString);
71899       }
71900     };
71901     photos.setUsernameFilter = function(val, updateUrl) {
71902       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
71903       if (val) {
71904         val = val.map((d2) => d2.trim()).filter(Boolean);
71905         if (!val.length) {
71906           val = null;
71907         }
71908       }
71909       _usernames = val;
71910       dispatch14.call("change", this);
71911       if (updateUrl) {
71912         var hashString;
71913         if (_usernames) {
71914           hashString = _usernames.join(",");
71915         }
71916         setUrlFilterValue("photo_username", hashString);
71917       }
71918     };
71919     photos.togglePhotoType = function(val, updateUrl) {
71920       var index = _shownPhotoTypes.indexOf(val);
71921       if (index !== -1) {
71922         _shownPhotoTypes.splice(index, 1);
71923       } else {
71924         _shownPhotoTypes.push(val);
71925       }
71926       if (updateUrl) {
71927         var hashString;
71928         if (_shownPhotoTypes) {
71929           hashString = _shownPhotoTypes.join(",");
71930         }
71931         setUrlFilterValue("photo_type", hashString);
71932       }
71933       dispatch14.call("change", this);
71934       return photos;
71935     };
71936     function setUrlFilterValue(property, val) {
71937       const hash2 = utilStringQs(window.location.hash);
71938       if (val) {
71939         if (hash2[property] === val) return;
71940         hash2[property] = val;
71941       } else {
71942         if (!(property in hash2)) return;
71943         delete hash2[property];
71944       }
71945       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
71946     }
71947     function showsLayer(id2) {
71948       var layer = context.layers().layer(id2);
71949       return layer && layer.supported() && layer.enabled();
71950     }
71951     photos.shouldFilterDateBySlider = function() {
71952       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("mapilio") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
71953     };
71954     photos.shouldFilterByPhotoType = function() {
71955       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
71956     };
71957     photos.shouldFilterByUsername = function() {
71958       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
71959     };
71960     photos.showsPhotoType = function(val) {
71961       if (!photos.shouldFilterByPhotoType()) return true;
71962       return _shownPhotoTypes.indexOf(val) !== -1;
71963     };
71964     photos.showsFlat = function() {
71965       return photos.showsPhotoType("flat");
71966     };
71967     photos.showsPanoramic = function() {
71968       return photos.showsPhotoType("panoramic");
71969     };
71970     photos.fromDate = function() {
71971       return _fromDate;
71972     };
71973     photos.toDate = function() {
71974       return _toDate;
71975     };
71976     photos.usernames = function() {
71977       return _usernames;
71978     };
71979     photos.init = function() {
71980       var hash2 = utilStringQs(window.location.hash);
71981       var parts;
71982       if (hash2.photo_dates) {
71983         parts = /^(.*)[–_](.*)$/g.exec(hash2.photo_dates.trim());
71984         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
71985         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
71986       }
71987       if (hash2.photo_username) {
71988         this.setUsernameFilter(hash2.photo_username, false);
71989       }
71990       if (hash2.photo_type) {
71991         parts = hash2.photo_type.replace(/;/g, ",").split(",");
71992         _allPhotoTypes.forEach((d2) => {
71993           if (!parts.includes(d2)) this.togglePhotoType(d2, false);
71994         });
71995       }
71996       if (hash2.photo_overlay) {
71997         var hashOverlayIDs = hash2.photo_overlay.replace(/;/g, ",").split(",");
71998         hashOverlayIDs.forEach(function(id2) {
71999           if (id2 === "openstreetcam") id2 = "kartaview";
72000           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
72001           if (layer2 && !layer2.enabled()) layer2.enabled(true);
72002         });
72003       }
72004       if (hash2.photo) {
72005         var photoIds = hash2.photo.replace(/;/g, ",").split(",");
72006         var photoId = photoIds.length && photoIds[0].trim();
72007         var results = /(.*)\/(.*)/g.exec(photoId);
72008         if (results && results.length >= 3) {
72009           var serviceId = results[1];
72010           if (serviceId === "openstreetcam") serviceId = "kartaview";
72011           var photoKey = results[2];
72012           var service = services[serviceId];
72013           if (service && service.ensureViewerLoaded) {
72014             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
72015             if (layer && !layer.enabled()) layer.enabled(true);
72016             var baselineTime = Date.now();
72017             service.on("loadedImages.rendererPhotos", function() {
72018               if (Date.now() - baselineTime > 45e3) {
72019                 service.on("loadedImages.rendererPhotos", null);
72020                 return;
72021               }
72022               if (!service.cachedImage(photoKey)) return;
72023               service.on("loadedImages.rendererPhotos", null);
72024               service.ensureViewerLoaded(context).then(function() {
72025                 service.selectImage(context, photoKey).showViewer(context);
72026               });
72027             });
72028           }
72029         }
72030       }
72031       context.layers().on("change.rendererPhotos", updateStorage);
72032     };
72033     return utilRebind(photos, dispatch14, "on");
72034   }
72035   var init_photos = __esm({
72036     "modules/renderer/photos.js"() {
72037       "use strict";
72038       init_src4();
72039       init_services();
72040       init_rebind();
72041       init_util();
72042     }
72043   });
72044
72045   // modules/renderer/index.js
72046   var renderer_exports = {};
72047   __export(renderer_exports, {
72048     rendererBackground: () => rendererBackground,
72049     rendererBackgroundSource: () => rendererBackgroundSource,
72050     rendererFeatures: () => rendererFeatures,
72051     rendererMap: () => rendererMap,
72052     rendererPhotos: () => rendererPhotos,
72053     rendererTileLayer: () => rendererTileLayer
72054   });
72055   var init_renderer = __esm({
72056     "modules/renderer/index.js"() {
72057       "use strict";
72058       init_background_source();
72059       init_background2();
72060       init_features();
72061       init_map();
72062       init_photos();
72063       init_tile_layer();
72064     }
72065   });
72066
72067   // modules/ui/map_in_map.js
72068   var map_in_map_exports = {};
72069   __export(map_in_map_exports, {
72070     uiMapInMap: () => uiMapInMap
72071   });
72072   function uiMapInMap(context) {
72073     function mapInMap(selection2) {
72074       var backgroundLayer = rendererTileLayer(context).underzoom(2);
72075       var overlayLayers = {};
72076       var projection2 = geoRawMercator();
72077       var dataLayer = svgData(projection2, context).showLabels(false);
72078       var debugLayer = svgDebug(projection2, context);
72079       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
72080       var wrap2 = select_default2(null);
72081       var tiles = select_default2(null);
72082       var viewport = select_default2(null);
72083       var _isTransformed = false;
72084       var _isHidden = true;
72085       var _skipEvents = false;
72086       var _gesture = null;
72087       var _zDiff = 6;
72088       var _dMini;
72089       var _cMini;
72090       var _tStart;
72091       var _tCurr;
72092       var _timeoutID;
72093       function zoomStarted() {
72094         if (_skipEvents) return;
72095         _tStart = _tCurr = projection2.transform();
72096         _gesture = null;
72097       }
72098       function zoomed(d3_event) {
72099         if (_skipEvents) return;
72100         var x2 = d3_event.transform.x;
72101         var y2 = d3_event.transform.y;
72102         var k3 = d3_event.transform.k;
72103         var isZooming = k3 !== _tStart.k;
72104         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
72105         if (!isZooming && !isPanning) {
72106           return;
72107         }
72108         if (!_gesture) {
72109           _gesture = isZooming ? "zoom" : "pan";
72110         }
72111         var tMini = projection2.transform();
72112         var tX, tY, scale;
72113         if (_gesture === "zoom") {
72114           scale = k3 / tMini.k;
72115           tX = (_cMini[0] / scale - _cMini[0]) * scale;
72116           tY = (_cMini[1] / scale - _cMini[1]) * scale;
72117         } else {
72118           k3 = tMini.k;
72119           scale = 1;
72120           tX = x2 - tMini.x;
72121           tY = y2 - tMini.y;
72122         }
72123         utilSetTransform(tiles, tX, tY, scale);
72124         utilSetTransform(viewport, 0, 0, scale);
72125         _isTransformed = true;
72126         _tCurr = identity2.translate(x2, y2).scale(k3);
72127         var zMain = geoScaleToZoom(context.projection.scale());
72128         var zMini = geoScaleToZoom(k3);
72129         _zDiff = zMain - zMini;
72130         queueRedraw();
72131       }
72132       function zoomEnded() {
72133         if (_skipEvents) return;
72134         if (_gesture !== "pan") return;
72135         updateProjection();
72136         _gesture = null;
72137         context.map().center(projection2.invert(_cMini));
72138       }
72139       function updateProjection() {
72140         var loc = context.map().center();
72141         var tMain = context.projection.transform();
72142         var zMain = geoScaleToZoom(tMain.k);
72143         var zMini = Math.max(zMain - _zDiff, 0.5);
72144         var kMini = geoZoomToScale(zMini);
72145         projection2.translate([tMain.x, tMain.y]).scale(kMini);
72146         var point = projection2(loc);
72147         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
72148         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
72149         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
72150         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
72151         _tCurr = projection2.transform();
72152         if (_isTransformed) {
72153           utilSetTransform(tiles, 0, 0);
72154           utilSetTransform(viewport, 0, 0);
72155           _isTransformed = false;
72156         }
72157         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
72158         _skipEvents = true;
72159         wrap2.call(zoom.transform, _tCurr);
72160         _skipEvents = false;
72161       }
72162       function redraw() {
72163         clearTimeout(_timeoutID);
72164         if (_isHidden) return;
72165         updateProjection();
72166         var zMini = geoScaleToZoom(projection2.scale());
72167         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
72168         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
72169         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
72170         var background = tiles.selectAll(".map-in-map-background").data([0]);
72171         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
72172         var overlaySources = context.background().overlayLayerSources();
72173         var activeOverlayLayers = [];
72174         for (var i3 = 0; i3 < overlaySources.length; i3++) {
72175           if (overlaySources[i3].validZoom(zMini)) {
72176             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
72177             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
72178           }
72179         }
72180         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
72181         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
72182         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
72183           return d2.source().name();
72184         });
72185         overlays.exit().remove();
72186         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
72187           select_default2(this).call(layer);
72188         });
72189         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
72190         dataLayers.exit().remove();
72191         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
72192         if (_gesture !== "pan") {
72193           var getPath = path_default(projection2);
72194           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
72195           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
72196           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
72197           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
72198           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
72199             return getPath.area(d2) < 30;
72200           });
72201         }
72202       }
72203       function queueRedraw() {
72204         clearTimeout(_timeoutID);
72205         _timeoutID = setTimeout(function() {
72206           redraw();
72207         }, 750);
72208       }
72209       function toggle(d3_event) {
72210         if (d3_event) d3_event.preventDefault();
72211         _isHidden = !_isHidden;
72212         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
72213         if (_isHidden) {
72214           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
72215             selection2.selectAll(".map-in-map").style("display", "none");
72216           });
72217         } else {
72218           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
72219             redraw();
72220           });
72221         }
72222       }
72223       uiMapInMap.toggle = toggle;
72224       wrap2 = selection2.selectAll(".map-in-map").data([0]);
72225       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
72226       _dMini = [200, 150];
72227       _cMini = geoVecScale(_dMini, 0.5);
72228       context.map().on("drawn.map-in-map", function(drawn) {
72229         if (drawn.full === true) {
72230           redraw();
72231         }
72232       });
72233       redraw();
72234       context.keybinding().on(_t("background.minimap.key"), toggle);
72235     }
72236     return mapInMap;
72237   }
72238   var init_map_in_map = __esm({
72239     "modules/ui/map_in_map.js"() {
72240       "use strict";
72241       init_src2();
72242       init_src5();
72243       init_src12();
72244       init_localizer();
72245       init_geo2();
72246       init_renderer();
72247       init_svg();
72248       init_util();
72249     }
72250   });
72251
72252   // modules/ui/notice.js
72253   var notice_exports = {};
72254   __export(notice_exports, {
72255     uiNotice: () => uiNotice
72256   });
72257   function uiNotice(context) {
72258     return function(selection2) {
72259       var div = selection2.append("div").attr("class", "notice");
72260       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
72261         context.map().zoomEase(context.minEditableZoom());
72262       }).on("wheel", function(d3_event) {
72263         var e22 = new WheelEvent(d3_event.type, d3_event);
72264         context.surface().node().dispatchEvent(e22);
72265       });
72266       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
72267       function disableTooHigh() {
72268         var canEdit = context.map().zoom() >= context.minEditableZoom();
72269         div.style("display", canEdit ? "none" : "block");
72270       }
72271       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
72272       disableTooHigh();
72273     };
72274   }
72275   var init_notice = __esm({
72276     "modules/ui/notice.js"() {
72277       "use strict";
72278       init_debounce();
72279       init_localizer();
72280       init_svg();
72281     }
72282   });
72283
72284   // modules/ui/photoviewer.js
72285   var photoviewer_exports = {};
72286   __export(photoviewer_exports, {
72287     uiPhotoviewer: () => uiPhotoviewer
72288   });
72289   function uiPhotoviewer(context) {
72290     var dispatch14 = dispatch_default("resize");
72291     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72292     const addPhotoIdButton = /* @__PURE__ */ new Set(["mapillary", "panoramax"]);
72293     function photoviewer(selection2) {
72294       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
72295         for (const service of Object.values(services)) {
72296           if (typeof service.hideViewer === "function") {
72297             service.hideViewer(context);
72298           }
72299         }
72300       }).append("div").call(svgIcon("#iD-icon-close"));
72301       function preventDefault(d3_event) {
72302         d3_event.preventDefault();
72303       }
72304       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
72305         _pointerPrefix + "down",
72306         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
72307       );
72308       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
72309         _pointerPrefix + "down",
72310         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
72311       );
72312       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
72313         _pointerPrefix + "down",
72314         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
72315       );
72316       context.features().on("change.setPhotoFromViewer", function() {
72317         setPhotoTagButton();
72318       });
72319       context.history().on("change.setPhotoFromViewer", function() {
72320         setPhotoTagButton();
72321       });
72322       function setPhotoTagButton() {
72323         const service = getServiceId();
72324         const isActiveForService = addPhotoIdButton.has(service) && services[service].isViewerOpen() && layerEnabled(service) && context.mode().id === "select";
72325         renderAddPhotoIdButton(service, isActiveForService);
72326         function layerEnabled(which) {
72327           const layers = context.layers();
72328           const layer = layers.layer(which);
72329           return layer.enabled();
72330         }
72331         function getServiceId() {
72332           for (const serviceId in services) {
72333             const service2 = services[serviceId];
72334             if (typeof service2.isViewerOpen === "function") {
72335               if (service2.isViewerOpen()) {
72336                 return serviceId;
72337               }
72338             }
72339           }
72340           return false;
72341         }
72342         function renderAddPhotoIdButton(service2, shouldDisplay) {
72343           const button = selection2.selectAll(".set-photo-from-viewer").data(shouldDisplay ? [0] : []);
72344           button.exit().remove();
72345           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#fas-eye-dropper")).call(
72346             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72347           );
72348           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px").merge(button).on("click", function(e3) {
72349             e3.preventDefault();
72350             e3.stopPropagation();
72351             const activeServiceId = getServiceId();
72352             const image = services[activeServiceId].getActiveImage();
72353             const action = (graph2) => context.selectedIDs().reduce((graph3, entityID) => {
72354               const tags = graph3.entity(entityID).tags;
72355               const action2 = actionChangeTags(entityID, { ...tags, [activeServiceId]: image.id });
72356               return action2(graph3);
72357             }, graph2);
72358             const annotation = _t("operations.change_tags.annotation");
72359             context.perform(action, annotation);
72360             buttonDisable("already_set");
72361           });
72362           if (service2 === "panoramax") {
72363             const panoramaxControls = selection2.select(".panoramax-wrapper .pnlm-zoom-controls.pnlm-controls");
72364             panoramaxControls.style("margin-top", shouldDisplay ? "36px" : "6px");
72365           }
72366           if (!shouldDisplay) return;
72367           const activeImage = services[service2].getActiveImage();
72368           const graph = context.graph();
72369           const entities = context.selectedIDs().map((id2) => graph.hasEntity(id2)).filter(Boolean);
72370           if (entities.map((entity) => entity.tags[service2]).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
72371             buttonDisable("already_set");
72372           } else if (activeImage && entities.map((entity) => entity.extent(context.graph()).center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
72373             buttonDisable("too_far");
72374           } else {
72375             buttonDisable(false);
72376           }
72377         }
72378         function buttonDisable(reason) {
72379           const disabled = reason !== false;
72380           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
72381           button.attr("disabled", disabled ? "true" : null);
72382           button.classed("disabled", disabled);
72383           button.call(uiTooltip().destroyAny);
72384           if (disabled) {
72385             button.call(
72386               uiTooltip().title(() => _t.append(`inspector.set_photo_from_viewer.disable.${reason}`)).placement("right")
72387             );
72388           } else {
72389             button.call(
72390               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
72391             );
72392           }
72393           button.select(".tooltip").classed("dark", true).style("width", "300px");
72394         }
72395       }
72396       function buildResizeListener(target, eventName, dispatch15, options) {
72397         var resizeOnX = !!options.resizeOnX;
72398         var resizeOnY = !!options.resizeOnY;
72399         var minHeight = options.minHeight || 240;
72400         var minWidth = options.minWidth || 320;
72401         var pointerId;
72402         var startX;
72403         var startY;
72404         var startWidth;
72405         var startHeight;
72406         function startResize(d3_event) {
72407           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72408           d3_event.preventDefault();
72409           d3_event.stopPropagation();
72410           var mapSize = context.map().dimensions();
72411           if (resizeOnX) {
72412             var mapWidth = mapSize[0];
72413             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-left"), 10);
72414             var newWidth = clamp_default(startWidth + d3_event.clientX - startX, minWidth, mapWidth - viewerMargin * 2);
72415             target.style("width", newWidth + "px");
72416           }
72417           if (resizeOnY) {
72418             const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72419             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72420             var maxHeight = mapSize[1] - menuHeight - viewerMargin * 2;
72421             var newHeight = clamp_default(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
72422             target.style("height", newHeight + "px");
72423           }
72424           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
72425         }
72426         function stopResize(d3_event) {
72427           if (pointerId !== (d3_event.pointerId || "mouse")) return;
72428           d3_event.preventDefault();
72429           d3_event.stopPropagation();
72430           select_default2(window).on("." + eventName, null);
72431         }
72432         return function initResize(d3_event) {
72433           d3_event.preventDefault();
72434           d3_event.stopPropagation();
72435           pointerId = d3_event.pointerId || "mouse";
72436           startX = d3_event.clientX;
72437           startY = d3_event.clientY;
72438           var targetRect = target.node().getBoundingClientRect();
72439           startWidth = targetRect.width;
72440           startHeight = targetRect.height;
72441           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
72442           if (_pointerPrefix === "pointer") {
72443             select_default2(window).on("pointercancel." + eventName, stopResize, false);
72444           }
72445         };
72446       }
72447     }
72448     photoviewer.onMapResize = function() {
72449       var photoviewer2 = context.container().select(".photoviewer");
72450       var content = context.container().select(".main-content");
72451       var mapDimensions = utilGetDimensions(content, true);
72452       const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
72453       const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
72454       var photoDimensions = utilGetDimensions(photoviewer2, true);
72455       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - menuHeight - viewerMargin * 2) {
72456         var setPhotoDimensions = [
72457           Math.min(photoDimensions[0], mapDimensions[0]),
72458           Math.min(photoDimensions[1], mapDimensions[1] - menuHeight - viewerMargin * 2)
72459         ];
72460         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
72461         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
72462       }
72463     };
72464     function subtractPadding(dimensions, selection2) {
72465       return [
72466         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
72467         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
72468       ];
72469     }
72470     return utilRebind(photoviewer, dispatch14, "on");
72471   }
72472   var init_photoviewer = __esm({
72473     "modules/ui/photoviewer.js"() {
72474       "use strict";
72475       init_src5();
72476       init_lodash();
72477       init_localizer();
72478       init_src4();
72479       init_icon();
72480       init_dimensions();
72481       init_util();
72482       init_services();
72483       init_tooltip();
72484       init_actions();
72485       init_geo2();
72486     }
72487   });
72488
72489   // modules/ui/restore.js
72490   var restore_exports = {};
72491   __export(restore_exports, {
72492     uiRestore: () => uiRestore
72493   });
72494   function uiRestore(context) {
72495     return function(selection2) {
72496       if (!context.history().hasRestorableChanges()) return;
72497       let modalSelection = uiModal(selection2, true);
72498       modalSelection.select(".modal").attr("class", "modal fillL");
72499       let introModal = modalSelection.select(".content");
72500       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
72501       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
72502       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
72503       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
72504         context.history().restore();
72505         modalSelection.remove();
72506       });
72507       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
72508       restore.append("div").call(_t.append("restore.restore"));
72509       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
72510         context.history().clearSaved();
72511         modalSelection.remove();
72512       });
72513       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
72514       reset.append("div").call(_t.append("restore.reset"));
72515       restore.node().focus();
72516     };
72517   }
72518   var init_restore = __esm({
72519     "modules/ui/restore.js"() {
72520       "use strict";
72521       init_localizer();
72522       init_modal();
72523     }
72524   });
72525
72526   // modules/ui/scale.js
72527   var scale_exports2 = {};
72528   __export(scale_exports2, {
72529     uiScale: () => uiScale
72530   });
72531   function uiScale(context) {
72532     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
72533     function scaleDefs(loc1, loc2) {
72534       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, i3, val, dLon;
72535       if (isImperial) {
72536         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
72537       } else {
72538         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
72539       }
72540       for (i3 = 0; i3 < buckets.length; i3++) {
72541         val = buckets[i3];
72542         if (dist >= val) {
72543           scale.dist = Math.floor(dist / val) * val;
72544           break;
72545         } else {
72546           scale.dist = +dist.toFixed(2);
72547         }
72548       }
72549       dLon = geoMetersToLon(scale.dist / conversion, lat);
72550       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
72551       scale.text = displayLength(scale.dist / conversion, isImperial);
72552       return scale;
72553     }
72554     function update(selection2) {
72555       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
72556       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
72557       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
72558     }
72559     return function(selection2) {
72560       function switchUnits() {
72561         isImperial = !isImperial;
72562         selection2.call(update);
72563       }
72564       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
72565       scalegroup.append("path").attr("class", "scale-path");
72566       selection2.append("div").attr("class", "scale-text");
72567       selection2.call(update);
72568       context.map().on("move.scale", function() {
72569         update(selection2);
72570       });
72571     };
72572   }
72573   var init_scale2 = __esm({
72574     "modules/ui/scale.js"() {
72575       "use strict";
72576       init_units();
72577       init_geo2();
72578       init_localizer();
72579     }
72580   });
72581
72582   // modules/ui/shortcuts.js
72583   var shortcuts_exports = {};
72584   __export(shortcuts_exports, {
72585     uiShortcuts: () => uiShortcuts
72586   });
72587   function uiShortcuts(context) {
72588     var detected = utilDetect();
72589     var _activeTab = 0;
72590     var _modalSelection;
72591     var _selection = select_default2(null);
72592     var _dataShortcuts;
72593     function shortcutsModal(_modalSelection2) {
72594       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
72595       var content = _modalSelection2.select(".content");
72596       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
72597       _mainFileFetcher.get("shortcuts").then(function(data) {
72598         _dataShortcuts = data;
72599         content.call(render);
72600       }).catch(function() {
72601       });
72602     }
72603     function render(selection2) {
72604       if (!_dataShortcuts) return;
72605       var wrapper = selection2.selectAll(".wrapper").data([0]);
72606       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
72607       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
72608       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
72609       wrapper = wrapper.merge(wrapperEnter);
72610       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
72611       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
72612         d3_event.preventDefault();
72613         var i3 = _dataShortcuts.indexOf(d2);
72614         _activeTab = i3;
72615         render(selection2);
72616       });
72617       tabsEnter.append("span").html(function(d2) {
72618         return _t.html(d2.text);
72619       });
72620       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
72621         return i3 === _activeTab;
72622       });
72623       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
72624       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
72625         return "shortcut-tab shortcut-tab-" + d2.tab;
72626       });
72627       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
72628         return d2.columns;
72629       }).enter().append("table").attr("class", "shortcut-column");
72630       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
72631         return d2.rows;
72632       }).enter().append("tr").attr("class", "shortcut-row");
72633       var sectionRows = rowsEnter.filter(function(d2) {
72634         return !d2.shortcuts;
72635       });
72636       sectionRows.append("td");
72637       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
72638         return _t.html(d2.text);
72639       });
72640       var shortcutRows = rowsEnter.filter(function(d2) {
72641         return d2.shortcuts;
72642       });
72643       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
72644       var modifierKeys = shortcutKeys.filter(function(d2) {
72645         return d2.modifiers;
72646       });
72647       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
72648         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72649           return ["\u2318"];
72650         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72651           return [];
72652         } else {
72653           return d2.modifiers;
72654         }
72655       }).enter().each(function() {
72656         var selection3 = select_default2(this);
72657         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
72658           return uiCmd.display(d2);
72659         });
72660         selection3.append("span").text("+");
72661       });
72662       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
72663         var arr = d2.shortcuts;
72664         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
72665           arr = ["Y"];
72666         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
72667           arr = ["F11"];
72668         }
72669         arr = arr.map(function(s2) {
72670           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
72671         });
72672         return utilArrayUniq(arr).map(function(s2) {
72673           return {
72674             shortcut: s2,
72675             separator: d2.separator,
72676             suffix: d2.suffix
72677           };
72678         });
72679       }).enter().each(function(d2, i3, nodes) {
72680         var selection3 = select_default2(this);
72681         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
72682         if (click && click[1]) {
72683           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
72684         } else if (d2.shortcut.toLowerCase() === "long-press") {
72685           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
72686         } else if (d2.shortcut.toLowerCase() === "tap") {
72687           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
72688         } else {
72689           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
72690             return d4.shortcut;
72691           });
72692         }
72693         if (i3 < nodes.length - 1) {
72694           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
72695         } else if (i3 === nodes.length - 1 && d2.suffix) {
72696           selection3.append("span").text(d2.suffix);
72697         }
72698       });
72699       shortcutKeys.filter(function(d2) {
72700         return d2.gesture;
72701       }).each(function() {
72702         var selection3 = select_default2(this);
72703         selection3.append("span").text("+");
72704         selection3.append("span").attr("class", "gesture").html(function(d2) {
72705           return _t.html(d2.gesture);
72706         });
72707       });
72708       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
72709         return d2.text ? _t.html(d2.text) : "\xA0";
72710       });
72711       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
72712         return i3 === _activeTab ? "flex" : "none";
72713       });
72714     }
72715     return function(selection2, show) {
72716       _selection = selection2;
72717       if (show) {
72718         _modalSelection = uiModal(selection2);
72719         _modalSelection.call(shortcutsModal);
72720       } else {
72721         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
72722           if (context.container().selectAll(".modal-shortcuts").size()) {
72723             if (_modalSelection) {
72724               _modalSelection.close();
72725               _modalSelection = null;
72726             }
72727           } else {
72728             _modalSelection = uiModal(_selection);
72729             _modalSelection.call(shortcutsModal);
72730           }
72731         });
72732       }
72733     };
72734   }
72735   var init_shortcuts = __esm({
72736     "modules/ui/shortcuts.js"() {
72737       "use strict";
72738       init_src5();
72739       init_file_fetcher();
72740       init_localizer();
72741       init_icon();
72742       init_cmd();
72743       init_modal();
72744       init_util();
72745       init_detect();
72746     }
72747   });
72748
72749   // node_modules/@mapbox/sexagesimal/index.js
72750   var require_sexagesimal = __commonJS({
72751     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
72752       module2.exports = element;
72753       module2.exports.pair = pair3;
72754       module2.exports.format = format2;
72755       module2.exports.formatPair = formatPair;
72756       module2.exports.coordToDMS = coordToDMS;
72757       function element(input, dims) {
72758         var result = search(input, dims);
72759         return result === null ? null : result.val;
72760       }
72761       function formatPair(input) {
72762         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
72763       }
72764       function format2(input, dim) {
72765         var dms = coordToDMS(input, dim);
72766         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
72767       }
72768       function coordToDMS(input, dim) {
72769         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
72770         var dir = dirs[input >= 0 ? 0 : 1];
72771         var abs3 = Math.abs(input);
72772         var whole = Math.floor(abs3);
72773         var fraction = abs3 - whole;
72774         var fractionMinutes = fraction * 60;
72775         var minutes = Math.floor(fractionMinutes);
72776         var seconds = Math.floor((fractionMinutes - minutes) * 60);
72777         return {
72778           whole,
72779           minutes,
72780           seconds,
72781           dir
72782         };
72783       }
72784       function search(input, dims) {
72785         if (!dims) dims = "NSEW";
72786         if (typeof input !== "string") return null;
72787         input = input.toUpperCase();
72788         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
72789         var m3 = input.match(regex);
72790         if (!m3) return null;
72791         var matched = m3[0];
72792         var dim;
72793         if (m3[1] && m3[5]) {
72794           dim = m3[1];
72795           matched = matched.slice(0, -1);
72796         } else {
72797           dim = m3[1] || m3[5];
72798         }
72799         if (dim && dims.indexOf(dim) === -1) return null;
72800         var deg = m3[2] ? parseFloat(m3[2]) : 0;
72801         var min3 = m3[3] ? parseFloat(m3[3]) / 60 : 0;
72802         var sec = m3[4] ? parseFloat(m3[4]) / 3600 : 0;
72803         var sign2 = deg < 0 ? -1 : 1;
72804         if (dim === "S" || dim === "W") sign2 *= -1;
72805         return {
72806           val: (Math.abs(deg) + min3 + sec) * sign2,
72807           dim,
72808           matched,
72809           remain: input.slice(matched.length)
72810         };
72811       }
72812       function pair3(input, dims) {
72813         input = input.trim();
72814         var one2 = search(input, dims);
72815         if (!one2) return null;
72816         input = one2.remain.trim();
72817         var two = search(input, dims);
72818         if (!two || two.remain) return null;
72819         if (one2.dim) {
72820           return swapdim(one2.val, two.val, one2.dim);
72821         } else {
72822           return [one2.val, two.val];
72823         }
72824       }
72825       function swapdim(a4, b3, dim) {
72826         if (dim === "N" || dim === "S") return [a4, b3];
72827         if (dim === "W" || dim === "E") return [b3, a4];
72828       }
72829     }
72830   });
72831
72832   // modules/ui/feature_list.js
72833   var feature_list_exports = {};
72834   __export(feature_list_exports, {
72835     uiFeatureList: () => uiFeatureList
72836   });
72837   function uiFeatureList(context) {
72838     var _geocodeResults;
72839     function featureList(selection2) {
72840       var header = selection2.append("div").attr("class", "header fillL");
72841       header.append("h2").call(_t.append("inspector.feature_list"));
72842       var searchWrap = selection2.append("div").attr("class", "search-header");
72843       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
72844       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
72845       var listWrap = selection2.append("div").attr("class", "inspector-body");
72846       var list = listWrap.append("div").attr("class", "feature-list");
72847       context.on("exit.feature-list", clearSearch);
72848       context.map().on("drawn.feature-list", mapDrawn);
72849       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
72850       function focusSearch(d3_event) {
72851         var mode = context.mode() && context.mode().id;
72852         if (mode !== "browse") return;
72853         d3_event.preventDefault();
72854         search.node().focus();
72855       }
72856       function keydown(d3_event) {
72857         if (d3_event.keyCode === 27) {
72858           search.node().blur();
72859         }
72860       }
72861       function keypress(d3_event) {
72862         var q3 = search.property("value"), items = list.selectAll(".feature-list-item");
72863         if (d3_event.keyCode === 13 && // ↩ Return
72864         q3.length && items.size()) {
72865           click(d3_event, items.datum());
72866         }
72867       }
72868       function inputevent() {
72869         _geocodeResults = void 0;
72870         drawList();
72871       }
72872       function clearSearch() {
72873         search.property("value", "");
72874         drawList();
72875       }
72876       function mapDrawn(e3) {
72877         if (e3.full) {
72878           drawList();
72879         }
72880       }
72881       function features() {
72882         var graph = context.graph();
72883         var visibleCenter = context.map().extent().center();
72884         var q3 = search.property("value").toLowerCase().trim();
72885         if (!q3) return [];
72886         const locationMatch = sexagesimal.pair(q3.toUpperCase()) || dmsMatcher(q3);
72887         const coordResult = [];
72888         if (locationMatch) {
72889           const latLon = [Number(locationMatch[0]), Number(locationMatch[1])];
72890           const lonLat = [latLon[1], latLon[0]];
72891           const isLatLonValid = latLon[0] >= -90 && latLon[0] <= 90 && latLon[1] >= -180 && latLon[1] <= 180;
72892           let isLonLatValid = lonLat[0] >= -90 && lonLat[0] <= 90 && lonLat[1] >= -180 && lonLat[1] <= 180;
72893           isLonLatValid && (isLonLatValid = !q3.match(/[NSEW]/i));
72894           isLonLatValid && (isLonLatValid = !locationMatch[2]);
72895           isLonLatValid && (isLonLatValid = lonLat[0] !== lonLat[1]);
72896           if (isLatLonValid) {
72897             coordResult.push({
72898               id: latLon[0] + "/" + latLon[1],
72899               geometry: "point",
72900               type: _t("inspector.location"),
72901               name: dmsCoordinatePair([latLon[1], latLon[0]]),
72902               location: latLon,
72903               zoom: locationMatch[2]
72904             });
72905           }
72906           if (isLonLatValid) {
72907             coordResult.push({
72908               id: lonLat[0] + "/" + lonLat[1],
72909               geometry: "point",
72910               type: _t("inspector.location"),
72911               name: dmsCoordinatePair([lonLat[1], lonLat[0]]),
72912               location: lonLat
72913             });
72914           }
72915         }
72916         const idMatch = !locationMatch && q3.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
72917         const idResult = [];
72918         if (idMatch) {
72919           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
72920           var elemId = idMatch[2];
72921           idResult.push({
72922             id: elemType + elemId,
72923             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
72924             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
72925             name: elemId
72926           });
72927         }
72928         var allEntities = graph.entities;
72929         const localResults = [];
72930         for (var id2 in allEntities) {
72931           var entity = allEntities[id2];
72932           if (!entity) continue;
72933           var name = utilDisplayName(entity) || "";
72934           if (name.toLowerCase().indexOf(q3) < 0) continue;
72935           var matched = _mainPresetIndex.match(entity, graph);
72936           var type2 = matched && matched.name() || utilDisplayType(entity.id);
72937           var extent = entity.extent(graph);
72938           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
72939           localResults.push({
72940             id: entity.id,
72941             entity,
72942             geometry: entity.geometry(graph),
72943             type: type2,
72944             name,
72945             distance
72946           });
72947           if (localResults.length > 100) break;
72948         }
72949         localResults.sort((a4, b3) => a4.distance - b3.distance);
72950         const geocodeResults = [];
72951         (_geocodeResults || []).forEach(function(d2) {
72952           if (d2.osm_type && d2.osm_id) {
72953             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
72954             var tags = {};
72955             tags[d2.class] = d2.type;
72956             var attrs = { id: id3, type: d2.osm_type, tags };
72957             if (d2.osm_type === "way") {
72958               attrs.nodes = ["a", "a"];
72959             }
72960             var tempEntity = osmEntity(attrs);
72961             var tempGraph = coreGraph([tempEntity]);
72962             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
72963             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
72964             geocodeResults.push({
72965               id: tempEntity.id,
72966               geometry: tempEntity.geometry(tempGraph),
72967               type: type3,
72968               name: d2.display_name,
72969               extent: new geoExtent(
72970                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
72971                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
72972               )
72973             });
72974           }
72975         });
72976         const extraResults = [];
72977         if (q3.match(/^[0-9]+$/)) {
72978           extraResults.push({
72979             id: "n" + q3,
72980             geometry: "point",
72981             type: _t("inspector.node"),
72982             name: q3
72983           });
72984           extraResults.push({
72985             id: "w" + q3,
72986             geometry: "line",
72987             type: _t("inspector.way"),
72988             name: q3
72989           });
72990           extraResults.push({
72991             id: "r" + q3,
72992             geometry: "relation",
72993             type: _t("inspector.relation"),
72994             name: q3
72995           });
72996           extraResults.push({
72997             id: "note" + q3,
72998             geometry: "note",
72999             type: _t("note.note"),
73000             name: q3
73001           });
73002         }
73003         return [...idResult, ...localResults, ...coordResult, ...geocodeResults, ...extraResults];
73004       }
73005       function drawList() {
73006         var value = search.property("value");
73007         var results = features();
73008         list.classed("filtered", value.length);
73009         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"));
73010         resultsIndicator.append("span").attr("class", "entity-name");
73011         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
73012         if (services.geocoder) {
73013           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"));
73014         }
73015         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
73016         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
73017         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
73018           return d2.id;
73019         });
73020         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("pointerenter", mouseover).on("pointerleave", mouseout).on("focus", mouseover).on("blur", mouseout).on("click", click);
73021         var label = enter.append("div").attr("class", "label");
73022         label.each(function(d2) {
73023           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
73024         });
73025         label.append("span").attr("class", "entity-type").text(function(d2) {
73026           return d2.type;
73027         });
73028         label.append("span").attr("class", "entity-name").classed("has-colour", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour && isColourValid(d2.entity.tags.colour)).style("border-color", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour).text(function(d2) {
73029           return d2.name;
73030         });
73031         enter.style("opacity", 0).transition().style("opacity", 1);
73032         items.exit().each((d2) => mouseout(void 0, d2)).remove();
73033         items.merge(enter).order();
73034       }
73035       function mouseover(d3_event, d2) {
73036         if (d2.location !== void 0) return;
73037         utilHighlightEntities([d2.id], true, context);
73038       }
73039       function mouseout(d3_event, d2) {
73040         if (d2.location !== void 0) return;
73041         utilHighlightEntities([d2.id], false, context);
73042       }
73043       function click(d3_event, d2) {
73044         d3_event.preventDefault();
73045         if (d2.location) {
73046           context.map().centerZoomEase([d2.location[1], d2.location[0]], d2.zoom || 19);
73047         } else if (d2.entity) {
73048           utilHighlightEntities([d2.id], false, context);
73049           context.enter(modeSelect(context, [d2.entity.id]));
73050           context.map().zoomToEase(d2.entity);
73051         } else if (d2.geometry === "note") {
73052           const noteId = d2.id.replace(/\D/g, "");
73053           context.moveToNote(noteId);
73054         } else {
73055           context.zoomToEntity(d2.id);
73056         }
73057       }
73058       function geocoderSearch() {
73059         services.geocoder.search(search.property("value"), function(err, resp) {
73060           _geocodeResults = resp || [];
73061           drawList();
73062         });
73063       }
73064     }
73065     return featureList;
73066   }
73067   var sexagesimal;
73068   var init_feature_list = __esm({
73069     "modules/ui/feature_list.js"() {
73070       "use strict";
73071       init_src5();
73072       sexagesimal = __toESM(require_sexagesimal());
73073       init_presets();
73074       init_localizer();
73075       init_units();
73076       init_graph();
73077       init_geo();
73078       init_geo2();
73079       init_select5();
73080       init_entity();
73081       init_tags();
73082       init_services();
73083       init_icon();
73084       init_cmd();
73085       init_util();
73086     }
73087   });
73088
73089   // modules/ui/sections/entity_issues.js
73090   var entity_issues_exports = {};
73091   __export(entity_issues_exports, {
73092     uiSectionEntityIssues: () => uiSectionEntityIssues
73093   });
73094   function uiSectionEntityIssues(context) {
73095     var preference = corePreferences("entity-issues.reference.expanded");
73096     var _expanded = preference === null ? true : preference === "true";
73097     var _entityIDs = [];
73098     var _issues = [];
73099     var _activeIssueID;
73100     var section = uiSection("entity-issues", context).shouldDisplay(function() {
73101       return _issues.length > 0;
73102     }).label(function() {
73103       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
73104     }).disclosureContent(renderDisclosureContent);
73105     context.validator().on("validated.entity_issues", function() {
73106       reloadIssues();
73107       section.reRender();
73108     }).on("focusedIssue.entity_issues", function(issue) {
73109       makeActiveIssue(issue.id);
73110     });
73111     function reloadIssues() {
73112       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
73113     }
73114     function makeActiveIssue(issueID) {
73115       _activeIssueID = issueID;
73116       section.selection().selectAll(".issue-container").classed("active", function(d2) {
73117         return d2.id === _activeIssueID;
73118       });
73119     }
73120     function renderDisclosureContent(selection2) {
73121       selection2.classed("grouped-items-area", true);
73122       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
73123       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
73124         return d2.key;
73125       });
73126       containers.exit().remove();
73127       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
73128       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
73129         return "issue severity-" + d2.severity;
73130       }).on("mouseover.highlight", function(d3_event, d2) {
73131         var ids = d2.entityIds.filter(function(e3) {
73132           return _entityIDs.indexOf(e3) === -1;
73133         });
73134         utilHighlightEntities(ids, true, context);
73135       }).on("mouseout.highlight", function(d3_event, d2) {
73136         var ids = d2.entityIds.filter(function(e3) {
73137           return _entityIDs.indexOf(e3) === -1;
73138         });
73139         utilHighlightEntities(ids, false, context);
73140       });
73141       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
73142       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
73143         makeActiveIssue(d2.id);
73144         var extent = d2.extent(context.graph());
73145         if (extent) {
73146           var setZoom = Math.max(context.map().zoom(), 19);
73147           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
73148         }
73149       });
73150       textEnter.each(function(d2) {
73151         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73152         select_default2(this).call(svgIcon(iconName, "issue-icon"));
73153       });
73154       textEnter.append("span").attr("class", "issue-message");
73155       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
73156       infoButton.on("click", function(d3_event) {
73157         d3_event.stopPropagation();
73158         d3_event.preventDefault();
73159         this.blur();
73160         var container = select_default2(this.parentNode.parentNode.parentNode);
73161         var info = container.selectAll(".issue-info");
73162         var isExpanded = info.classed("expanded");
73163         _expanded = !isExpanded;
73164         corePreferences("entity-issues.reference.expanded", _expanded);
73165         if (isExpanded) {
73166           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
73167             info.classed("expanded", false);
73168           });
73169         } else {
73170           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
73171             info.style("max-height", null);
73172           });
73173         }
73174       });
73175       itemsEnter.append("ul").attr("class", "issue-fix-list");
73176       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
73177         if (typeof d2.reference === "function") {
73178           select_default2(this).call(d2.reference);
73179         } else {
73180           select_default2(this).call(_t.append("inspector.no_documentation_key"));
73181         }
73182       });
73183       containers = containers.merge(containersEnter).classed("active", function(d2) {
73184         return d2.id === _activeIssueID;
73185       });
73186       containers.selectAll(".issue-message").text("").each(function(d2) {
73187         return d2.message(context)(select_default2(this));
73188       });
73189       var fixLists = containers.selectAll(".issue-fix-list");
73190       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
73191         return d2.fixes ? d2.fixes(context) : [];
73192       }, function(fix) {
73193         return fix.id;
73194       });
73195       fixes.exit().remove();
73196       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
73197       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
73198         if (select_default2(this).attr("disabled") || !d2.onClick) return;
73199         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
73200         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
73201         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
73202         new Promise(function(resolve, reject) {
73203           d2.onClick(context, resolve, reject);
73204           if (d2.onClick.length <= 1) {
73205             resolve();
73206           }
73207         }).then(function() {
73208           context.validator().validate();
73209         });
73210       }).on("mouseover.highlight", function(d3_event, d2) {
73211         utilHighlightEntities(d2.entityIds, true, context);
73212       }).on("mouseout.highlight", function(d3_event, d2) {
73213         utilHighlightEntities(d2.entityIds, false, context);
73214       });
73215       buttons.each(function(d2) {
73216         var iconName = d2.icon || "iD-icon-wrench";
73217         if (iconName.startsWith("maki")) {
73218           iconName += "-15";
73219         }
73220         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
73221       });
73222       buttons.append("span").attr("class", "fix-message").each(function(d2) {
73223         return d2.title(select_default2(this));
73224       });
73225       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
73226         return d2.onClick;
73227       }).attr("disabled", function(d2) {
73228         return d2.onClick ? null : "true";
73229       }).attr("title", function(d2) {
73230         if (d2.disabledReason) {
73231           return d2.disabledReason;
73232         }
73233         return null;
73234       });
73235     }
73236     section.entityIDs = function(val) {
73237       if (!arguments.length) return _entityIDs;
73238       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
73239         _entityIDs = val;
73240         _activeIssueID = null;
73241         reloadIssues();
73242       }
73243       return section;
73244     };
73245     return section;
73246   }
73247   var init_entity_issues = __esm({
73248     "modules/ui/sections/entity_issues.js"() {
73249       "use strict";
73250       init_src5();
73251       init_preferences();
73252       init_icon();
73253       init_array3();
73254       init_localizer();
73255       init_util();
73256       init_section();
73257     }
73258   });
73259
73260   // modules/ui/preset_icon.js
73261   var preset_icon_exports = {};
73262   __export(preset_icon_exports, {
73263     uiPresetIcon: () => uiPresetIcon
73264   });
73265   function uiPresetIcon() {
73266     let _preset;
73267     let _geometry;
73268     function presetIcon(selection2) {
73269       selection2.each(render);
73270     }
73271     function getIcon(p2, geom) {
73272       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
73273       if (p2.icon) return p2.icon;
73274       if (geom === "line") return "iD-other-line";
73275       if (geom === "vertex") return "temaki-vertex";
73276       return "maki-marker-stroked";
73277     }
73278     function renderPointBorder(container, drawPoint) {
73279       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
73280       pointBorder.exit().remove();
73281       let pointBorderEnter = pointBorder.enter();
73282       const w3 = 40;
73283       const h3 = 40;
73284       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`).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");
73285       pointBorder = pointBorderEnter.merge(pointBorder);
73286     }
73287     function renderCategoryBorder(container, category) {
73288       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
73289       categoryBorder.exit().remove();
73290       let categoryBorderEnter = categoryBorder.enter();
73291       const d2 = 60;
73292       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d2).attr("height", d2).attr("viewBox", `0 0 ${d2} ${d2}`);
73293       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");
73294       categoryBorder = categoryBorderEnter.merge(categoryBorder);
73295       if (category) {
73296         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
73297       }
73298     }
73299     function renderCircleFill(container, drawVertex) {
73300       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
73301       vertexFill.exit().remove();
73302       let vertexFillEnter = vertexFill.enter();
73303       const w3 = 60;
73304       const h3 = 60;
73305       const d2 = 40;
73306       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`).append("circle").attr("cx", w3 / 2).attr("cy", h3 / 2).attr("r", d2 / 2);
73307       vertexFill = vertexFillEnter.merge(vertexFill);
73308     }
73309     function renderSquareFill(container, drawArea, tagClasses) {
73310       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
73311       fill.exit().remove();
73312       let fillEnter = fill.enter();
73313       const d2 = 60;
73314       const w3 = d2;
73315       const h3 = d2;
73316       const l2 = d2 * 2 / 3;
73317       const c1 = (w3 - l2) / 2;
73318       const c2 = c1 + l2;
73319       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73320       ["fill", "stroke"].forEach((klass) => {
73321         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
73322       });
73323       const rVertex = 2.5;
73324       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
73325         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
73326       });
73327       const rMidpoint = 1.25;
73328       [[c1, w3 / 2], [c2, w3 / 2], [h3 / 2, c1], [h3 / 2, c2]].forEach((point) => {
73329         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
73330       });
73331       fill = fillEnter.merge(fill);
73332       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
73333       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
73334     }
73335     function renderLine(container, drawLine, tagClasses) {
73336       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
73337       line.exit().remove();
73338       let lineEnter = line.enter();
73339       const d2 = 60;
73340       const w3 = d2;
73341       const h3 = d2;
73342       const y2 = Math.round(d2 * 0.72);
73343       const l2 = Math.round(d2 * 0.6);
73344       const r2 = 2.5;
73345       const x12 = (w3 - l2) / 2;
73346       const x2 = x12 + l2;
73347       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73348       ["casing", "stroke"].forEach((klass) => {
73349         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
73350       });
73351       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
73352         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73353       });
73354       line = lineEnter.merge(line);
73355       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
73356       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
73357     }
73358     function renderRoute(container, drawRoute, p2) {
73359       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
73360       route.exit().remove();
73361       let routeEnter = route.enter();
73362       const d2 = 60;
73363       const w3 = d2;
73364       const h3 = d2;
73365       const y12 = Math.round(d2 * 0.8);
73366       const y2 = Math.round(d2 * 0.68);
73367       const l2 = Math.round(d2 * 0.6);
73368       const r2 = 2;
73369       const x12 = (w3 - l2) / 2;
73370       const x2 = x12 + l2 / 3;
73371       const x3 = x2 + l2 / 3;
73372       const x4 = x3 + l2 / 3;
73373       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w3).attr("height", h3).attr("viewBox", `0 0 ${w3} ${h3}`);
73374       ["casing", "stroke"].forEach((klass) => {
73375         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
73376         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
73377         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
73378       });
73379       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
73380         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
73381       });
73382       route = routeEnter.merge(route);
73383       if (drawRoute) {
73384         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
73385         const segmentPresetIDs = routeSegments[routeType];
73386         for (let i3 in segmentPresetIDs) {
73387           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
73388           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
73389           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
73390           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
73391         }
73392       }
73393     }
73394     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
73395       const isMaki = picon && /^maki-/.test(picon);
73396       const isTemaki = picon && /^temaki-/.test(picon);
73397       const isFa = picon && /^fa[srb]-/.test(picon);
73398       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
73399       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
73400       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
73401       icon2.exit().remove();
73402       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
73403       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
73404       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
73405       icon2.selectAll("use").attr("href", "#" + picon);
73406     }
73407     function renderImageIcon(container, imageURL) {
73408       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
73409       imageIcon.exit().remove();
73410       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);
73411       imageIcon.attr("src", imageURL);
73412     }
73413     const routeSegments = {
73414       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
73415       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73416       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
73417       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
73418       ferry: ["route/ferry", "route/ferry", "route/ferry"],
73419       foot: ["highway/footway", "highway/footway", "highway/footway"],
73420       hiking: ["highway/path", "highway/path", "highway/path"],
73421       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
73422       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
73423       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
73424       mtb: ["highway/path", "highway/track", "highway/bridleway"],
73425       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
73426       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
73427       power: ["power/line", "power/line", "power/line"],
73428       road: ["highway/secondary", "highway/primary", "highway/trunk"],
73429       subway: ["railway/subway", "railway/subway", "railway/subway"],
73430       train: ["railway/rail", "railway/rail", "railway/rail"],
73431       tram: ["railway/tram", "railway/tram", "railway/tram"],
73432       railway: ["railway/rail", "railway/rail", "railway/rail"],
73433       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
73434     };
73435     function render() {
73436       let p2 = _preset.apply(this, arguments);
73437       let geom = _geometry ? _geometry.apply(this, arguments) : null;
73438       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
73439         geom = "route";
73440       }
73441       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
73442       const isFallback = p2.isFallback && p2.isFallback();
73443       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
73444       const picon = getIcon(p2, geom);
73445       const isCategory = !p2.setTags;
73446       const drawPoint = false;
73447       const drawVertex = picon !== null && geom === "vertex";
73448       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
73449       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
73450       const drawRoute = picon && geom === "route";
73451       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
73452       let tags = !isCategory ? p2.setTags({}, geom) : {};
73453       for (let k3 in tags) {
73454         if (tags[k3] === "*") {
73455           tags[k3] = "yes";
73456         }
73457       }
73458       let tagClasses = svgTagClasses().getClassesString(tags, "");
73459       let selection2 = select_default2(this);
73460       let container = selection2.selectAll(".preset-icon-container").data([0]);
73461       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
73462       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
73463       renderCategoryBorder(container, isCategory && p2);
73464       renderPointBorder(container, drawPoint);
73465       renderCircleFill(container, drawVertex);
73466       renderSquareFill(container, drawArea, tagClasses);
73467       renderLine(container, drawLine, tagClasses);
73468       renderRoute(container, drawRoute, p2);
73469       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
73470       renderImageIcon(container, imageURL);
73471     }
73472     presetIcon.preset = function(val) {
73473       if (!arguments.length) return _preset;
73474       _preset = utilFunctor(val);
73475       return presetIcon;
73476     };
73477     presetIcon.geometry = function(val) {
73478       if (!arguments.length) return _geometry;
73479       _geometry = utilFunctor(val);
73480       return presetIcon;
73481     };
73482     return presetIcon;
73483   }
73484   var init_preset_icon = __esm({
73485     "modules/ui/preset_icon.js"() {
73486       "use strict";
73487       init_src5();
73488       init_presets();
73489       init_preferences();
73490       init_svg();
73491       init_util();
73492     }
73493   });
73494
73495   // modules/ui/sections/feature_type.js
73496   var feature_type_exports = {};
73497   __export(feature_type_exports, {
73498     uiSectionFeatureType: () => uiSectionFeatureType
73499   });
73500   function uiSectionFeatureType(context) {
73501     var dispatch14 = dispatch_default("choose");
73502     var _entityIDs = [];
73503     var _presets = [];
73504     var _tagReference;
73505     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
73506     function renderDisclosureContent(selection2) {
73507       selection2.classed("preset-list-item", true);
73508       selection2.classed("mixed-types", _presets.length > 1);
73509       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
73510       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
73511         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
73512       );
73513       presetButton.append("div").attr("class", "preset-icon-container");
73514       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
73515       presetButtonWrap.append("div").attr("class", "accessory-buttons");
73516       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
73517       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
73518       if (_tagReference) {
73519         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
73520         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
73521       }
73522       selection2.selectAll(".preset-reset").on("click", function() {
73523         dispatch14.call("choose", this, _presets);
73524       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
73525         d3_event.preventDefault();
73526         d3_event.stopPropagation();
73527       });
73528       var geometries = entityGeometries();
73529       selection2.select(".preset-list-item button").call(
73530         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
73531       );
73532       var names = _presets.length === 1 ? [
73533         _presets[0].nameLabel(),
73534         _presets[0].subtitleLabel()
73535       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
73536       var label = selection2.select(".label-inner");
73537       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
73538       nameparts.exit().remove();
73539       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
73540         d2(select_default2(this));
73541       });
73542     }
73543     section.entityIDs = function(val) {
73544       if (!arguments.length) return _entityIDs;
73545       _entityIDs = val;
73546       return section;
73547     };
73548     section.presets = function(val) {
73549       if (!arguments.length) return _presets;
73550       if (!utilArrayIdentical(val, _presets)) {
73551         _presets = val;
73552         if (_presets.length === 1) {
73553           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
73554         }
73555       }
73556       return section;
73557     };
73558     function entityGeometries() {
73559       var counts = {};
73560       for (var i3 in _entityIDs) {
73561         var geometry = context.graph().geometry(_entityIDs[i3]);
73562         if (!counts[geometry]) counts[geometry] = 0;
73563         counts[geometry] += 1;
73564       }
73565       return Object.keys(counts).sort(function(geom1, geom2) {
73566         return counts[geom2] - counts[geom1];
73567       });
73568     }
73569     return utilRebind(section, dispatch14, "on");
73570   }
73571   var init_feature_type = __esm({
73572     "modules/ui/sections/feature_type.js"() {
73573       "use strict";
73574       init_src4();
73575       init_src5();
73576       init_presets();
73577       init_array3();
73578       init_localizer();
73579       init_tooltip();
73580       init_util();
73581       init_preset_icon();
73582       init_section();
73583       init_tag_reference();
73584     }
73585   });
73586
73587   // modules/ui/form_fields.js
73588   var form_fields_exports = {};
73589   __export(form_fields_exports, {
73590     uiFormFields: () => uiFormFields
73591   });
73592   function uiFormFields(context) {
73593     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
73594     var _fieldsArr = [];
73595     var _lastPlaceholder = "";
73596     var _state = "";
73597     var _klass = "";
73598     function formFields(selection2) {
73599       var allowedFields = _fieldsArr.filter(function(field) {
73600         return field.isAllowed();
73601       });
73602       var shown = allowedFields.filter(function(field) {
73603         return field.isShown();
73604       });
73605       var notShown = allowedFields.filter(function(field) {
73606         return !field.isShown();
73607       }).sort(function(a4, b3) {
73608         return a4.universal === b3.universal ? 0 : a4.universal ? 1 : -1;
73609       });
73610       var container = selection2.selectAll(".form-fields-container").data([0]);
73611       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
73612       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
73613         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
73614       });
73615       fields.exit().remove();
73616       var enter = fields.enter().append("div").attr("class", function(d2) {
73617         return "wrap-form-field wrap-form-field-" + d2.safeid;
73618       });
73619       fields = fields.merge(enter);
73620       fields.order().each(function(d2) {
73621         select_default2(this).call(d2.render);
73622       });
73623       var titles = [];
73624       var moreFields = notShown.map(function(field) {
73625         var title = field.title();
73626         titles.push(title);
73627         var terms = field.terms();
73628         if (field.key) terms.push(field.key);
73629         if (field.keys) terms = terms.concat(field.keys);
73630         return {
73631           display: field.label(),
73632           value: title,
73633           title,
73634           field,
73635           terms
73636         };
73637       });
73638       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
73639       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
73640       more.exit().remove();
73641       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
73642       moreEnter.append("span").call(_t.append("inspector.add_fields"));
73643       more = moreEnter.merge(more);
73644       var input = more.selectAll(".value").data([0]);
73645       input.exit().remove();
73646       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
73647       input.call(utilGetSetValue, "").call(
73648         moreCombo.data(moreFields).on("accept", function(d2) {
73649           if (!d2) return;
73650           var field = d2.field;
73651           field.show();
73652           selection2.call(formFields);
73653           field.focus();
73654         })
73655       );
73656       if (_lastPlaceholder !== placeholder) {
73657         input.attr("placeholder", placeholder);
73658         _lastPlaceholder = placeholder;
73659       }
73660     }
73661     formFields.fieldsArr = function(val) {
73662       if (!arguments.length) return _fieldsArr;
73663       _fieldsArr = val || [];
73664       return formFields;
73665     };
73666     formFields.state = function(val) {
73667       if (!arguments.length) return _state;
73668       _state = val;
73669       return formFields;
73670     };
73671     formFields.klass = function(val) {
73672       if (!arguments.length) return _klass;
73673       _klass = val;
73674       return formFields;
73675     };
73676     return formFields;
73677   }
73678   var init_form_fields = __esm({
73679     "modules/ui/form_fields.js"() {
73680       "use strict";
73681       init_src5();
73682       init_localizer();
73683       init_combobox();
73684       init_util();
73685     }
73686   });
73687
73688   // modules/ui/sections/preset_fields.js
73689   var preset_fields_exports = {};
73690   __export(preset_fields_exports, {
73691     uiSectionPresetFields: () => uiSectionPresetFields
73692   });
73693   function uiSectionPresetFields(context) {
73694     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
73695     var dispatch14 = dispatch_default("change", "revert");
73696     var formFields = uiFormFields(context);
73697     var _state;
73698     var _fieldsArr;
73699     var _presets = [];
73700     var _tags;
73701     var _entityIDs;
73702     function renderDisclosureContent(selection2) {
73703       if (!_fieldsArr) {
73704         var graph = context.graph();
73705         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
73706           geoms[graph.entity(entityID).geometry(graph)] = true;
73707           return geoms;
73708         }, {}));
73709         const loc = _entityIDs.reduce(function(extent, entityID) {
73710           var entity = context.graph().entity(entityID);
73711           return extent.extend(entity.extent(context.graph()));
73712         }, geoExtent()).center();
73713         var presetsManager = _mainPresetIndex;
73714         var allFields = [];
73715         var allMoreFields = [];
73716         var sharedTotalFields;
73717         _presets.forEach(function(preset) {
73718           var fields = preset.fields(loc);
73719           var moreFields = preset.moreFields(loc);
73720           allFields = utilArrayUnion(allFields, fields);
73721           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
73722           if (!sharedTotalFields) {
73723             sharedTotalFields = utilArrayUnion(fields, moreFields);
73724           } else {
73725             sharedTotalFields = sharedTotalFields.filter(function(field) {
73726               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
73727             });
73728           }
73729         });
73730         var sharedFields = allFields.filter(function(field) {
73731           return sharedTotalFields.indexOf(field) !== -1;
73732         });
73733         var sharedMoreFields = allMoreFields.filter(function(field) {
73734           return sharedTotalFields.indexOf(field) !== -1;
73735         });
73736         _fieldsArr = [];
73737         sharedFields.forEach(function(field) {
73738           if (field.matchAllGeometry(geometries)) {
73739             _fieldsArr.push(
73740               uiField(context, field, _entityIDs)
73741             );
73742           }
73743         });
73744         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
73745         if (singularEntity && singularEntity.type === "node" && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
73746           _fieldsArr.push(
73747             uiField(context, presetsManager.field("restrictions"), _entityIDs)
73748           );
73749         }
73750         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
73751         additionalFields.sort(function(field1, field2) {
73752           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
73753         });
73754         additionalFields.forEach(function(field) {
73755           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
73756             _fieldsArr.push(
73757               uiField(context, field, _entityIDs, { show: false })
73758             );
73759           }
73760         });
73761         _fieldsArr.forEach(function(field) {
73762           field.on("change", function(t2, onInput) {
73763             dispatch14.call("change", field, _entityIDs, t2, onInput);
73764           }).on("revert", function(keys2) {
73765             dispatch14.call("revert", field, keys2);
73766           });
73767         });
73768       }
73769       _fieldsArr.forEach(function(field) {
73770         field.state(_state).tags(_tags);
73771       });
73772       selection2.call(
73773         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
73774       );
73775     }
73776     section.presets = function(val) {
73777       if (!arguments.length) return _presets;
73778       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
73779         _presets = val;
73780         _fieldsArr = null;
73781       }
73782       return section;
73783     };
73784     section.state = function(val) {
73785       if (!arguments.length) return _state;
73786       _state = val;
73787       return section;
73788     };
73789     section.tags = function(val) {
73790       if (!arguments.length) return _tags;
73791       _tags = val;
73792       return section;
73793     };
73794     section.entityIDs = function(val) {
73795       if (!arguments.length) return _entityIDs;
73796       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
73797         _entityIDs = val;
73798         _fieldsArr = null;
73799       }
73800       return section;
73801     };
73802     return utilRebind(section, dispatch14, "on");
73803   }
73804   var init_preset_fields = __esm({
73805     "modules/ui/sections/preset_fields.js"() {
73806       "use strict";
73807       init_src4();
73808       init_presets();
73809       init_localizer();
73810       init_array3();
73811       init_util();
73812       init_extent();
73813       init_field2();
73814       init_form_fields();
73815       init_section();
73816     }
73817   });
73818
73819   // modules/ui/sections/raw_member_editor.js
73820   var raw_member_editor_exports = {};
73821   __export(raw_member_editor_exports, {
73822     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor
73823   });
73824   function uiSectionRawMemberEditor(context) {
73825     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
73826       if (!_entityIDs || _entityIDs.length !== 1) return false;
73827       var entity = context.hasEntity(_entityIDs[0]);
73828       return entity && entity.type === "relation";
73829     }).label(function() {
73830       var entity = context.hasEntity(_entityIDs[0]);
73831       if (!entity) return "";
73832       var gt2 = entity.members.length > _maxMembers ? ">" : "";
73833       var count = gt2 + entity.members.slice(0, _maxMembers).length;
73834       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
73835     }).disclosureContent(renderDisclosureContent);
73836     var taginfo = services.taginfo;
73837     var _entityIDs;
73838     var _maxMembers = 1e3;
73839     function downloadMember(d3_event, d2) {
73840       d3_event.preventDefault();
73841       select_default2(this).classed("loading", true);
73842       context.loadEntity(d2.id, function() {
73843         section.reRender();
73844       });
73845     }
73846     function zoomToMember(d3_event, d2) {
73847       d3_event.preventDefault();
73848       var entity = context.entity(d2.id);
73849       context.map().zoomToEase(entity);
73850       utilHighlightEntities([d2.id], true, context);
73851     }
73852     function selectMember(d3_event, d2) {
73853       d3_event.preventDefault();
73854       utilHighlightEntities([d2.id], false, context);
73855       var entity = context.entity(d2.id);
73856       var mapExtent = context.map().extent();
73857       if (!entity.intersects(mapExtent, context.graph())) {
73858         context.map().zoomToEase(entity);
73859       }
73860       context.enter(modeSelect(context, [d2.id]));
73861     }
73862     function changeRole(d3_event, d2) {
73863       var oldRole = d2.role;
73864       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
73865       if (oldRole !== newRole) {
73866         var member = { id: d2.id, type: d2.type, role: newRole };
73867         context.perform(
73868           actionChangeMember(d2.relation.id, member, d2.index),
73869           _t("operations.change_role.annotation", {
73870             n: 1
73871           })
73872         );
73873         context.validator().validate();
73874       }
73875     }
73876     function deleteMember(d3_event, d2) {
73877       utilHighlightEntities([d2.id], false, context);
73878       context.perform(
73879         actionDeleteMember(d2.relation.id, d2.index),
73880         _t("operations.delete_member.annotation", {
73881           n: 1
73882         })
73883       );
73884       if (!context.hasEntity(d2.relation.id)) {
73885         context.enter(modeBrowse(context));
73886       } else {
73887         context.validator().validate();
73888       }
73889     }
73890     function renderDisclosureContent(selection2) {
73891       var entityID = _entityIDs[0];
73892       var memberships = [];
73893       var entity = context.entity(entityID);
73894       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
73895         memberships.push({
73896           index,
73897           id: member.id,
73898           type: member.type,
73899           role: member.role,
73900           relation: entity,
73901           member: context.hasEntity(member.id),
73902           domId: utilUniqueDomId(entityID + "-member-" + index)
73903         });
73904       });
73905       var list = selection2.selectAll(".member-list").data([0]);
73906       list = list.enter().append("ul").attr("class", "member-list").merge(list);
73907       var items = list.selectAll("li").data(memberships, function(d2) {
73908         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
73909       });
73910       items.exit().each(unbind).remove();
73911       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
73912         return !d2.member;
73913       });
73914       itemsEnter.each(function(d2) {
73915         var item = select_default2(this);
73916         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
73917         if (d2.member) {
73918           item.on("mouseover", function() {
73919             utilHighlightEntities([d2.id], true, context);
73920           }).on("mouseout", function() {
73921             utilHighlightEntities([d2.id], false, context);
73922           });
73923           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
73924           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
73925             var matched = _mainPresetIndex.match(d4.member, context.graph());
73926             return matched && matched.name() || utilDisplayType(d4.member.id);
73927           });
73928           labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d4) => d4.member.type === "relation" && d4.member.tags.colour && isColourValid(d4.member.tags.colour)).style("border-color", (d4) => d4.member.type === "relation" && d4.member.tags.colour).text(function(d4) {
73929             return utilDisplayName(d4.member);
73930           });
73931           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
73932           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
73933         } else {
73934           var labelText = label.append("span").attr("class", "label-text");
73935           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
73936           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
73937           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
73938         }
73939       });
73940       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
73941       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
73942         return d2.domId;
73943       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
73944       if (taginfo) {
73945         wrapEnter.each(bindTypeahead);
73946       }
73947       items = items.merge(itemsEnter).order();
73948       items.select("input.member-role").property("value", function(d2) {
73949         return d2.role;
73950       }).on("blur", changeRole).on("change", changeRole);
73951       items.select("button.member-delete").on("click", deleteMember);
73952       var dragOrigin, targetIndex;
73953       items.call(
73954         drag_default().on("start", function(d3_event) {
73955           dragOrigin = {
73956             x: d3_event.x,
73957             y: d3_event.y
73958           };
73959           targetIndex = null;
73960         }).on("drag", function(d3_event) {
73961           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
73962           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
73963           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
73964           var index = items.nodes().indexOf(this);
73965           select_default2(this).classed("dragging", true);
73966           targetIndex = null;
73967           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
73968             var node = select_default2(this).node();
73969             if (index === index2) {
73970               return "translate(" + x2 + "px, " + y2 + "px)";
73971             } else if (index2 > index && d3_event.y > node.offsetTop) {
73972               if (targetIndex === null || index2 > targetIndex) {
73973                 targetIndex = index2;
73974               }
73975               return "translateY(-100%)";
73976             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
73977               if (targetIndex === null || index2 < targetIndex) {
73978                 targetIndex = index2;
73979               }
73980               return "translateY(100%)";
73981             }
73982             return null;
73983           });
73984         }).on("end", function(d3_event, d2) {
73985           if (!select_default2(this).classed("dragging")) return;
73986           var index = items.nodes().indexOf(this);
73987           select_default2(this).classed("dragging", false);
73988           selection2.selectAll("li.member-row").style("transform", null);
73989           if (targetIndex !== null) {
73990             context.perform(
73991               actionMoveMember(d2.relation.id, index, targetIndex),
73992               _t("operations.reorder_members.annotation")
73993             );
73994             context.validator().validate();
73995           }
73996         })
73997       );
73998       function bindTypeahead(d2) {
73999         var row = select_default2(this);
74000         var role = row.selectAll("input.member-role");
74001         var origValue = role.property("value");
74002         function sort(value, data) {
74003           var sameletter = [];
74004           var other = [];
74005           for (var i3 = 0; i3 < data.length; i3++) {
74006             if (data[i3].value.substring(0, value.length) === value) {
74007               sameletter.push(data[i3]);
74008             } else {
74009               other.push(data[i3]);
74010             }
74011           }
74012           return sameletter.concat(other);
74013         }
74014         role.call(
74015           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74016             var geometry;
74017             if (d2.member) {
74018               geometry = context.graph().geometry(d2.member.id);
74019             } else if (d2.type === "relation") {
74020               geometry = "relation";
74021             } else if (d2.type === "way") {
74022               geometry = "line";
74023             } else {
74024               geometry = "point";
74025             }
74026             var rtype = entity.tags.type;
74027             taginfo.roles({
74028               debounce: true,
74029               rtype: rtype || "",
74030               geometry,
74031               query: role2
74032             }, function(err, data) {
74033               if (!err) callback(sort(role2, data));
74034             });
74035           }).on("cancel", function() {
74036             role.property("value", origValue);
74037           })
74038         );
74039       }
74040       function unbind() {
74041         var row = select_default2(this);
74042         row.selectAll("input.member-role").call(uiCombobox.off, context);
74043       }
74044     }
74045     section.entityIDs = function(val) {
74046       if (!arguments.length) return _entityIDs;
74047       _entityIDs = val;
74048       return section;
74049     };
74050     return section;
74051   }
74052   var init_raw_member_editor = __esm({
74053     "modules/ui/sections/raw_member_editor.js"() {
74054       "use strict";
74055       init_src6();
74056       init_src5();
74057       init_presets();
74058       init_localizer();
74059       init_change_member();
74060       init_delete_member();
74061       init_move_member();
74062       init_browse();
74063       init_select5();
74064       init_osm();
74065       init_tags();
74066       init_icon();
74067       init_services();
74068       init_combobox();
74069       init_section();
74070       init_util();
74071     }
74072   });
74073
74074   // modules/ui/sections/raw_membership_editor.js
74075   var raw_membership_editor_exports = {};
74076   __export(raw_membership_editor_exports, {
74077     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor
74078   });
74079   function uiSectionRawMembershipEditor(context) {
74080     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
74081       return _entityIDs && _entityIDs.length;
74082     }).label(function() {
74083       var parents = getSharedParentRelations();
74084       var gt2 = parents.length > _maxMemberships ? ">" : "";
74085       var count = gt2 + parents.slice(0, _maxMemberships).length;
74086       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
74087     }).disclosureContent(renderDisclosureContent);
74088     var taginfo = services.taginfo;
74089     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
74090       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
74091     }).itemsMouseLeave(function(d3_event, d2) {
74092       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74093     });
74094     var _inChange = false;
74095     var _entityIDs = [];
74096     var _showBlank;
74097     var _maxMemberships = 1e3;
74098     const recentlyAdded = /* @__PURE__ */ new Set();
74099     function getSharedParentRelations() {
74100       var parents = [];
74101       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
74102         var entity = context.graph().hasEntity(_entityIDs[i3]);
74103         if (!entity) continue;
74104         if (i3 === 0) {
74105           parents = context.graph().parentRelations(entity);
74106         } else {
74107           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
74108         }
74109         if (!parents.length) break;
74110       }
74111       return parents;
74112     }
74113     function getMemberships() {
74114       var memberships = [];
74115       var relations = getSharedParentRelations().slice(0, _maxMemberships);
74116       var isMultiselect = _entityIDs.length > 1;
74117       var i3, relation, membership, index, member, indexedMember;
74118       for (i3 = 0; i3 < relations.length; i3++) {
74119         relation = relations[i3];
74120         membership = {
74121           relation,
74122           members: [],
74123           hash: osmEntity.key(relation)
74124         };
74125         for (index = 0; index < relation.members.length; index++) {
74126           member = relation.members[index];
74127           if (_entityIDs.indexOf(member.id) !== -1) {
74128             indexedMember = Object.assign({}, member, { index });
74129             membership.members.push(indexedMember);
74130             membership.hash += "," + index.toString();
74131             if (!isMultiselect) {
74132               memberships.push(membership);
74133               membership = {
74134                 relation,
74135                 members: [],
74136                 hash: osmEntity.key(relation)
74137               };
74138             }
74139           }
74140         }
74141         if (membership.members.length) memberships.push(membership);
74142       }
74143       memberships.forEach(function(membership2) {
74144         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
74145         var roles = [];
74146         membership2.members.forEach(function(member2) {
74147           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
74148         });
74149         membership2.role = roles.length === 1 ? roles[0] : roles;
74150       });
74151       const existingRelations = memberships.filter((membership2) => !recentlyAdded.has(membership2.relation.id)).map((membership2) => ({
74152         ...membership2,
74153         // We only sort relations that were not added just now.
74154         // Sorting uses the same label as shown in the UI.
74155         // If the label is not unique, the relation ID ensures
74156         // that the sort order is still stable.
74157         _sortKey: [
74158           baseDisplayValue(membership2.relation),
74159           membership2.relation.id
74160         ].join("-")
74161       })).sort((a4, b3) => {
74162         return a4._sortKey.localeCompare(
74163           b3._sortKey,
74164           _mainLocalizer.localeCodes(),
74165           { numeric: true }
74166         );
74167       });
74168       const newlyAddedRelations = memberships.filter((membership2) => recentlyAdded.has(membership2.relation.id));
74169       return [
74170         // the sorted relations come first
74171         ...existingRelations,
74172         // then the ones that were just added from this panel
74173         ...newlyAddedRelations
74174       ];
74175     }
74176     function selectRelation(d3_event, d2) {
74177       d3_event.preventDefault();
74178       utilHighlightEntities([d2.relation.id], false, context);
74179       context.enter(modeSelect(context, [d2.relation.id]));
74180     }
74181     function zoomToRelation(d3_event, d2) {
74182       d3_event.preventDefault();
74183       var entity = context.entity(d2.relation.id);
74184       context.map().zoomToEase(entity);
74185       utilHighlightEntities([d2.relation.id], true, context);
74186     }
74187     function changeRole(d3_event, d2) {
74188       if (d2 === 0) return;
74189       if (_inChange) return;
74190       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
74191       if (!newRole.trim() && typeof d2.role !== "string") return;
74192       var membersToUpdate = d2.members.filter(function(member) {
74193         return member.role !== newRole;
74194       });
74195       if (membersToUpdate.length) {
74196         _inChange = true;
74197         context.perform(
74198           function actionChangeMemberRoles(graph) {
74199             membersToUpdate.forEach(function(member) {
74200               var newMember = Object.assign({}, member, { role: newRole });
74201               delete newMember.index;
74202               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
74203             });
74204             return graph;
74205           },
74206           _t("operations.change_role.annotation", {
74207             n: membersToUpdate.length
74208           })
74209         );
74210         context.validator().validate();
74211       }
74212       _inChange = false;
74213     }
74214     function addMembership(d2, role) {
74215       _showBlank = false;
74216       function actionAddMembers(relationId, ids, role2) {
74217         return function(graph) {
74218           for (var i3 in ids) {
74219             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
74220             graph = actionAddMember(relationId, member)(graph);
74221           }
74222           return graph;
74223         };
74224       }
74225       if (d2.relation) {
74226         recentlyAdded.add(d2.relation.id);
74227         context.perform(
74228           actionAddMembers(d2.relation.id, _entityIDs, role),
74229           _t("operations.add_member.annotation", {
74230             n: _entityIDs.length
74231           })
74232         );
74233         context.validator().validate();
74234       } else {
74235         var relation = osmRelation();
74236         context.perform(
74237           actionAddEntity(relation),
74238           actionAddMembers(relation.id, _entityIDs, role),
74239           _t("operations.add.annotation.relation")
74240         );
74241         context.enter(modeSelect(context, [relation.id]).newFeature(true));
74242       }
74243     }
74244     function downloadMembers(d3_event, d2) {
74245       d3_event.preventDefault();
74246       const button = select_default2(this);
74247       button.classed("loading", true);
74248       context.loadEntity(d2.relation.id, function() {
74249         section.reRender();
74250       });
74251     }
74252     function deleteMembership(d3_event, d2) {
74253       this.blur();
74254       if (d2 === 0) return;
74255       utilHighlightEntities([d2.relation.id], false, context);
74256       var indexes = d2.members.map(function(member) {
74257         return member.index;
74258       });
74259       context.perform(
74260         actionDeleteMembers(d2.relation.id, indexes),
74261         _t("operations.delete_member.annotation", {
74262           n: _entityIDs.length
74263         })
74264       );
74265       context.validator().validate();
74266     }
74267     function fetchNearbyRelations(q3, callback) {
74268       var newRelation = {
74269         relation: null,
74270         value: _t("inspector.new_relation"),
74271         display: _t.append("inspector.new_relation")
74272       };
74273       var entityID = _entityIDs[0];
74274       var result = [];
74275       var graph = context.graph();
74276       function baseDisplayLabel(entity) {
74277         var matched = _mainPresetIndex.match(entity, graph);
74278         var presetName = matched && matched.name() || _t("inspector.relation");
74279         var entityName = utilDisplayName(entity) || "";
74280         return (selection2) => {
74281           selection2.append("b").text(presetName + " ");
74282           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
74283         };
74284       }
74285       var explicitRelation = q3 && context.hasEntity(q3.toLowerCase());
74286       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
74287         result.push({
74288           relation: explicitRelation,
74289           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
74290           display: baseDisplayLabel(explicitRelation)
74291         });
74292       } else {
74293         context.history().intersects(context.map().extent()).forEach(function(entity) {
74294           if (entity.type !== "relation" || entity.id === entityID) return;
74295           var value = baseDisplayValue(entity);
74296           if (q3 && (value + " " + entity.id).toLowerCase().indexOf(q3.toLowerCase()) === -1) return;
74297           result.push({
74298             relation: entity,
74299             value,
74300             display: baseDisplayLabel(entity)
74301           });
74302         });
74303         result.sort(function(a4, b3) {
74304           return osmRelation.creationOrder(a4.relation, b3.relation);
74305         });
74306         Object.values(utilArrayGroupBy(result, "value")).filter((v3) => v3.length > 1).flat().forEach((obj) => obj.value += " " + obj.relation.id);
74307       }
74308       result.forEach(function(obj) {
74309         obj.title = obj.value;
74310       });
74311       result.unshift(newRelation);
74312       callback(result);
74313     }
74314     function baseDisplayValue(entity) {
74315       const graph = context.graph();
74316       var matched = _mainPresetIndex.match(entity, graph);
74317       var presetName = matched && matched.name() || _t("inspector.relation");
74318       var entityName = utilDisplayName(entity) || "";
74319       return presetName + " " + entityName;
74320     }
74321     function renderDisclosureContent(selection2) {
74322       var memberships = getMemberships();
74323       var list = selection2.selectAll(".member-list").data([0]);
74324       list = list.enter().append("ul").attr("class", "member-list").merge(list);
74325       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
74326         return d2.hash;
74327       });
74328       items.exit().each(unbind).remove();
74329       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
74330       itemsEnter.on("mouseover", function(d3_event, d2) {
74331         utilHighlightEntities([d2.relation.id], true, context);
74332       }).on("mouseout", function(d3_event, d2) {
74333         utilHighlightEntities([d2.relation.id], false, context);
74334       });
74335       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
74336         return d2.domId;
74337       });
74338       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
74339       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
74340         var matched = _mainPresetIndex.match(d2.relation, context.graph());
74341         return matched && matched.name() || _t.html("inspector.relation");
74342       });
74343       labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d2) => d2.relation.tags.colour && isColourValid(d2.relation.tags.colour)).style("border-color", (d2) => d2.relation.tags.colour).text(function(d2) {
74344         const matched = _mainPresetIndex.match(d2.relation, context.graph());
74345         return utilDisplayName(d2.relation, matched.suggestion);
74346       });
74347       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
74348       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
74349       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
74350       items = items.merge(itemsEnter);
74351       items.selectAll("button.members-download").classed("hide", (d2) => {
74352         const graph = context.graph();
74353         return d2.relation.members.every((m3) => graph.hasEntity(m3.id));
74354       });
74355       const dupeLabels = new WeakSet(Object.values(
74356         utilArrayGroupBy(items.selectAll(".label-text").nodes(), "textContent")
74357       ).filter((v3) => v3.length > 1).flat());
74358       items.select(".label-text").each(function() {
74359         const label = select_default2(this);
74360         const entityName = label.select(".member-entity-name");
74361         if (dupeLabels.has(this)) {
74362           label.attr("title", (d2) => `${entityName.text()} ${d2.relation.id}`);
74363         } else {
74364           label.attr("title", () => entityName.text());
74365         }
74366       });
74367       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74368       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
74369         return d2.domId;
74370       }).property("type", "text").property("value", function(d2) {
74371         return typeof d2.role === "string" ? d2.role : "";
74372       }).attr("title", function(d2) {
74373         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
74374       }).attr("placeholder", function(d2) {
74375         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
74376       }).classed("mixed", function(d2) {
74377         return Array.isArray(d2.role);
74378       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
74379       if (taginfo) {
74380         wrapEnter.each(bindTypeahead);
74381       }
74382       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
74383       newMembership.exit().remove();
74384       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
74385       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
74386       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
74387       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
74388         list.selectAll(".member-row-new").remove();
74389       });
74390       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
74391       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
74392       newMembership = newMembership.merge(newMembershipEnter);
74393       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
74394         nearbyCombo.on("accept", function(d2) {
74395           this.blur();
74396           acceptEntity.call(this, d2);
74397         }).on("cancel", cancelEntity)
74398       );
74399       var addRow = selection2.selectAll(".add-row").data([0]);
74400       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
74401       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
74402       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
74403       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
74404       addRowEnter.append("div").attr("class", "space-value");
74405       addRowEnter.append("div").attr("class", "space-buttons");
74406       addRow = addRow.merge(addRowEnter);
74407       addRow.select(".add-relation").on("click", function() {
74408         _showBlank = true;
74409         section.reRender();
74410         list.selectAll(".member-entity-input").node().focus();
74411       });
74412       function acceptEntity(d2) {
74413         if (!d2) {
74414           cancelEntity();
74415           return;
74416         }
74417         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
74418         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
74419         addMembership(d2, role);
74420       }
74421       function cancelEntity() {
74422         var input = newMembership.selectAll(".member-entity-input");
74423         input.property("value", "");
74424         context.surface().selectAll(".highlighted").classed("highlighted", false);
74425       }
74426       function bindTypeahead(d2) {
74427         var row = select_default2(this);
74428         var role = row.selectAll("input.member-role");
74429         var origValue = role.property("value");
74430         function sort(value, data) {
74431           var sameletter = [];
74432           var other = [];
74433           for (var i3 = 0; i3 < data.length; i3++) {
74434             if (data[i3].value.substring(0, value.length) === value) {
74435               sameletter.push(data[i3]);
74436             } else {
74437               other.push(data[i3]);
74438             }
74439           }
74440           return sameletter.concat(other);
74441         }
74442         role.call(
74443           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
74444             var rtype = d2.relation.tags.type;
74445             taginfo.roles({
74446               debounce: true,
74447               rtype: rtype || "",
74448               geometry: context.graph().geometry(_entityIDs[0]),
74449               query: role2
74450             }, function(err, data) {
74451               if (!err) callback(sort(role2, data));
74452             });
74453           }).on("cancel", function() {
74454             role.property("value", origValue);
74455           })
74456         );
74457       }
74458       function unbind() {
74459         var row = select_default2(this);
74460         row.selectAll("input.member-role").call(uiCombobox.off, context);
74461       }
74462     }
74463     section.entityIDs = function(val) {
74464       if (!arguments.length) return _entityIDs;
74465       const didChange = _entityIDs.join(",") !== val.join(",");
74466       _entityIDs = val;
74467       _showBlank = false;
74468       if (didChange) {
74469         recentlyAdded.clear();
74470       }
74471       return section;
74472     };
74473     return section;
74474   }
74475   var init_raw_membership_editor = __esm({
74476     "modules/ui/sections/raw_membership_editor.js"() {
74477       "use strict";
74478       init_src5();
74479       init_presets();
74480       init_localizer();
74481       init_add_entity();
74482       init_add_member();
74483       init_change_member();
74484       init_delete_members();
74485       init_select5();
74486       init_osm();
74487       init_tags();
74488       init_services();
74489       init_icon();
74490       init_combobox();
74491       init_section();
74492       init_tooltip();
74493       init_array3();
74494       init_util();
74495     }
74496   });
74497
74498   // modules/ui/sections/selection_list.js
74499   var selection_list_exports = {};
74500   __export(selection_list_exports, {
74501     uiSectionSelectionList: () => uiSectionSelectionList
74502   });
74503   function uiSectionSelectionList(context) {
74504     var _selectedIDs = [];
74505     var section = uiSection("selected-features", context).shouldDisplay(function() {
74506       return _selectedIDs.length > 1;
74507     }).label(function() {
74508       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
74509     }).disclosureContent(renderDisclosureContent);
74510     context.history().on("change.selectionList", function(difference2) {
74511       if (difference2) {
74512         section.reRender();
74513       }
74514     });
74515     section.entityIDs = function(val) {
74516       if (!arguments.length) return _selectedIDs;
74517       _selectedIDs = val;
74518       return section;
74519     };
74520     function selectEntity(d3_event, entity) {
74521       context.enter(modeSelect(context, [entity.id]));
74522     }
74523     function deselectEntity(d3_event, entity) {
74524       var selectedIDs = _selectedIDs.slice();
74525       var index = selectedIDs.indexOf(entity.id);
74526       if (index > -1) {
74527         selectedIDs.splice(index, 1);
74528         context.enter(modeSelect(context, selectedIDs));
74529       }
74530     }
74531     function renderDisclosureContent(selection2) {
74532       var list = selection2.selectAll(".feature-list").data([0]);
74533       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
74534       var entities = _selectedIDs.map(function(id2) {
74535         return context.hasEntity(id2);
74536       }).filter(Boolean);
74537       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
74538       items.exit().remove();
74539       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
74540         select_default2(this).on("mouseover", function() {
74541           utilHighlightEntities([d2.id], true, context);
74542         }).on("mouseout", function() {
74543           utilHighlightEntities([d2.id], false, context);
74544         });
74545       });
74546       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
74547       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
74548       label.append("span").attr("class", "entity-type");
74549       label.append("span").attr("class", "entity-name");
74550       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
74551       items = items.merge(enter);
74552       items.selectAll(".entity-geom-icon use").attr("href", function() {
74553         var entity = this.parentNode.parentNode.__data__;
74554         return "#iD-icon-" + entity.geometry(context.graph());
74555       });
74556       items.selectAll(".entity-type").text(function(entity) {
74557         return _mainPresetIndex.match(entity, context.graph()).name();
74558       });
74559       items.selectAll(".entity-name").text(function(d2) {
74560         var entity = context.entity(d2.id);
74561         return utilDisplayName(entity);
74562       });
74563     }
74564     return section;
74565   }
74566   var init_selection_list = __esm({
74567     "modules/ui/sections/selection_list.js"() {
74568       "use strict";
74569       init_src5();
74570       init_presets();
74571       init_select5();
74572       init_osm();
74573       init_icon();
74574       init_section();
74575       init_localizer();
74576       init_util();
74577     }
74578   });
74579
74580   // modules/ui/entity_editor.js
74581   var entity_editor_exports = {};
74582   __export(entity_editor_exports, {
74583     uiEntityEditor: () => uiEntityEditor
74584   });
74585   function uiEntityEditor(context) {
74586     var dispatch14 = dispatch_default("choose");
74587     var _state = "select";
74588     var _coalesceChanges = false;
74589     var _modified = false;
74590     var _base;
74591     var _entityIDs;
74592     var _activePresets = [];
74593     var _newFeature;
74594     var _sections;
74595     function entityEditor(selection2) {
74596       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
74597       var header = selection2.selectAll(".header").data([0]);
74598       var headerEnter = header.enter().append("div").attr("class", "header fillL");
74599       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
74600       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
74601       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74602         context.enter(modeBrowse(context));
74603       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
74604       headerEnter.append("h2");
74605       header = header.merge(headerEnter);
74606       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
74607       header.selectAll(".preset-reset").on("click", function() {
74608         dispatch14.call("choose", this, _activePresets);
74609       });
74610       var body = selection2.selectAll(".inspector-body").data([0]);
74611       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
74612       body = body.merge(bodyEnter);
74613       if (!_sections) {
74614         _sections = [
74615           uiSectionSelectionList(context),
74616           uiSectionFeatureType(context).on("choose", function(presets) {
74617             dispatch14.call("choose", this, presets);
74618           }),
74619           uiSectionEntityIssues(context),
74620           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
74621           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
74622           uiSectionRawMemberEditor(context),
74623           uiSectionRawMembershipEditor(context)
74624         ];
74625       }
74626       _sections.forEach(function(section) {
74627         if (section.entityIDs) {
74628           section.entityIDs(_entityIDs);
74629         }
74630         if (section.presets) {
74631           section.presets(_activePresets);
74632         }
74633         if (section.tags) {
74634           section.tags(combinedTags);
74635         }
74636         if (section.state) {
74637           section.state(_state);
74638         }
74639         body.call(section.render);
74640       });
74641       context.history().on("change.entity-editor", historyChanged);
74642       function historyChanged(difference2) {
74643         if (selection2.selectAll(".entity-editor").empty()) return;
74644         if (_state === "hide") return;
74645         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
74646         if (!significant) return;
74647         _entityIDs = _entityIDs.filter(context.hasEntity);
74648         if (!_entityIDs.length) return;
74649         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
74650         loadActivePresets();
74651         var graph = context.graph();
74652         entityEditor.modified(_base !== graph);
74653         entityEditor(selection2);
74654         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
74655           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
74656         }
74657       }
74658     }
74659     function changeTags(entityIDs, changed, onInput) {
74660       var actions = [];
74661       for (var i3 in entityIDs) {
74662         var entityID = entityIDs[i3];
74663         var entity = context.entity(entityID);
74664         var tags = Object.assign({}, entity.tags);
74665         if (typeof changed === "function") {
74666           tags = changed(tags);
74667         } else {
74668           for (var k3 in changed) {
74669             if (!k3) continue;
74670             var v3 = changed[k3];
74671             if (typeof v3 === "object") {
74672               tags[k3] = tags[v3.oldKey];
74673             } else if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74674               tags[k3] = v3;
74675             }
74676           }
74677         }
74678         if (!onInput) {
74679           tags = utilCleanTags(tags);
74680         }
74681         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74682           actions.push(actionChangeTags(entityID, tags));
74683         }
74684       }
74685       if (actions.length) {
74686         var combinedAction = function(graph) {
74687           actions.forEach(function(action) {
74688             graph = action(graph);
74689           });
74690           return graph;
74691         };
74692         var annotation = _t("operations.change_tags.annotation");
74693         if (_coalesceChanges) {
74694           context.overwrite(combinedAction, annotation);
74695         } else {
74696           context.perform(combinedAction, annotation);
74697         }
74698         _coalesceChanges = !!onInput;
74699       }
74700       if (!onInput) {
74701         context.validator().validate();
74702       }
74703     }
74704     function revertTags(keys2) {
74705       var actions = [];
74706       for (var i3 in _entityIDs) {
74707         var entityID = _entityIDs[i3];
74708         var original = context.graph().base().entities[entityID];
74709         var changed = {};
74710         for (var j3 in keys2) {
74711           var key = keys2[j3];
74712           changed[key] = original ? original.tags[key] : void 0;
74713         }
74714         var entity = context.entity(entityID);
74715         var tags = Object.assign({}, entity.tags);
74716         for (var k3 in changed) {
74717           if (!k3) continue;
74718           var v3 = changed[k3];
74719           if (v3 !== void 0 || tags.hasOwnProperty(k3)) {
74720             tags[k3] = v3;
74721           }
74722         }
74723         tags = utilCleanTags(tags);
74724         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
74725           actions.push(actionChangeTags(entityID, tags));
74726         }
74727       }
74728       if (actions.length) {
74729         var combinedAction = function(graph) {
74730           actions.forEach(function(action) {
74731             graph = action(graph);
74732           });
74733           return graph;
74734         };
74735         var annotation = _t("operations.change_tags.annotation");
74736         if (_coalesceChanges) {
74737           context.overwrite(combinedAction, annotation);
74738         } else {
74739           context.perform(combinedAction, annotation);
74740         }
74741       }
74742       context.validator().validate();
74743     }
74744     entityEditor.modified = function(val) {
74745       if (!arguments.length) return _modified;
74746       _modified = val;
74747       return entityEditor;
74748     };
74749     entityEditor.state = function(val) {
74750       if (!arguments.length) return _state;
74751       _state = val;
74752       return entityEditor;
74753     };
74754     entityEditor.entityIDs = function(val) {
74755       if (!arguments.length) return _entityIDs;
74756       _base = context.graph();
74757       _coalesceChanges = false;
74758       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
74759       _entityIDs = val;
74760       loadActivePresets(true);
74761       return entityEditor.modified(false);
74762     };
74763     entityEditor.newFeature = function(val) {
74764       if (!arguments.length) return _newFeature;
74765       _newFeature = val;
74766       return entityEditor;
74767     };
74768     function loadActivePresets(isForNewSelection) {
74769       var graph = context.graph();
74770       var counts = {};
74771       for (var i3 in _entityIDs) {
74772         var entity = graph.hasEntity(_entityIDs[i3]);
74773         if (!entity) return;
74774         var match = _mainPresetIndex.match(entity, graph);
74775         if (!counts[match.id]) counts[match.id] = 0;
74776         counts[match.id] += 1;
74777       }
74778       var matches = Object.keys(counts).sort(function(p1, p2) {
74779         return counts[p2] - counts[p1];
74780       }).map(function(pID) {
74781         return _mainPresetIndex.item(pID);
74782       });
74783       if (!isForNewSelection) {
74784         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
74785         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
74786       }
74787       entityEditor.presets(matches);
74788     }
74789     entityEditor.presets = function(val) {
74790       if (!arguments.length) return _activePresets;
74791       if (!utilArrayIdentical(val, _activePresets)) {
74792         _activePresets = val;
74793       }
74794       return entityEditor;
74795     };
74796     return utilRebind(entityEditor, dispatch14, "on");
74797   }
74798   var import_fast_deep_equal10;
74799   var init_entity_editor = __esm({
74800     "modules/ui/entity_editor.js"() {
74801       "use strict";
74802       init_src4();
74803       import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
74804       init_presets();
74805       init_localizer();
74806       init_change_tags();
74807       init_browse();
74808       init_icon();
74809       init_array3();
74810       init_util();
74811       init_entity_issues();
74812       init_feature_type();
74813       init_preset_fields();
74814       init_raw_member_editor();
74815       init_raw_membership_editor();
74816       init_raw_tag_editor();
74817       init_selection_list();
74818     }
74819   });
74820
74821   // modules/ui/preset_list.js
74822   var preset_list_exports = {};
74823   __export(preset_list_exports, {
74824     uiPresetList: () => uiPresetList
74825   });
74826   function uiPresetList(context) {
74827     var dispatch14 = dispatch_default("cancel", "choose");
74828     var _entityIDs;
74829     var _currLoc;
74830     var _currentPresets;
74831     var _autofocus = false;
74832     function presetList(selection2) {
74833       if (!_entityIDs) return;
74834       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
74835       selection2.html("");
74836       var messagewrap = selection2.append("div").attr("class", "header fillL");
74837       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
74838       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
74839         dispatch14.call("cancel", this);
74840       }).call(svgIcon("#iD-icon-close"));
74841       function initialKeydown(d3_event) {
74842         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
74843           d3_event.preventDefault();
74844           d3_event.stopPropagation();
74845           operationDelete(context, _entityIDs)();
74846         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
74847           d3_event.preventDefault();
74848           d3_event.stopPropagation();
74849           context.undo();
74850         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
74851           select_default2(this).on("keydown", keydown);
74852           keydown.call(this, d3_event);
74853         }
74854       }
74855       function keydown(d3_event) {
74856         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
74857         search.node().selectionStart === search.property("value").length) {
74858           d3_event.preventDefault();
74859           d3_event.stopPropagation();
74860           var buttons = list.selectAll(".preset-list-button");
74861           if (!buttons.empty()) buttons.nodes()[0].focus();
74862         }
74863       }
74864       function keypress(d3_event) {
74865         var value = search.property("value");
74866         if (d3_event.keyCode === 13 && // ↩ Return
74867         value.length) {
74868           list.selectAll(".preset-list-item:first-child").each(function(d2) {
74869             d2.choose.call(this);
74870           });
74871         }
74872       }
74873       function inputevent() {
74874         var value = search.property("value");
74875         list.classed("filtered", value.length);
74876         var results, messageText;
74877         if (value.length) {
74878           results = presets.search(value, entityGeometries()[0], _currLoc);
74879           messageText = _t.html("inspector.results", {
74880             n: results.collection.length,
74881             search: value
74882           });
74883         } else {
74884           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74885           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
74886           messageText = _t.html("inspector.choose");
74887         }
74888         list.call(drawList, results);
74889         message.html(messageText);
74890       }
74891       var searchWrap = selection2.append("div").attr("class", "search-header");
74892       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
74893       var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search_feature_type")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
74894       if (_autofocus) {
74895         search.node().focus();
74896         setTimeout(function() {
74897           search.node().focus();
74898         }, 0);
74899       }
74900       var listWrap = selection2.append("div").attr("class", "inspector-body");
74901       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
74902       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
74903       context.features().on("change.preset-list", updateForFeatureHiddenState);
74904     }
74905     function drawList(list, presets) {
74906       presets = presets.matchAllGeometry(entityGeometries());
74907       var collection = presets.collection.reduce(function(collection2, preset) {
74908         if (!preset) return collection2;
74909         if (preset.members) {
74910           if (preset.members.collection.filter(function(preset2) {
74911             return preset2.addable();
74912           }).length > 1) {
74913             collection2.push(CategoryItem(preset));
74914           }
74915         } else if (preset.addable()) {
74916           collection2.push(PresetItem(preset));
74917         }
74918         return collection2;
74919       }, []);
74920       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
74921         return d2.preset.id;
74922       });
74923       items.order();
74924       items.exit().remove();
74925       items.enter().append("div").attr("class", function(item) {
74926         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
74927       }).classed("current", function(item) {
74928         return _currentPresets.indexOf(item.preset) !== -1;
74929       }).each(function(item) {
74930         select_default2(this).call(item);
74931       }).style("opacity", 0).transition().style("opacity", 1);
74932       updateForFeatureHiddenState();
74933     }
74934     function itemKeydown(d3_event) {
74935       var item = select_default2(this.closest(".preset-list-item"));
74936       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
74937       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
74938         d3_event.preventDefault();
74939         d3_event.stopPropagation();
74940         var nextItem = select_default2(item.node().nextElementSibling);
74941         if (nextItem.empty()) {
74942           if (!parentItem.empty()) {
74943             nextItem = select_default2(parentItem.node().nextElementSibling);
74944           }
74945         } else if (select_default2(this).classed("expanded")) {
74946           nextItem = item.select(".subgrid .preset-list-item:first-child");
74947         }
74948         if (!nextItem.empty()) {
74949           nextItem.select(".preset-list-button").node().focus();
74950         }
74951       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
74952         d3_event.preventDefault();
74953         d3_event.stopPropagation();
74954         var previousItem = select_default2(item.node().previousElementSibling);
74955         if (previousItem.empty()) {
74956           if (!parentItem.empty()) {
74957             previousItem = parentItem;
74958           }
74959         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
74960           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
74961         }
74962         if (!previousItem.empty()) {
74963           previousItem.select(".preset-list-button").node().focus();
74964         } else {
74965           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
74966           search.node().focus();
74967         }
74968       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
74969         d3_event.preventDefault();
74970         d3_event.stopPropagation();
74971         if (!parentItem.empty()) {
74972           parentItem.select(".preset-list-button").node().focus();
74973         }
74974       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
74975         d3_event.preventDefault();
74976         d3_event.stopPropagation();
74977         item.datum().choose.call(select_default2(this).node());
74978       }
74979     }
74980     function CategoryItem(preset) {
74981       var box, sublist, shown = false;
74982       function item(selection2) {
74983         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
74984         function click() {
74985           var isExpanded = select_default2(this).classed("expanded");
74986           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
74987           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
74988           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
74989           item.choose();
74990         }
74991         var geometries = entityGeometries();
74992         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) {
74993           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
74994             d3_event.preventDefault();
74995             d3_event.stopPropagation();
74996             if (!select_default2(this).classed("expanded")) {
74997               click.call(this, d3_event);
74998             }
74999           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
75000             d3_event.preventDefault();
75001             d3_event.stopPropagation();
75002             if (select_default2(this).classed("expanded")) {
75003               click.call(this, d3_event);
75004             }
75005           } else {
75006             itemKeydown.call(this, d3_event);
75007           }
75008         });
75009         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75010         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");
75011         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
75012         box.append("div").attr("class", "arrow");
75013         sublist = box.append("div").attr("class", "preset-list fillL3");
75014       }
75015       item.choose = function() {
75016         if (!box || !sublist) return;
75017         if (shown) {
75018           shown = false;
75019           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
75020         } else {
75021           shown = true;
75022           var members = preset.members.matchAllGeometry(entityGeometries());
75023           sublist.call(drawList, members);
75024           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
75025         }
75026       };
75027       item.preset = preset;
75028       return item;
75029     }
75030     function PresetItem(preset) {
75031       function item(selection2) {
75032         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
75033         var geometries = entityGeometries();
75034         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);
75035         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
75036         var nameparts = [
75037           preset.nameLabel(),
75038           preset.subtitleLabel()
75039         ].filter(Boolean);
75040         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
75041           d2(select_default2(this));
75042         });
75043         wrap2.call(item.reference.button);
75044         selection2.call(item.reference.body);
75045       }
75046       item.choose = function() {
75047         if (select_default2(this).classed("disabled")) return;
75048         if (!context.inIntro()) {
75049           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
75050         }
75051         context.perform(
75052           function(graph) {
75053             for (var i3 in _entityIDs) {
75054               var entityID = _entityIDs[i3];
75055               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
75056               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
75057             }
75058             return graph;
75059           },
75060           _t("operations.change_tags.annotation")
75061         );
75062         context.validator().validate();
75063         dispatch14.call("choose", this, preset);
75064       };
75065       item.help = function(d3_event) {
75066         d3_event.stopPropagation();
75067         item.reference.toggle();
75068       };
75069       item.preset = preset;
75070       item.reference = uiTagReference(preset.reference(), context);
75071       return item;
75072     }
75073     function updateForFeatureHiddenState() {
75074       if (!_entityIDs.every(context.hasEntity)) return;
75075       var geometries = entityGeometries();
75076       var button = context.container().selectAll(".preset-list .preset-list-button");
75077       button.call(uiTooltip().destroyAny);
75078       button.each(function(item, index) {
75079         var hiddenPresetFeaturesId;
75080         for (var i3 in geometries) {
75081           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
75082           if (hiddenPresetFeaturesId) break;
75083         }
75084         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
75085         select_default2(this).classed("disabled", isHiddenPreset);
75086         if (isHiddenPreset) {
75087           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
75088           select_default2(this).call(
75089             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
75090               features: _t("feature." + hiddenPresetFeaturesId + ".description")
75091             })).placement(index < 2 ? "bottom" : "top")
75092           );
75093         }
75094       });
75095     }
75096     presetList.autofocus = function(val) {
75097       if (!arguments.length) return _autofocus;
75098       _autofocus = val;
75099       return presetList;
75100     };
75101     presetList.entityIDs = function(val) {
75102       if (!arguments.length) return _entityIDs;
75103       _entityIDs = val;
75104       _currLoc = null;
75105       if (_entityIDs && _entityIDs.length) {
75106         const extent = _entityIDs.reduce(function(extent2, entityID) {
75107           var entity = context.graph().entity(entityID);
75108           return extent2.extend(entity.extent(context.graph()));
75109         }, geoExtent());
75110         _currLoc = extent.center();
75111         var presets = _entityIDs.map(function(entityID) {
75112           return _mainPresetIndex.match(context.entity(entityID), context.graph());
75113         });
75114         presetList.presets(presets);
75115       }
75116       return presetList;
75117     };
75118     presetList.presets = function(val) {
75119       if (!arguments.length) return _currentPresets;
75120       _currentPresets = val;
75121       return presetList;
75122     };
75123     function entityGeometries() {
75124       var counts = {};
75125       for (var i3 in _entityIDs) {
75126         var entityID = _entityIDs[i3];
75127         var entity = context.entity(entityID);
75128         var geometry = entity.geometry(context.graph());
75129         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
75130           geometry = "point";
75131         }
75132         if (!counts[geometry]) counts[geometry] = 0;
75133         counts[geometry] += 1;
75134       }
75135       return Object.keys(counts).sort(function(geom1, geom2) {
75136         return counts[geom2] - counts[geom1];
75137       });
75138     }
75139     return utilRebind(presetList, dispatch14, "on");
75140   }
75141   var init_preset_list = __esm({
75142     "modules/ui/preset_list.js"() {
75143       "use strict";
75144       init_src4();
75145       init_src5();
75146       init_debounce();
75147       init_presets();
75148       init_localizer();
75149       init_change_preset();
75150       init_delete();
75151       init_svg();
75152       init_tooltip();
75153       init_extent();
75154       init_preset_icon();
75155       init_tag_reference();
75156       init_util();
75157     }
75158   });
75159
75160   // modules/ui/inspector.js
75161   var inspector_exports = {};
75162   __export(inspector_exports, {
75163     uiInspector: () => uiInspector
75164   });
75165   function uiInspector(context) {
75166     var presetList = uiPresetList(context);
75167     var entityEditor = uiEntityEditor(context);
75168     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
75169     var _state = "select";
75170     var _entityIDs;
75171     var _newFeature = false;
75172     function inspector(selection2) {
75173       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
75174         inspector.setPreset();
75175       });
75176       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
75177       wrap2 = selection2.selectAll(".panewrap").data([0]);
75178       var enter = wrap2.enter().append("div").attr("class", "panewrap");
75179       enter.append("div").attr("class", "preset-list-pane pane");
75180       enter.append("div").attr("class", "entity-editor-pane pane");
75181       wrap2 = wrap2.merge(enter);
75182       presetPane = wrap2.selectAll(".preset-list-pane");
75183       editorPane = wrap2.selectAll(".entity-editor-pane");
75184       function shouldDefaultToPresetList() {
75185         if (_state !== "select") return false;
75186         if (_entityIDs.length !== 1) return false;
75187         var entityID = _entityIDs[0];
75188         var entity = context.hasEntity(entityID);
75189         if (!entity) return false;
75190         if (entity.hasNonGeometryTags()) return false;
75191         if (_newFeature) return true;
75192         if (entity.geometry(context.graph()) !== "vertex") return false;
75193         if (context.graph().parentRelations(entity).length) return false;
75194         if (context.validator().getEntityIssues(entityID).length) return false;
75195         if (entity.type === "node" && entity.isHighwayIntersection(context.graph())) return false;
75196         return true;
75197       }
75198       if (shouldDefaultToPresetList()) {
75199         wrap2.style("right", "-100%");
75200         editorPane.classed("hide", true);
75201         presetPane.classed("hide", false).call(presetList);
75202       } else {
75203         wrap2.style("right", "0%");
75204         presetPane.classed("hide", true);
75205         editorPane.classed("hide", false).call(entityEditor);
75206       }
75207       var footer = selection2.selectAll(".footer").data([0]);
75208       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
75209       footer.call(
75210         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
75211       );
75212     }
75213     inspector.showList = function(presets) {
75214       presetPane.classed("hide", false);
75215       wrap2.transition().styleTween("right", function() {
75216         return value_default("0%", "-100%");
75217       }).on("end", function() {
75218         editorPane.classed("hide", true);
75219       });
75220       if (presets) {
75221         presetList.presets(presets);
75222       }
75223       presetPane.call(presetList.autofocus(true));
75224     };
75225     inspector.setPreset = function(preset) {
75226       if (preset && preset.id === "type/multipolygon") {
75227         presetPane.call(presetList.autofocus(true));
75228       } else {
75229         editorPane.classed("hide", false);
75230         wrap2.transition().styleTween("right", function() {
75231           return value_default("-100%", "0%");
75232         }).on("end", function() {
75233           presetPane.classed("hide", true);
75234         });
75235         if (preset) {
75236           entityEditor.presets([preset]);
75237         }
75238         editorPane.call(entityEditor);
75239       }
75240     };
75241     inspector.state = function(val) {
75242       if (!arguments.length) return _state;
75243       _state = val;
75244       entityEditor.state(_state);
75245       context.container().selectAll(".field-help-body").remove();
75246       return inspector;
75247     };
75248     inspector.entityIDs = function(val) {
75249       if (!arguments.length) return _entityIDs;
75250       _entityIDs = val;
75251       return inspector;
75252     };
75253     inspector.newFeature = function(val) {
75254       if (!arguments.length) return _newFeature;
75255       _newFeature = val;
75256       return inspector;
75257     };
75258     return inspector;
75259   }
75260   var init_inspector = __esm({
75261     "modules/ui/inspector.js"() {
75262       "use strict";
75263       init_src8();
75264       init_src5();
75265       init_entity_editor();
75266       init_preset_list();
75267       init_view_on_osm();
75268     }
75269   });
75270
75271   // modules/ui/sidebar.js
75272   var sidebar_exports = {};
75273   __export(sidebar_exports, {
75274     uiSidebar: () => uiSidebar
75275   });
75276   function uiSidebar(context) {
75277     var inspector = uiInspector(context);
75278     var dataEditor = uiDataEditor(context);
75279     var noteEditor = uiNoteEditor(context);
75280     var keepRightEditor = uiKeepRightEditor(context);
75281     var osmoseEditor = uiOsmoseEditor(context);
75282     var _current;
75283     var _wasData = false;
75284     var _wasNote = false;
75285     var _wasQaItem = false;
75286     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
75287     function sidebar(selection2) {
75288       var container = context.container();
75289       var minWidth = 240;
75290       var sidebarWidth;
75291       var containerWidth;
75292       var dragOffset;
75293       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
75294       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
75295       var downPointerId, lastClientX, containerLocGetter;
75296       function pointerdown(d3_event) {
75297         if (downPointerId) return;
75298         if ("button" in d3_event && d3_event.button !== 0) return;
75299         downPointerId = d3_event.pointerId || "mouse";
75300         lastClientX = d3_event.clientX;
75301         containerLocGetter = utilFastMouse(container.node());
75302         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
75303         sidebarWidth = selection2.node().getBoundingClientRect().width;
75304         containerWidth = container.node().getBoundingClientRect().width;
75305         var widthPct = sidebarWidth / containerWidth * 100;
75306         selection2.style("width", widthPct + "%").style("max-width", "85%");
75307         resizer.classed("dragging", true);
75308         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
75309           d3_event2.preventDefault();
75310         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
75311       }
75312       function pointermove(d3_event) {
75313         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75314         d3_event.preventDefault();
75315         var dx = d3_event.clientX - lastClientX;
75316         lastClientX = d3_event.clientX;
75317         var isRTL = _mainLocalizer.textDirection() === "rtl";
75318         var scaleX = isRTL ? 0 : 1;
75319         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75320         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
75321         sidebarWidth = isRTL ? containerWidth - x2 : x2;
75322         var isCollapsed = selection2.classed("collapsed");
75323         var shouldCollapse = sidebarWidth < minWidth;
75324         selection2.classed("collapsed", shouldCollapse);
75325         if (shouldCollapse) {
75326           if (!isCollapsed) {
75327             selection2.style(xMarginProperty, "-400px").style("width", "400px");
75328             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
75329           }
75330         } else {
75331           var widthPct = sidebarWidth / containerWidth * 100;
75332           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75333           if (isCollapsed) {
75334             context.ui().onResize([-sidebarWidth * scaleX, 0]);
75335           } else {
75336             context.ui().onResize([-dx * scaleX, 0]);
75337           }
75338         }
75339       }
75340       function pointerup(d3_event) {
75341         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
75342         downPointerId = null;
75343         resizer.classed("dragging", false);
75344         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
75345       }
75346       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
75347       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
75348       var hoverModeSelect = function(targets) {
75349         context.container().selectAll(".feature-list-item button").classed("hover", false);
75350         if (context.selectedIDs().length > 1 && targets && targets.length) {
75351           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
75352             return targets.indexOf(node) !== -1;
75353           });
75354           if (!elements.empty()) {
75355             elements.classed("hover", true);
75356           }
75357         }
75358       };
75359       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
75360       function hover(targets) {
75361         var datum2 = targets && targets.length && targets[0];
75362         if (datum2 && datum2.__featurehash__) {
75363           _wasData = true;
75364           sidebar.show(dataEditor.datum(datum2));
75365           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75366         } else if (datum2 instanceof osmNote) {
75367           if (context.mode().id === "drag-note") return;
75368           _wasNote = true;
75369           var osm = services.osm;
75370           if (osm) {
75371             datum2 = osm.getNote(datum2.id);
75372           }
75373           sidebar.show(noteEditor.note(datum2));
75374           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75375         } else if (datum2 instanceof QAItem) {
75376           _wasQaItem = true;
75377           var errService = services[datum2.service];
75378           if (errService) {
75379             datum2 = errService.getError(datum2.id);
75380           }
75381           var errEditor;
75382           if (datum2.service === "keepRight") {
75383             errEditor = keepRightEditor;
75384           } else {
75385             errEditor = osmoseEditor;
75386           }
75387           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
75388             return d2.id === datum2.id;
75389           });
75390           sidebar.show(errEditor.error(datum2));
75391           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
75392         } else if (!_current && datum2 instanceof osmEntity) {
75393           featureListWrap.classed("inspector-hidden", true);
75394           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
75395           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
75396             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
75397             inspectorWrap.call(inspector);
75398           }
75399         } else if (!_current) {
75400           featureListWrap.classed("inspector-hidden", false);
75401           inspectorWrap.classed("inspector-hidden", true);
75402           inspector.state("hide");
75403         } else if (_wasData || _wasNote || _wasQaItem) {
75404           _wasNote = false;
75405           _wasData = false;
75406           _wasQaItem = false;
75407           context.container().selectAll(".note").classed("hover", false);
75408           context.container().selectAll(".qaItem").classed("hover", false);
75409           sidebar.hide();
75410         }
75411       }
75412       sidebar.hover = throttle_default(hover, 200);
75413       sidebar.intersects = function(extent) {
75414         var rect = selection2.node().getBoundingClientRect();
75415         return extent.intersects([
75416           context.projection.invert([0, rect.height]),
75417           context.projection.invert([rect.width, 0])
75418         ]);
75419       };
75420       sidebar.select = function(ids, newFeature) {
75421         sidebar.hide();
75422         if (ids && ids.length) {
75423           var entity = ids.length === 1 && context.entity(ids[0]);
75424           if (entity && newFeature && selection2.classed("collapsed")) {
75425             var extent = entity.extent(context.graph());
75426             sidebar.expand(sidebar.intersects(extent));
75427           }
75428           featureListWrap.classed("inspector-hidden", true);
75429           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
75430           inspector.state("select").entityIDs(ids).newFeature(newFeature);
75431           inspectorWrap.call(inspector);
75432         } else {
75433           inspector.state("hide");
75434         }
75435       };
75436       sidebar.showPresetList = function() {
75437         inspector.showList();
75438       };
75439       sidebar.show = function(component, element) {
75440         featureListWrap.classed("inspector-hidden", true);
75441         inspectorWrap.classed("inspector-hidden", true);
75442         if (_current) _current.remove();
75443         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
75444       };
75445       sidebar.hide = function() {
75446         featureListWrap.classed("inspector-hidden", false);
75447         inspectorWrap.classed("inspector-hidden", true);
75448         if (_current) _current.remove();
75449         _current = null;
75450       };
75451       sidebar.expand = function(moveMap) {
75452         if (selection2.classed("collapsed")) {
75453           sidebar.toggle(moveMap);
75454         }
75455       };
75456       sidebar.collapse = function(moveMap) {
75457         if (!selection2.classed("collapsed")) {
75458           sidebar.toggle(moveMap);
75459         }
75460       };
75461       sidebar.toggle = function(moveMap) {
75462         if (context.inIntro()) return;
75463         var isCollapsed = selection2.classed("collapsed");
75464         var isCollapsing = !isCollapsed;
75465         var isRTL = _mainLocalizer.textDirection() === "rtl";
75466         var scaleX = isRTL ? 0 : 1;
75467         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
75468         sidebarWidth = selection2.node().getBoundingClientRect().width;
75469         selection2.style("width", sidebarWidth + "px");
75470         var startMargin, endMargin, lastMargin;
75471         if (isCollapsing) {
75472           startMargin = lastMargin = 0;
75473           endMargin = -sidebarWidth;
75474         } else {
75475           startMargin = lastMargin = -sidebarWidth;
75476           endMargin = 0;
75477         }
75478         if (!isCollapsing) {
75479           selection2.classed("collapsed", isCollapsing);
75480         }
75481         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
75482           var i3 = number_default(startMargin, endMargin);
75483           return function(t2) {
75484             var dx = lastMargin - Math.round(i3(t2));
75485             lastMargin = lastMargin - dx;
75486             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
75487           };
75488         }).on("end", function() {
75489           if (isCollapsing) {
75490             selection2.classed("collapsed", isCollapsing);
75491           }
75492           if (!isCollapsing) {
75493             var containerWidth2 = container.node().getBoundingClientRect().width;
75494             var widthPct = sidebarWidth / containerWidth2 * 100;
75495             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
75496           }
75497         });
75498       };
75499       resizer.on("dblclick", function(d3_event) {
75500         d3_event.preventDefault();
75501         if (d3_event.sourceEvent) {
75502           d3_event.sourceEvent.preventDefault();
75503         }
75504         sidebar.toggle();
75505       });
75506       context.map().on("crossEditableZoom.sidebar", function(within) {
75507         if (!within && !selection2.select(".inspector-hover").empty()) {
75508           hover([]);
75509         }
75510       });
75511     }
75512     sidebar.showPresetList = function() {
75513     };
75514     sidebar.hover = function() {
75515     };
75516     sidebar.hover.cancel = function() {
75517     };
75518     sidebar.intersects = function() {
75519     };
75520     sidebar.select = function() {
75521     };
75522     sidebar.show = function() {
75523     };
75524     sidebar.hide = function() {
75525     };
75526     sidebar.expand = function() {
75527     };
75528     sidebar.collapse = function() {
75529     };
75530     sidebar.toggle = function() {
75531     };
75532     return sidebar;
75533   }
75534   var init_sidebar = __esm({
75535     "modules/ui/sidebar.js"() {
75536       "use strict";
75537       init_throttle();
75538       init_src8();
75539       init_src5();
75540       init_array3();
75541       init_util();
75542       init_osm();
75543       init_services();
75544       init_data_editor();
75545       init_feature_list();
75546       init_inspector();
75547       init_keepRight_editor();
75548       init_osmose_editor();
75549       init_note_editor();
75550       init_localizer();
75551     }
75552   });
75553
75554   // modules/ui/source_switch.js
75555   var source_switch_exports = {};
75556   __export(source_switch_exports, {
75557     uiSourceSwitch: () => uiSourceSwitch
75558   });
75559   function uiSourceSwitch(context) {
75560     var keys2;
75561     function click(d3_event) {
75562       d3_event.preventDefault();
75563       var osm = context.connection();
75564       if (!osm) return;
75565       if (context.inIntro()) return;
75566       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
75567       var isLive = select_default2(this).classed("live");
75568       isLive = !isLive;
75569       context.enter(modeBrowse(context));
75570       context.history().clearSaved();
75571       context.flush();
75572       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
75573       osm.switch(isLive ? keys2[0] : keys2[1]);
75574     }
75575     var sourceSwitch = function(selection2) {
75576       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
75577     };
75578     sourceSwitch.keys = function(_3) {
75579       if (!arguments.length) return keys2;
75580       keys2 = _3;
75581       return sourceSwitch;
75582     };
75583     return sourceSwitch;
75584   }
75585   var init_source_switch = __esm({
75586     "modules/ui/source_switch.js"() {
75587       "use strict";
75588       init_src5();
75589       init_localizer();
75590       init_browse();
75591     }
75592   });
75593
75594   // modules/ui/spinner.js
75595   var spinner_exports = {};
75596   __export(spinner_exports, {
75597     uiSpinner: () => uiSpinner
75598   });
75599   function uiSpinner(context) {
75600     var osm = context.connection();
75601     return function(selection2) {
75602       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
75603       if (osm) {
75604         osm.on("loading.spinner", function() {
75605           img.transition().style("opacity", 1);
75606         }).on("loaded.spinner", function() {
75607           img.transition().style("opacity", 0);
75608         });
75609       }
75610     };
75611   }
75612   var init_spinner = __esm({
75613     "modules/ui/spinner.js"() {
75614       "use strict";
75615     }
75616   });
75617
75618   // modules/ui/sections/privacy.js
75619   var privacy_exports = {};
75620   __export(privacy_exports, {
75621     uiSectionPrivacy: () => uiSectionPrivacy
75622   });
75623   function uiSectionPrivacy(context) {
75624     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
75625     function renderDisclosureContent(selection2) {
75626       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
75627       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(
75628         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
75629       );
75630       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
75631         d3_event.preventDefault();
75632         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
75633       });
75634       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
75635       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
75636       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"));
75637     }
75638     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
75639     return section;
75640   }
75641   var init_privacy = __esm({
75642     "modules/ui/sections/privacy.js"() {
75643       "use strict";
75644       init_preferences();
75645       init_localizer();
75646       init_tooltip();
75647       init_icon();
75648       init_section();
75649     }
75650   });
75651
75652   // modules/ui/splash.js
75653   var splash_exports = {};
75654   __export(splash_exports, {
75655     uiSplash: () => uiSplash
75656   });
75657   function uiSplash(context) {
75658     return (selection2) => {
75659       if (context.history().hasRestorableChanges()) return;
75660       let updateMessage = "";
75661       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
75662       let showSplash = !corePreferences("sawSplash");
75663       if (sawPrivacyVersion && sawPrivacyVersion !== context.privacyVersion) {
75664         updateMessage = _t("splash.privacy_update");
75665         showSplash = true;
75666       }
75667       if (!showSplash) return;
75668       corePreferences("sawSplash", true);
75669       corePreferences("sawPrivacyVersion", context.privacyVersion);
75670       _mainFileFetcher.get("intro_graph");
75671       let modalSelection = uiModal(selection2);
75672       modalSelection.select(".modal").attr("class", "modal-splash modal");
75673       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
75674       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
75675       let modalSection = introModal.append("div").attr("class", "modal-section");
75676       modalSection.append("p").html(_t.html("splash.text", {
75677         version: context.version,
75678         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
75679         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
75680       }));
75681       modalSection.append("p").html(_t.html("splash.privacy", {
75682         updateMessage,
75683         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
75684       }));
75685       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
75686       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
75687       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
75688         context.container().call(uiIntro(context));
75689         modalSelection.close();
75690       });
75691       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
75692       walkthrough.append("div").call(_t.append("splash.walkthrough"));
75693       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
75694       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
75695       startEditing.append("div").call(_t.append("splash.start"));
75696       modalSelection.select("button.close").attr("class", "hide");
75697     };
75698   }
75699   var init_splash = __esm({
75700     "modules/ui/splash.js"() {
75701       "use strict";
75702       init_preferences();
75703       init_file_fetcher();
75704       init_localizer();
75705       init_intro2();
75706       init_modal();
75707       init_privacy();
75708     }
75709   });
75710
75711   // modules/ui/status.js
75712   var status_exports = {};
75713   __export(status_exports, {
75714     uiStatus: () => uiStatus
75715   });
75716   function uiStatus(context) {
75717     var osm = context.connection();
75718     return function(selection2) {
75719       if (!osm) return;
75720       function update(err, apiStatus) {
75721         selection2.html("");
75722         if (err) {
75723           if (apiStatus === "connectionSwitched") {
75724             return;
75725           } else if (apiStatus === "rateLimited") {
75726             if (!osm.authenticated()) {
75727               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) {
75728                 d3_event.preventDefault();
75729                 osm.authenticate();
75730               });
75731             } else {
75732               selection2.call(_t.append("osm_api_status.message.rateLimited"));
75733             }
75734           } else {
75735             var throttledRetry = throttle_default(function() {
75736               context.loadTiles(context.projection);
75737               osm.reloadApiStatus();
75738             }, 2e3);
75739             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) {
75740               d3_event.preventDefault();
75741               throttledRetry();
75742             });
75743           }
75744         } else if (apiStatus === "readonly") {
75745           selection2.call(_t.append("osm_api_status.message.readonly"));
75746         } else if (apiStatus === "offline") {
75747           selection2.call(_t.append("osm_api_status.message.offline"));
75748         }
75749         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
75750       }
75751       osm.on("apiStatusChange.uiStatus", update);
75752       context.history().on("storage_error", () => {
75753         selection2.selectAll("span.local-storage-full").remove();
75754         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
75755         selection2.classed("error", true);
75756       });
75757       window.setInterval(function() {
75758         osm.reloadApiStatus();
75759       }, 9e4);
75760       osm.reloadApiStatus();
75761     };
75762   }
75763   var init_status = __esm({
75764     "modules/ui/status.js"() {
75765       "use strict";
75766       init_throttle();
75767       init_localizer();
75768       init_icon();
75769     }
75770   });
75771
75772   // modules/ui/tools/modes.js
75773   var modes_exports = {};
75774   __export(modes_exports, {
75775     uiToolDrawModes: () => uiToolDrawModes
75776   });
75777   function uiToolDrawModes(context) {
75778     var tool = {
75779       id: "old_modes",
75780       label: _t.append("toolbar.add_feature")
75781     };
75782     var modes = [
75783       modeAddPoint(context, {
75784         title: _t.append("modes.add_point.title"),
75785         button: "point",
75786         description: _t.append("modes.add_point.description"),
75787         preset: _mainPresetIndex.item("point"),
75788         key: "1"
75789       }),
75790       modeAddLine(context, {
75791         title: _t.append("modes.add_line.title"),
75792         button: "line",
75793         description: _t.append("modes.add_line.description"),
75794         preset: _mainPresetIndex.item("line"),
75795         key: "2"
75796       }),
75797       modeAddArea(context, {
75798         title: _t.append("modes.add_area.title"),
75799         button: "area",
75800         description: _t.append("modes.add_area.description"),
75801         preset: _mainPresetIndex.item("area"),
75802         key: "3"
75803       })
75804     ];
75805     function enabled(_mode) {
75806       return osmEditable();
75807     }
75808     function osmEditable() {
75809       return context.editable();
75810     }
75811     modes.forEach(function(mode) {
75812       context.keybinding().on(mode.key, function() {
75813         if (!enabled(mode)) return;
75814         if (mode.id === context.mode().id) {
75815           context.enter(modeBrowse(context));
75816         } else {
75817           context.enter(mode);
75818         }
75819       });
75820     });
75821     tool.render = function(selection2) {
75822       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
75823       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75824       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
75825       context.on("enter.modes", update);
75826       update();
75827       function update() {
75828         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
75829           return d2.id;
75830         });
75831         buttons.exit().remove();
75832         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75833           return d2.id + " add-button bar-button";
75834         }).on("click.mode-buttons", function(d3_event, d2) {
75835           if (!enabled(d2)) return;
75836           var currMode = context.mode().id;
75837           if (/^draw/.test(currMode)) return;
75838           if (d2.id === currMode) {
75839             context.enter(modeBrowse(context));
75840           } else {
75841             context.enter(d2);
75842           }
75843         }).call(
75844           uiTooltip().placement("bottom").title(function(d2) {
75845             return d2.description;
75846           }).keys(function(d2) {
75847             return [d2.key];
75848           }).scrollContainer(context.container().select(".top-toolbar"))
75849         );
75850         buttonsEnter.each(function(d2) {
75851           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
75852         });
75853         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
75854           mode.title(select_default2(this));
75855         });
75856         if (buttons.enter().size() || buttons.exit().size()) {
75857           context.ui().checkOverflow(".top-toolbar", true);
75858         }
75859         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
75860           return !enabled(d2);
75861         }).classed("disabled", function(d2) {
75862           return !enabled(d2);
75863         }).attr("aria-pressed", function(d2) {
75864           return context.mode() && context.mode().button === d2.button;
75865         }).classed("active", function(d2) {
75866           return context.mode() && context.mode().button === d2.button;
75867         });
75868       }
75869     };
75870     return tool;
75871   }
75872   var init_modes = __esm({
75873     "modules/ui/tools/modes.js"() {
75874       "use strict";
75875       init_debounce();
75876       init_src5();
75877       init_modes2();
75878       init_presets();
75879       init_localizer();
75880       init_svg();
75881       init_tooltip();
75882     }
75883   });
75884
75885   // modules/ui/tools/notes.js
75886   var notes_exports2 = {};
75887   __export(notes_exports2, {
75888     uiToolNotes: () => uiToolNotes
75889   });
75890   function uiToolNotes(context) {
75891     var tool = {
75892       id: "notes",
75893       label: _t.append("modes.add_note.label")
75894     };
75895     var mode = modeAddNote(context);
75896     function enabled() {
75897       return notesEnabled() && notesEditable();
75898     }
75899     function notesEnabled() {
75900       var noteLayer = context.layers().layer("notes");
75901       return noteLayer && noteLayer.enabled();
75902     }
75903     function notesEditable() {
75904       var mode2 = context.mode();
75905       return context.map().notesEditable() && mode2 && mode2.id !== "save";
75906     }
75907     context.keybinding().on(mode.key, function() {
75908       if (!enabled()) return;
75909       if (mode.id === context.mode().id) {
75910         context.enter(modeBrowse(context));
75911       } else {
75912         context.enter(mode);
75913       }
75914     });
75915     tool.render = function(selection2) {
75916       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
75917       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
75918       context.on("enter.notes", update);
75919       update();
75920       function update() {
75921         var showNotes = notesEnabled();
75922         var data = showNotes ? [mode] : [];
75923         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
75924           return d2.id;
75925         });
75926         buttons.exit().remove();
75927         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
75928           return d2.id + " add-button bar-button";
75929         }).on("click.notes", function(d3_event, d2) {
75930           if (!enabled()) return;
75931           var currMode = context.mode().id;
75932           if (/^draw/.test(currMode)) return;
75933           if (d2.id === currMode) {
75934             context.enter(modeBrowse(context));
75935           } else {
75936             context.enter(d2);
75937           }
75938         }).call(
75939           uiTooltip().placement("bottom").title(function(d2) {
75940             return d2.description;
75941           }).keys(function(d2) {
75942             return [d2.key];
75943           }).scrollContainer(context.container().select(".top-toolbar"))
75944         );
75945         buttonsEnter.each(function(d2) {
75946           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
75947         });
75948         if (buttons.enter().size() || buttons.exit().size()) {
75949           context.ui().checkOverflow(".top-toolbar", true);
75950         }
75951         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
75952           return !enabled();
75953         }).attr("aria-disabled", function() {
75954           return !enabled();
75955         }).classed("active", function(d2) {
75956           return context.mode() && context.mode().button === d2.button;
75957         }).attr("aria-pressed", function(d2) {
75958           return context.mode() && context.mode().button === d2.button;
75959         });
75960       }
75961     };
75962     tool.uninstall = function() {
75963       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
75964       context.map().on("move.notes", null).on("drawn.notes", null);
75965     };
75966     return tool;
75967   }
75968   var init_notes2 = __esm({
75969     "modules/ui/tools/notes.js"() {
75970       "use strict";
75971       init_debounce();
75972       init_src5();
75973       init_modes2();
75974       init_localizer();
75975       init_svg();
75976       init_tooltip();
75977     }
75978   });
75979
75980   // modules/ui/tools/save.js
75981   var save_exports = {};
75982   __export(save_exports, {
75983     uiToolSave: () => uiToolSave
75984   });
75985   function uiToolSave(context) {
75986     var tool = {
75987       id: "save",
75988       label: _t.append("save.title")
75989     };
75990     var button = null;
75991     var tooltipBehavior = null;
75992     var history = context.history();
75993     var key = uiCmd("\u2318S");
75994     var _numChanges = 0;
75995     function isSaving() {
75996       var mode = context.mode();
75997       return mode && mode.id === "save";
75998     }
75999     function isDisabled() {
76000       return _numChanges === 0 || isSaving();
76001     }
76002     function save(d3_event) {
76003       d3_event.preventDefault();
76004       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
76005         context.enter(modeSave(context));
76006       }
76007     }
76008     function bgColor(numChanges) {
76009       var step;
76010       if (numChanges === 0) {
76011         return null;
76012       } else if (numChanges <= 50) {
76013         step = numChanges / 50;
76014         return rgb_default("#fff", "#ff8")(step);
76015       } else {
76016         step = Math.min((numChanges - 50) / 50, 1);
76017         return rgb_default("#ff8", "#f88")(step);
76018       }
76019     }
76020     function updateCount() {
76021       var val = history.difference().summary().length;
76022       if (val === _numChanges) return;
76023       _numChanges = val;
76024       if (tooltipBehavior) {
76025         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
76026       }
76027       if (button) {
76028         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
76029         button.select("span.count").text(_numChanges);
76030       }
76031     }
76032     tool.render = function(selection2) {
76033       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
76034       var lastPointerUpType;
76035       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
76036         lastPointerUpType = d3_event.pointerType;
76037       }).on("click", function(d3_event) {
76038         save(d3_event);
76039         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76040           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
76041         }
76042         lastPointerUpType = null;
76043       }).call(tooltipBehavior);
76044       button.call(svgIcon("#iD-icon-save"));
76045       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
76046       updateCount();
76047       context.keybinding().on(key, save, true);
76048       context.history().on("change.save", updateCount);
76049       context.on("enter.save", function() {
76050         if (button) {
76051           button.classed("disabled", isDisabled());
76052           if (isSaving()) {
76053             button.call(tooltipBehavior.hide);
76054           }
76055         }
76056       });
76057     };
76058     tool.uninstall = function() {
76059       context.keybinding().off(key, true);
76060       context.history().on("change.save", null);
76061       context.on("enter.save", null);
76062       button = null;
76063       tooltipBehavior = null;
76064     };
76065     return tool;
76066   }
76067   var init_save = __esm({
76068     "modules/ui/tools/save.js"() {
76069       "use strict";
76070       init_src8();
76071       init_localizer();
76072       init_modes2();
76073       init_svg();
76074       init_cmd();
76075       init_tooltip();
76076     }
76077   });
76078
76079   // modules/ui/tools/sidebar_toggle.js
76080   var sidebar_toggle_exports = {};
76081   __export(sidebar_toggle_exports, {
76082     uiToolSidebarToggle: () => uiToolSidebarToggle
76083   });
76084   function uiToolSidebarToggle(context) {
76085     var tool = {
76086       id: "sidebar_toggle",
76087       label: _t.append("toolbar.inspect")
76088     };
76089     tool.render = function(selection2) {
76090       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
76091         context.ui().sidebar.toggle();
76092       }).call(
76093         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
76094       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
76095     };
76096     return tool;
76097   }
76098   var init_sidebar_toggle = __esm({
76099     "modules/ui/tools/sidebar_toggle.js"() {
76100       "use strict";
76101       init_localizer();
76102       init_svg();
76103       init_tooltip();
76104     }
76105   });
76106
76107   // modules/ui/tools/undo_redo.js
76108   var undo_redo_exports = {};
76109   __export(undo_redo_exports, {
76110     uiToolUndoRedo: () => uiToolUndoRedo
76111   });
76112   function uiToolUndoRedo(context) {
76113     var tool = {
76114       id: "undo_redo",
76115       label: _t.append("toolbar.undo_redo")
76116     };
76117     var commands = [{
76118       id: "undo",
76119       cmd: uiCmd("\u2318Z"),
76120       action: function() {
76121         context.undo();
76122       },
76123       annotation: function() {
76124         return context.history().undoAnnotation();
76125       },
76126       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
76127     }, {
76128       id: "redo",
76129       cmd: uiCmd("\u2318\u21E7Z"),
76130       action: function() {
76131         context.redo();
76132       },
76133       annotation: function() {
76134         return context.history().redoAnnotation();
76135       },
76136       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
76137     }];
76138     function editable() {
76139       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
76140         true
76141         /* ignore min zoom */
76142       );
76143     }
76144     tool.render = function(selection2) {
76145       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
76146         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
76147       }).keys(function(d2) {
76148         return [d2.cmd];
76149       }).scrollContainer(context.container().select(".top-toolbar"));
76150       var lastPointerUpType;
76151       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
76152         return "disabled " + d2.id + "-button bar-button";
76153       }).on("pointerup", function(d3_event) {
76154         lastPointerUpType = d3_event.pointerType;
76155       }).on("click", function(d3_event, d2) {
76156         d3_event.preventDefault();
76157         var annotation = d2.annotation();
76158         if (editable() && annotation) {
76159           d2.action();
76160         }
76161         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
76162           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
76163           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
76164         }
76165         lastPointerUpType = null;
76166       }).call(tooltipBehavior);
76167       buttons.each(function(d2) {
76168         select_default2(this).call(svgIcon("#" + d2.icon));
76169       });
76170       context.keybinding().on(commands[0].cmd, function(d3_event) {
76171         d3_event.preventDefault();
76172         if (editable()) commands[0].action();
76173       }).on(commands[1].cmd, function(d3_event) {
76174         d3_event.preventDefault();
76175         if (editable()) commands[1].action();
76176       });
76177       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76178       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
76179       context.history().on("change.undo_redo", function(difference2) {
76180         if (difference2) update();
76181       });
76182       context.on("enter.undo_redo", update);
76183       function update() {
76184         buttons.classed("disabled", function(d2) {
76185           return !editable() || !d2.annotation();
76186         }).each(function() {
76187           var selection3 = select_default2(this);
76188           if (!selection3.select(".tooltip.in").empty()) {
76189             selection3.call(tooltipBehavior.updateContent);
76190           }
76191         });
76192       }
76193     };
76194     tool.uninstall = function() {
76195       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
76196       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
76197       context.history().on("change.undo_redo", null);
76198       context.on("enter.undo_redo", null);
76199     };
76200     return tool;
76201   }
76202   var init_undo_redo = __esm({
76203     "modules/ui/tools/undo_redo.js"() {
76204       "use strict";
76205       init_debounce();
76206       init_src5();
76207       init_localizer();
76208       init_svg();
76209       init_cmd();
76210       init_tooltip();
76211     }
76212   });
76213
76214   // modules/ui/tools/index.js
76215   var tools_exports = {};
76216   __export(tools_exports, {
76217     uiToolDrawModes: () => uiToolDrawModes,
76218     uiToolNotes: () => uiToolNotes,
76219     uiToolSave: () => uiToolSave,
76220     uiToolSidebarToggle: () => uiToolSidebarToggle,
76221     uiToolUndoRedo: () => uiToolUndoRedo
76222   });
76223   var init_tools = __esm({
76224     "modules/ui/tools/index.js"() {
76225       "use strict";
76226       init_modes();
76227       init_notes2();
76228       init_save();
76229       init_sidebar_toggle();
76230       init_undo_redo();
76231     }
76232   });
76233
76234   // modules/ui/top_toolbar.js
76235   var top_toolbar_exports = {};
76236   __export(top_toolbar_exports, {
76237     uiTopToolbar: () => uiTopToolbar
76238   });
76239   function uiTopToolbar(context) {
76240     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
76241     function notesEnabled() {
76242       var noteLayer = context.layers().layer("notes");
76243       return noteLayer && noteLayer.enabled();
76244     }
76245     function topToolbar(bar) {
76246       bar.on("wheel.topToolbar", function(d3_event) {
76247         if (!d3_event.deltaX) {
76248           bar.node().scrollLeft += d3_event.deltaY;
76249         }
76250       });
76251       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
76252       context.layers().on("change.topToolbar", debouncedUpdate);
76253       update();
76254       function update() {
76255         var tools = [
76256           sidebarToggle,
76257           "spacer",
76258           modes
76259         ];
76260         tools.push("spacer");
76261         if (notesEnabled()) {
76262           tools = tools.concat([notes, "spacer"]);
76263         }
76264         tools = tools.concat([undoRedo, save]);
76265         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
76266           return d2.id || d2;
76267         });
76268         toolbarItems.exit().each(function(d2) {
76269           if (d2.uninstall) {
76270             d2.uninstall();
76271           }
76272         }).remove();
76273         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
76274           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
76275           if (d2.klass) classes += " " + d2.klass;
76276           return classes;
76277         });
76278         var actionableItems = itemsEnter.filter(function(d2) {
76279           return d2 !== "spacer";
76280         });
76281         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
76282           select_default2(this).call(d2.render, bar);
76283         });
76284         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
76285           d2.label(select_default2(this));
76286         });
76287       }
76288     }
76289     return topToolbar;
76290   }
76291   var init_top_toolbar = __esm({
76292     "modules/ui/top_toolbar.js"() {
76293       "use strict";
76294       init_src5();
76295       init_debounce();
76296       init_tools();
76297     }
76298   });
76299
76300   // modules/ui/version.js
76301   var version_exports = {};
76302   __export(version_exports, {
76303     uiVersion: () => uiVersion
76304   });
76305   function uiVersion(context) {
76306     var currVersion = context.version;
76307     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
76308     if (sawVersion === null && matchedVersion !== null) {
76309       if (corePreferences("sawVersion")) {
76310         isNewUser = false;
76311         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
76312       } else {
76313         isNewUser = true;
76314         isNewVersion = true;
76315       }
76316       corePreferences("sawVersion", currVersion);
76317       sawVersion = currVersion;
76318     }
76319     return function(selection2) {
76320       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
76321       if (isNewVersion && !isNewUser) {
76322         selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", `https://github.com/openstreetmap/iD/releases/tag/v${currVersion}`).call(svgIcon("#maki-gift")).call(
76323           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
76324         );
76325       }
76326     };
76327   }
76328   var sawVersion, isNewVersion, isNewUser;
76329   var init_version = __esm({
76330     "modules/ui/version.js"() {
76331       "use strict";
76332       init_preferences();
76333       init_localizer();
76334       init_icon();
76335       init_tooltip();
76336       sawVersion = null;
76337       isNewVersion = false;
76338       isNewUser = false;
76339     }
76340   });
76341
76342   // modules/ui/zoom.js
76343   var zoom_exports = {};
76344   __export(zoom_exports, {
76345     uiZoom: () => uiZoom
76346   });
76347   function uiZoom(context) {
76348     var zooms = [{
76349       id: "zoom-in",
76350       icon: "iD-icon-plus",
76351       title: _t.append("zoom.in"),
76352       action: zoomIn,
76353       disabled: function() {
76354         return !context.map().canZoomIn();
76355       },
76356       disabledTitle: _t.append("zoom.disabled.in"),
76357       key: "+"
76358     }, {
76359       id: "zoom-out",
76360       icon: "iD-icon-minus",
76361       title: _t.append("zoom.out"),
76362       action: zoomOut,
76363       disabled: function() {
76364         return !context.map().canZoomOut();
76365       },
76366       disabledTitle: _t.append("zoom.disabled.out"),
76367       key: "-"
76368     }];
76369     function zoomIn(d3_event) {
76370       if (d3_event.shiftKey) return;
76371       d3_event.preventDefault();
76372       context.map().zoomIn();
76373     }
76374     function zoomOut(d3_event) {
76375       if (d3_event.shiftKey) return;
76376       d3_event.preventDefault();
76377       context.map().zoomOut();
76378     }
76379     function zoomInFurther(d3_event) {
76380       if (d3_event.shiftKey) return;
76381       d3_event.preventDefault();
76382       context.map().zoomInFurther();
76383     }
76384     function zoomOutFurther(d3_event) {
76385       if (d3_event.shiftKey) return;
76386       d3_event.preventDefault();
76387       context.map().zoomOutFurther();
76388     }
76389     return function(selection2) {
76390       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
76391         if (d2.disabled()) {
76392           return d2.disabledTitle;
76393         }
76394         return d2.title;
76395       }).keys(function(d2) {
76396         return [d2.key];
76397       });
76398       var lastPointerUpType;
76399       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
76400         return d2.id;
76401       }).on("pointerup.editor", function(d3_event) {
76402         lastPointerUpType = d3_event.pointerType;
76403       }).on("click.editor", function(d3_event, d2) {
76404         if (!d2.disabled()) {
76405           d2.action(d3_event);
76406         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
76407           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
76408         }
76409         lastPointerUpType = null;
76410       }).call(tooltipBehavior);
76411       buttons.each(function(d2) {
76412         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
76413       });
76414       utilKeybinding.plusKeys.forEach(function(key) {
76415         context.keybinding().on([key], zoomIn);
76416         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
76417       });
76418       utilKeybinding.minusKeys.forEach(function(key) {
76419         context.keybinding().on([key], zoomOut);
76420         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
76421       });
76422       function updateButtonStates() {
76423         buttons.classed("disabled", function(d2) {
76424           return d2.disabled();
76425         }).each(function() {
76426           var selection3 = select_default2(this);
76427           if (!selection3.select(".tooltip.in").empty()) {
76428             selection3.call(tooltipBehavior.updateContent);
76429           }
76430         });
76431       }
76432       updateButtonStates();
76433       context.map().on("move.uiZoom", updateButtonStates);
76434     };
76435   }
76436   var init_zoom3 = __esm({
76437     "modules/ui/zoom.js"() {
76438       "use strict";
76439       init_src5();
76440       init_localizer();
76441       init_icon();
76442       init_cmd();
76443       init_tooltip();
76444       init_keybinding();
76445     }
76446   });
76447
76448   // modules/ui/zoom_to_selection.js
76449   var zoom_to_selection_exports = {};
76450   __export(zoom_to_selection_exports, {
76451     uiZoomToSelection: () => uiZoomToSelection
76452   });
76453   function uiZoomToSelection(context) {
76454     function isDisabled() {
76455       var mode = context.mode();
76456       return !mode || !mode.zoomToSelected;
76457     }
76458     var _lastPointerUpType;
76459     function pointerup(d3_event) {
76460       _lastPointerUpType = d3_event.pointerType;
76461     }
76462     function click(d3_event) {
76463       d3_event.preventDefault();
76464       if (isDisabled()) {
76465         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
76466           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
76467         }
76468       } else {
76469         var mode = context.mode();
76470         if (mode && mode.zoomToSelected) {
76471           mode.zoomToSelected();
76472         }
76473       }
76474       _lastPointerUpType = null;
76475     }
76476     return function(selection2) {
76477       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
76478         if (isDisabled()) {
76479           return _t.append("inspector.zoom_to.no_selection");
76480         }
76481         return _t.append("inspector.zoom_to.title");
76482       }).keys([_t("inspector.zoom_to.key")]);
76483       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
76484       function setEnabledState() {
76485         button.classed("disabled", isDisabled());
76486         if (!button.select(".tooltip.in").empty()) {
76487           button.call(tooltipBehavior.updateContent);
76488         }
76489       }
76490       context.on("enter.uiZoomToSelection", setEnabledState);
76491       setEnabledState();
76492     };
76493   }
76494   var init_zoom_to_selection = __esm({
76495     "modules/ui/zoom_to_selection.js"() {
76496       "use strict";
76497       init_localizer();
76498       init_tooltip();
76499       init_icon();
76500     }
76501   });
76502
76503   // modules/ui/pane.js
76504   var pane_exports = {};
76505   __export(pane_exports, {
76506     uiPane: () => uiPane
76507   });
76508   function uiPane(id2, context) {
76509     var _key;
76510     var _label = "";
76511     var _description = "";
76512     var _iconName = "";
76513     var _sections;
76514     var _paneSelection = select_default2(null);
76515     var _paneTooltip;
76516     var pane = {
76517       id: id2
76518     };
76519     pane.label = function(val) {
76520       if (!arguments.length) return _label;
76521       _label = val;
76522       return pane;
76523     };
76524     pane.key = function(val) {
76525       if (!arguments.length) return _key;
76526       _key = val;
76527       return pane;
76528     };
76529     pane.description = function(val) {
76530       if (!arguments.length) return _description;
76531       _description = val;
76532       return pane;
76533     };
76534     pane.iconName = function(val) {
76535       if (!arguments.length) return _iconName;
76536       _iconName = val;
76537       return pane;
76538     };
76539     pane.sections = function(val) {
76540       if (!arguments.length) return _sections;
76541       _sections = val;
76542       return pane;
76543     };
76544     pane.selection = function() {
76545       return _paneSelection;
76546     };
76547     function hidePane() {
76548       context.ui().togglePanes();
76549     }
76550     pane.togglePane = function(d3_event) {
76551       if (d3_event) d3_event.preventDefault();
76552       _paneTooltip.hide();
76553       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
76554     };
76555     pane.renderToggleButton = function(selection2) {
76556       if (!_paneTooltip) {
76557         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
76558       }
76559       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
76560     };
76561     pane.renderContent = function(selection2) {
76562       if (_sections) {
76563         _sections.forEach(function(section) {
76564           selection2.call(section.render);
76565         });
76566       }
76567     };
76568     pane.renderPane = function(selection2) {
76569       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
76570       var heading = _paneSelection.append("div").attr("class", "pane-heading");
76571       heading.append("h2").text("").call(_label);
76572       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
76573       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
76574       if (_key) {
76575         context.keybinding().on(_key, pane.togglePane);
76576       }
76577     };
76578     return pane;
76579   }
76580   var init_pane = __esm({
76581     "modules/ui/pane.js"() {
76582       "use strict";
76583       init_src5();
76584       init_icon();
76585       init_localizer();
76586       init_tooltip();
76587     }
76588   });
76589
76590   // modules/ui/sections/background_display_options.js
76591   var background_display_options_exports = {};
76592   __export(background_display_options_exports, {
76593     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions
76594   });
76595   function uiSectionBackgroundDisplayOptions(context) {
76596     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
76597     var _storedOpacity = corePreferences("background-opacity");
76598     var _minVal = 0;
76599     var _maxVal = 3;
76600     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
76601     var _options = {
76602       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
76603       contrast: 1,
76604       saturation: 1,
76605       sharpness: 1
76606     };
76607     function updateValue(d2, val) {
76608       val = clamp_default(val, _minVal, _maxVal);
76609       _options[d2] = val;
76610       context.background()[d2](val);
76611       if (d2 === "brightness") {
76612         corePreferences("background-opacity", val);
76613       }
76614       section.reRender();
76615     }
76616     function renderDisclosureContent(selection2) {
76617       var container = selection2.selectAll(".display-options-container").data([0]);
76618       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
76619       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
76620         return "display-control display-control-" + d2;
76621       });
76622       slidersEnter.html(function(d2) {
76623         return _t.html("background." + d2);
76624       }).append("span").attr("class", function(d2) {
76625         return "display-option-value display-option-value-" + d2;
76626       });
76627       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
76628       sildersControlEnter.append("input").attr("class", function(d2) {
76629         return "display-option-input display-option-input-" + d2;
76630       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.01").on("input", function(d3_event, d2) {
76631         var val = select_default2(this).property("value");
76632         if (!val && d3_event && d3_event.target) {
76633           val = d3_event.target.value;
76634         }
76635         updateValue(d2, val);
76636       });
76637       sildersControlEnter.append("button").attr("title", function(d2) {
76638         return `${_t("background.reset")} ${_t("background." + d2)}`;
76639       }).attr("class", function(d2) {
76640         return "display-option-reset display-option-reset-" + d2;
76641       }).on("click", function(d3_event, d2) {
76642         if (d3_event.button !== 0) return;
76643         updateValue(d2, 1);
76644       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
76645       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
76646         d3_event.preventDefault();
76647         for (var i3 = 0; i3 < _sliders.length; i3++) {
76648           updateValue(_sliders[i3], 1);
76649         }
76650       });
76651       container = containerEnter.merge(container);
76652       container.selectAll(".display-option-input").property("value", function(d2) {
76653         return _options[d2];
76654       });
76655       container.selectAll(".display-option-value").text(function(d2) {
76656         return Math.floor(_options[d2] * 100) + "%";
76657       });
76658       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
76659         return _options[d2] === 1;
76660       });
76661       if (containerEnter.size() && _options.brightness !== 1) {
76662         context.background().brightness(_options.brightness);
76663       }
76664     }
76665     return section;
76666   }
76667   var init_background_display_options = __esm({
76668     "modules/ui/sections/background_display_options.js"() {
76669       "use strict";
76670       init_src5();
76671       init_lodash();
76672       init_preferences();
76673       init_localizer();
76674       init_icon();
76675       init_section();
76676     }
76677   });
76678
76679   // modules/ui/settings/custom_background.js
76680   var custom_background_exports = {};
76681   __export(custom_background_exports, {
76682     uiSettingsCustomBackground: () => uiSettingsCustomBackground
76683   });
76684   function uiSettingsCustomBackground() {
76685     var dispatch14 = dispatch_default("change");
76686     function render(selection2) {
76687       var _origSettings = {
76688         template: corePreferences("background-custom-template")
76689       };
76690       var _currSettings = {
76691         template: corePreferences("background-custom-template")
76692       };
76693       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
76694       var modal = uiConfirm(selection2).okButton();
76695       modal.classed("settings-modal settings-custom-background", true);
76696       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
76697       var textSection = modal.select(".modal-section.message-text");
76698       var instructions = `${_t.html("settings.custom_background.instructions.info")}
76699
76700 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
76701 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
76702 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
76703 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
76704 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
76705
76706 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
76707 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
76708 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
76709 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
76710 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
76711 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
76712
76713 #### ${_t.html("settings.custom_background.instructions.example")}
76714 \`${example}\``;
76715       textSection.append("div").attr("class", "instructions-template").html(k(instructions));
76716       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
76717       var buttonSection = modal.select(".modal-section.buttons");
76718       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
76719       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
76720       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
76721       function isSaveDisabled() {
76722         return null;
76723       }
76724       function clickCancel() {
76725         textSection.select(".field-template").property("value", _origSettings.template);
76726         corePreferences("background-custom-template", _origSettings.template);
76727         this.blur();
76728         modal.close();
76729       }
76730       function clickSave() {
76731         _currSettings.template = textSection.select(".field-template").property("value");
76732         corePreferences("background-custom-template", _currSettings.template);
76733         this.blur();
76734         modal.close();
76735         dispatch14.call("change", this, _currSettings);
76736       }
76737     }
76738     return utilRebind(render, dispatch14, "on");
76739   }
76740   var init_custom_background = __esm({
76741     "modules/ui/settings/custom_background.js"() {
76742       "use strict";
76743       init_src4();
76744       init_marked_esm();
76745       init_preferences();
76746       init_localizer();
76747       init_confirm();
76748       init_util();
76749     }
76750   });
76751
76752   // modules/ui/sections/background_list.js
76753   var background_list_exports = {};
76754   __export(background_list_exports, {
76755     uiSectionBackgroundList: () => uiSectionBackgroundList
76756   });
76757   function uiSectionBackgroundList(context) {
76758     var _backgroundList = select_default2(null);
76759     var _customSource = context.background().findSource("custom");
76760     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
76761     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
76762     function previousBackgroundID() {
76763       return corePreferences("background-last-used-toggle");
76764     }
76765     function renderDisclosureContent(selection2) {
76766       var container = selection2.selectAll(".layer-background-list").data([0]);
76767       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
76768       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
76769       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
76770         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
76771       );
76772       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76773         d3_event.preventDefault();
76774         uiMapInMap.toggle();
76775       });
76776       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
76777       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
76778         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
76779       );
76780       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76781         d3_event.preventDefault();
76782         context.ui().info.toggle("background");
76783       });
76784       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
76785       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
76786         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
76787       );
76788       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76789         d3_event.preventDefault();
76790         context.ui().info.toggle("location");
76791       });
76792       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
76793       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"));
76794       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
76795         chooseBackground(d2);
76796       }, function(d2) {
76797         return !d2.isHidden() && !d2.overlay;
76798       });
76799     }
76800     function setTooltips(selection2) {
76801       selection2.each(function(d2, i3, nodes) {
76802         var item = select_default2(this).select("label");
76803         var span = item.select("span");
76804         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
76805         var hasDescription = d2.hasDescription();
76806         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
76807         item.call(uiTooltip().destroyAny);
76808         if (d2.id === previousBackgroundID()) {
76809           item.call(
76810             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
76811           );
76812         } else if (hasDescription || isOverflowing) {
76813           item.call(
76814             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
76815           );
76816         }
76817       });
76818     }
76819     function drawListItems(layerList, type2, change, filter2) {
76820       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a4, b3) {
76821         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
76822       });
76823       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
76824         return d2.id + "---" + i3;
76825       });
76826       layerLinks.exit().remove();
76827       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
76828         return d2.id === "custom";
76829       }).classed("best", function(d2) {
76830         return d2.best();
76831       });
76832       var label = enter.append("label");
76833       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
76834         return d2.id;
76835       }).on("change", change);
76836       label.append("span").each(function(d2) {
76837         d2.label()(select_default2(this));
76838       });
76839       enter.filter(function(d2) {
76840         return d2.id === "custom";
76841       }).append("button").attr("class", "layer-browse").call(
76842         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76843       ).on("click", function(d3_event) {
76844         d3_event.preventDefault();
76845         editCustom();
76846       }).call(svgIcon("#iD-icon-more"));
76847       enter.filter(function(d2) {
76848         return d2.best();
76849       }).append("div").attr("class", "best").call(
76850         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76851       ).append("span").text("\u2605");
76852       layerList.call(updateLayerSelections);
76853     }
76854     function updateLayerSelections(selection2) {
76855       function active(d2) {
76856         return context.background().showsLayer(d2);
76857       }
76858       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
76859         return d2.id === previousBackgroundID();
76860       }).call(setTooltips).selectAll("input").property("checked", active);
76861     }
76862     function chooseBackground(d2) {
76863       if (d2.id === "custom" && !d2.template()) {
76864         return editCustom();
76865       }
76866       var previousBackground = context.background().baseLayerSource();
76867       corePreferences("background-last-used-toggle", previousBackground.id);
76868       corePreferences("background-last-used", d2.id);
76869       context.background().baseLayerSource(d2);
76870     }
76871     function customChanged(d2) {
76872       if (d2 && d2.template) {
76873         _customSource.template(d2.template);
76874         chooseBackground(_customSource);
76875       } else {
76876         _customSource.template("");
76877         chooseBackground(context.background().findSource("none"));
76878       }
76879     }
76880     function editCustom() {
76881       context.container().call(_settingsCustomBackground);
76882     }
76883     context.background().on("change.background_list", function() {
76884       _backgroundList.call(updateLayerSelections);
76885     });
76886     context.map().on(
76887       "move.background_list",
76888       debounce_default(function() {
76889         window.requestIdleCallback(section.reRender);
76890       }, 1e3)
76891     );
76892     return section;
76893   }
76894   var init_background_list = __esm({
76895     "modules/ui/sections/background_list.js"() {
76896       "use strict";
76897       init_debounce();
76898       init_src();
76899       init_src5();
76900       init_preferences();
76901       init_localizer();
76902       init_tooltip();
76903       init_icon();
76904       init_cmd();
76905       init_custom_background();
76906       init_map_in_map();
76907       init_section();
76908     }
76909   });
76910
76911   // modules/ui/sections/background_offset.js
76912   var background_offset_exports = {};
76913   __export(background_offset_exports, {
76914     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset
76915   });
76916   function uiSectionBackgroundOffset(context) {
76917     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76918     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
76919     var _directions = [
76920       ["top", [0, -0.5]],
76921       ["left", [-0.5, 0]],
76922       ["right", [0.5, 0]],
76923       ["bottom", [0, 0.5]]
76924     ];
76925     function updateValue() {
76926       var meters = geoOffsetToMeters(context.background().offset());
76927       var x2 = +meters[0].toFixed(2);
76928       var y2 = +meters[1].toFixed(2);
76929       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
76930       context.container().selectAll(".nudge-reset").classed("disabled", function() {
76931         return x2 === 0 && y2 === 0;
76932       });
76933     }
76934     function resetOffset() {
76935       context.background().offset([0, 0]);
76936       updateValue();
76937     }
76938     function nudge(d2) {
76939       context.background().nudge(d2, context.map().zoom());
76940       updateValue();
76941     }
76942     function inputOffset() {
76943       var input = select_default2(this);
76944       var d2 = input.node().value;
76945       if (d2 === "") return resetOffset();
76946       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
76947         return !isNaN(n3) && n3;
76948       });
76949       if (d2.length !== 2 || !d2[0] || !d2[1]) {
76950         input.classed("error", true);
76951         return;
76952       }
76953       context.background().offset(geoMetersToOffset(d2));
76954       updateValue();
76955     }
76956     function dragOffset(d3_event) {
76957       if (d3_event.button !== 0) return;
76958       var origin = [d3_event.clientX, d3_event.clientY];
76959       var pointerId = d3_event.pointerId || "mouse";
76960       context.container().append("div").attr("class", "nudge-surface");
76961       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
76962       if (_pointerPrefix === "pointer") {
76963         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
76964       }
76965       function pointermove(d3_event2) {
76966         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76967         var latest = [d3_event2.clientX, d3_event2.clientY];
76968         var d2 = [
76969           -(origin[0] - latest[0]) / 4,
76970           -(origin[1] - latest[1]) / 4
76971         ];
76972         origin = latest;
76973         nudge(d2);
76974       }
76975       function pointerup(d3_event2) {
76976         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
76977         if (d3_event2.button !== 0) return;
76978         context.container().selectAll(".nudge-surface").remove();
76979         select_default2(window).on(".drag-bg-offset", null);
76980       }
76981     }
76982     function renderDisclosureContent(selection2) {
76983       var container = selection2.selectAll(".nudge-container").data([0]);
76984       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
76985       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
76986       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
76987       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
76988       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
76989       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
76990         return _t(`background.nudge.${d2[0]}`);
76991       }).attr("class", function(d2) {
76992         return d2[0] + " nudge";
76993       }).on("click", function(d3_event, d2) {
76994         nudge(d2[1]);
76995       });
76996       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
76997         d3_event.preventDefault();
76998         resetOffset();
76999       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
77000       updateValue();
77001     }
77002     context.background().on("change.backgroundOffset-update", updateValue);
77003     return section;
77004   }
77005   var init_background_offset = __esm({
77006     "modules/ui/sections/background_offset.js"() {
77007       "use strict";
77008       init_src5();
77009       init_localizer();
77010       init_geo2();
77011       init_icon();
77012       init_section();
77013     }
77014   });
77015
77016   // modules/ui/sections/overlay_list.js
77017   var overlay_list_exports = {};
77018   __export(overlay_list_exports, {
77019     uiSectionOverlayList: () => uiSectionOverlayList
77020   });
77021   function uiSectionOverlayList(context) {
77022     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
77023     var _overlayList = select_default2(null);
77024     function setTooltips(selection2) {
77025       selection2.each(function(d2, i3, nodes) {
77026         var item = select_default2(this).select("label");
77027         var span = item.select("span");
77028         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
77029         var description = d2.description();
77030         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
77031         item.call(uiTooltip().destroyAny);
77032         if (description || isOverflowing) {
77033           item.call(
77034             uiTooltip().placement(placement).title(() => description || d2.name())
77035           );
77036         }
77037       });
77038     }
77039     function updateLayerSelections(selection2) {
77040       function active(d2) {
77041         return context.background().showsLayer(d2);
77042       }
77043       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
77044     }
77045     function chooseOverlay(d3_event, d2) {
77046       d3_event.preventDefault();
77047       context.background().toggleOverlayLayer(d2);
77048       _overlayList.call(updateLayerSelections);
77049       document.activeElement.blur();
77050     }
77051     function drawListItems(layerList, type2, change, filter2) {
77052       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
77053       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
77054         return d2.name();
77055       });
77056       layerLinks.exit().remove();
77057       var enter = layerLinks.enter().append("li");
77058       var label = enter.append("label");
77059       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
77060       label.append("span").each(function(d2) {
77061         d2.label()(select_default2(this));
77062       });
77063       layerList.selectAll("li").sort(sortSources);
77064       layerList.call(updateLayerSelections);
77065       function sortSources(a4, b3) {
77066         return a4.best() && !b3.best() ? -1 : b3.best() && !a4.best() ? 1 : descending(a4.area(), b3.area()) || ascending(a4.name(), b3.name()) || 0;
77067       }
77068     }
77069     function renderDisclosureContent(selection2) {
77070       var container = selection2.selectAll(".layer-overlay-list").data([0]);
77071       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
77072       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
77073         return !d2.isHidden() && d2.overlay;
77074       });
77075     }
77076     context.map().on(
77077       "move.overlay_list",
77078       debounce_default(function() {
77079         window.requestIdleCallback(section.reRender);
77080       }, 1e3)
77081     );
77082     return section;
77083   }
77084   var init_overlay_list = __esm({
77085     "modules/ui/sections/overlay_list.js"() {
77086       "use strict";
77087       init_debounce();
77088       init_src();
77089       init_src5();
77090       init_localizer();
77091       init_tooltip();
77092       init_section();
77093     }
77094   });
77095
77096   // modules/ui/panes/background.js
77097   var background_exports3 = {};
77098   __export(background_exports3, {
77099     uiPaneBackground: () => uiPaneBackground
77100   });
77101   function uiPaneBackground(context) {
77102     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
77103       uiSectionBackgroundList(context),
77104       uiSectionOverlayList(context),
77105       uiSectionBackgroundDisplayOptions(context),
77106       uiSectionBackgroundOffset(context)
77107     ]);
77108     return backgroundPane;
77109   }
77110   var init_background3 = __esm({
77111     "modules/ui/panes/background.js"() {
77112       "use strict";
77113       init_localizer();
77114       init_pane();
77115       init_background_display_options();
77116       init_background_list();
77117       init_background_offset();
77118       init_overlay_list();
77119     }
77120   });
77121
77122   // modules/ui/panes/help.js
77123   var help_exports = {};
77124   __export(help_exports, {
77125     uiPaneHelp: () => uiPaneHelp
77126   });
77127   function uiPaneHelp(context) {
77128     var docKeys = [
77129       ["help", [
77130         "welcome",
77131         "open_data_h",
77132         "open_data",
77133         "before_start_h",
77134         "before_start",
77135         "open_source_h",
77136         "open_source",
77137         "open_source_attribution",
77138         "open_source_help"
77139       ]],
77140       ["overview", [
77141         "navigation_h",
77142         "navigation_drag",
77143         "navigation_zoom",
77144         "features_h",
77145         "features",
77146         "nodes_ways"
77147       ]],
77148       ["editing", [
77149         "select_h",
77150         "select_left_click",
77151         "select_right_click",
77152         "select_space",
77153         "multiselect_h",
77154         "multiselect",
77155         "multiselect_shift_click",
77156         "multiselect_lasso",
77157         "undo_redo_h",
77158         "undo_redo",
77159         "save_h",
77160         "save",
77161         "save_validation",
77162         "upload_h",
77163         "upload",
77164         "backups_h",
77165         "backups",
77166         "keyboard_h",
77167         "keyboard"
77168       ]],
77169       ["feature_editor", [
77170         "intro",
77171         "definitions",
77172         "type_h",
77173         "type",
77174         "type_picker",
77175         "fields_h",
77176         "fields_all_fields",
77177         "fields_example",
77178         "fields_add_field",
77179         "tags_h",
77180         "tags_all_tags",
77181         "tags_resources"
77182       ]],
77183       ["points", [
77184         "intro",
77185         "add_point_h",
77186         "add_point",
77187         "add_point_finish",
77188         "move_point_h",
77189         "move_point",
77190         "delete_point_h",
77191         "delete_point",
77192         "delete_point_command"
77193       ]],
77194       ["lines", [
77195         "intro",
77196         "add_line_h",
77197         "add_line",
77198         "add_line_draw",
77199         "add_line_continue",
77200         "add_line_finish",
77201         "modify_line_h",
77202         "modify_line_dragnode",
77203         "modify_line_addnode",
77204         "connect_line_h",
77205         "connect_line",
77206         "connect_line_display",
77207         "connect_line_drag",
77208         "connect_line_tag",
77209         "disconnect_line_h",
77210         "disconnect_line_command",
77211         "move_line_h",
77212         "move_line_command",
77213         "move_line_connected",
77214         "delete_line_h",
77215         "delete_line",
77216         "delete_line_command"
77217       ]],
77218       ["areas", [
77219         "intro",
77220         "point_or_area_h",
77221         "point_or_area",
77222         "add_area_h",
77223         "add_area_command",
77224         "add_area_draw",
77225         "add_area_continue",
77226         "add_area_finish",
77227         "square_area_h",
77228         "square_area_command",
77229         "modify_area_h",
77230         "modify_area_dragnode",
77231         "modify_area_addnode",
77232         "delete_area_h",
77233         "delete_area",
77234         "delete_area_command"
77235       ]],
77236       ["relations", [
77237         "intro",
77238         "edit_relation_h",
77239         "edit_relation",
77240         "edit_relation_add",
77241         "edit_relation_delete",
77242         "maintain_relation_h",
77243         "maintain_relation",
77244         "relation_types_h",
77245         "multipolygon_h",
77246         "multipolygon",
77247         "multipolygon_create",
77248         "multipolygon_merge",
77249         "turn_restriction_h",
77250         "turn_restriction",
77251         "turn_restriction_field",
77252         "turn_restriction_editing",
77253         "route_h",
77254         "route",
77255         "route_add",
77256         "boundary_h",
77257         "boundary",
77258         "boundary_add"
77259       ]],
77260       ["operations", [
77261         "intro",
77262         "intro_2",
77263         "straighten",
77264         "orthogonalize",
77265         "circularize",
77266         "move",
77267         "rotate",
77268         "reflect",
77269         "continue",
77270         "reverse",
77271         "disconnect",
77272         "split",
77273         "extract",
77274         "merge",
77275         "delete",
77276         "downgrade",
77277         "copy_paste"
77278       ]],
77279       ["notes", [
77280         "intro",
77281         "add_note_h",
77282         "add_note",
77283         "place_note",
77284         "move_note",
77285         "update_note_h",
77286         "update_note",
77287         "save_note_h",
77288         "save_note"
77289       ]],
77290       ["imagery", [
77291         "intro",
77292         "sources_h",
77293         "choosing",
77294         "sources",
77295         "offsets_h",
77296         "offset",
77297         "offset_change"
77298       ]],
77299       ["streetlevel", [
77300         "intro",
77301         "using_h",
77302         "using",
77303         "photos",
77304         "viewer"
77305       ]],
77306       ["gps", [
77307         "intro",
77308         "survey",
77309         "using_h",
77310         "using",
77311         "tracing",
77312         "upload"
77313       ]],
77314       ["qa", [
77315         "intro",
77316         "tools_h",
77317         "tools",
77318         "issues_h",
77319         "issues"
77320       ]]
77321     ];
77322     var headings = {
77323       "help.help.open_data_h": 3,
77324       "help.help.before_start_h": 3,
77325       "help.help.open_source_h": 3,
77326       "help.overview.navigation_h": 3,
77327       "help.overview.features_h": 3,
77328       "help.editing.select_h": 3,
77329       "help.editing.multiselect_h": 3,
77330       "help.editing.undo_redo_h": 3,
77331       "help.editing.save_h": 3,
77332       "help.editing.upload_h": 3,
77333       "help.editing.backups_h": 3,
77334       "help.editing.keyboard_h": 3,
77335       "help.feature_editor.type_h": 3,
77336       "help.feature_editor.fields_h": 3,
77337       "help.feature_editor.tags_h": 3,
77338       "help.points.add_point_h": 3,
77339       "help.points.move_point_h": 3,
77340       "help.points.delete_point_h": 3,
77341       "help.lines.add_line_h": 3,
77342       "help.lines.modify_line_h": 3,
77343       "help.lines.connect_line_h": 3,
77344       "help.lines.disconnect_line_h": 3,
77345       "help.lines.move_line_h": 3,
77346       "help.lines.delete_line_h": 3,
77347       "help.areas.point_or_area_h": 3,
77348       "help.areas.add_area_h": 3,
77349       "help.areas.square_area_h": 3,
77350       "help.areas.modify_area_h": 3,
77351       "help.areas.delete_area_h": 3,
77352       "help.relations.edit_relation_h": 3,
77353       "help.relations.maintain_relation_h": 3,
77354       "help.relations.relation_types_h": 2,
77355       "help.relations.multipolygon_h": 3,
77356       "help.relations.turn_restriction_h": 3,
77357       "help.relations.route_h": 3,
77358       "help.relations.boundary_h": 3,
77359       "help.notes.add_note_h": 3,
77360       "help.notes.update_note_h": 3,
77361       "help.notes.save_note_h": 3,
77362       "help.imagery.sources_h": 3,
77363       "help.imagery.offsets_h": 3,
77364       "help.streetlevel.using_h": 3,
77365       "help.gps.using_h": 3,
77366       "help.qa.tools_h": 3,
77367       "help.qa.issues_h": 3
77368     };
77369     var docs = docKeys.map(function(key) {
77370       var helpkey = "help." + key[0];
77371       var helpPaneReplacements = { version: context.version };
77372       var text = key[1].reduce(function(all, part) {
77373         var subkey = helpkey + "." + part;
77374         var depth = headings[subkey];
77375         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
77376         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
77377       }, "");
77378       return {
77379         title: _t.html(helpkey + ".title"),
77380         content: k(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
77381       };
77382     });
77383     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
77384     helpPane.renderContent = function(content) {
77385       function clickHelp(d2, i3) {
77386         var rtl = _mainLocalizer.textDirection() === "rtl";
77387         content.property("scrollTop", 0);
77388         helpPane.selection().select(".pane-heading h2").html(d2.title);
77389         body.html(d2.content);
77390         body.selectAll("a").attr("target", "_blank");
77391         menuItems.classed("selected", function(m3) {
77392           return m3.title === d2.title;
77393         });
77394         nav.html("");
77395         if (rtl) {
77396           nav.call(drawNext).call(drawPrevious);
77397         } else {
77398           nav.call(drawPrevious).call(drawNext);
77399         }
77400         function drawNext(selection2) {
77401           if (i3 < docs.length - 1) {
77402             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
77403               d3_event.preventDefault();
77404               clickHelp(docs[i3 + 1], i3 + 1);
77405             });
77406             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
77407           }
77408         }
77409         function drawPrevious(selection2) {
77410           if (i3 > 0) {
77411             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
77412               d3_event.preventDefault();
77413               clickHelp(docs[i3 - 1], i3 - 1);
77414             });
77415             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
77416           }
77417         }
77418       }
77419       function clickWalkthrough(d3_event) {
77420         d3_event.preventDefault();
77421         if (context.inIntro()) return;
77422         context.container().call(uiIntro(context));
77423         context.ui().togglePanes();
77424       }
77425       function clickShortcuts(d3_event) {
77426         d3_event.preventDefault();
77427         context.container().call(context.ui().shortcuts, true);
77428       }
77429       var toc = content.append("ul").attr("class", "toc");
77430       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
77431         return d2.title;
77432       }).on("click", function(d3_event, d2) {
77433         d3_event.preventDefault();
77434         clickHelp(d2, docs.indexOf(d2));
77435       });
77436       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
77437         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
77438       ).append("a").attr("href", "#").on("click", clickShortcuts);
77439       shortcuts.append("div").call(_t.append("shortcuts.title"));
77440       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
77441       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
77442       walkthrough.append("div").call(_t.append("splash.walkthrough"));
77443       var helpContent = content.append("div").attr("class", "left-content");
77444       var body = helpContent.append("div").attr("class", "body");
77445       var nav = helpContent.append("div").attr("class", "nav");
77446       clickHelp(docs[0], 0);
77447     };
77448     return helpPane;
77449   }
77450   var init_help = __esm({
77451     "modules/ui/panes/help.js"() {
77452       "use strict";
77453       init_marked_esm();
77454       init_icon();
77455       init_intro();
77456       init_pane();
77457       init_localizer();
77458       init_tooltip();
77459       init_helper();
77460     }
77461   });
77462
77463   // modules/ui/sections/validation_issues.js
77464   var validation_issues_exports = {};
77465   __export(validation_issues_exports, {
77466     uiSectionValidationIssues: () => uiSectionValidationIssues
77467   });
77468   function uiSectionValidationIssues(id2, severity, context) {
77469     var _issues = [];
77470     var section = uiSection(id2, context).label(function() {
77471       if (!_issues) return "";
77472       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
77473       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
77474     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
77475       return _issues && _issues.length;
77476     });
77477     function getOptions() {
77478       return {
77479         what: corePreferences("validate-what") || "edited",
77480         where: corePreferences("validate-where") || "all"
77481       };
77482     }
77483     function reloadIssues() {
77484       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
77485     }
77486     function renderDisclosureContent(selection2) {
77487       var center = context.map().center();
77488       var graph = context.graph();
77489       var issues = _issues.map(function withDistance(issue) {
77490         var extent = issue.extent(graph);
77491         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
77492         return Object.assign(issue, { dist });
77493       }).sort(function byDistance(a4, b3) {
77494         return a4.dist - b3.dist;
77495       });
77496       issues = issues.slice(0, 1e3);
77497       selection2.call(drawIssuesList, issues);
77498     }
77499     function drawIssuesList(selection2, issues) {
77500       var list = selection2.selectAll(".issues-list").data([0]);
77501       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
77502       var items = list.selectAll("li").data(issues, function(d2) {
77503         return d2.key;
77504       });
77505       items.exit().remove();
77506       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
77507         return "issue severity-" + d2.severity;
77508       });
77509       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
77510         context.validator().focusIssue(d2);
77511       }).on("mouseover", function(d3_event, d2) {
77512         utilHighlightEntities(d2.entityIds, true, context);
77513       }).on("mouseout", function(d3_event, d2) {
77514         utilHighlightEntities(d2.entityIds, false, context);
77515       });
77516       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
77517       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
77518         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
77519         select_default2(this).call(svgIcon(iconName));
77520       });
77521       textEnter.append("span").attr("class", "issue-message");
77522       items = items.merge(itemsEnter).order();
77523       items.selectAll(".issue-message").text("").each(function(d2) {
77524         return d2.message(context)(select_default2(this));
77525       });
77526     }
77527     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
77528       window.requestIdleCallback(function() {
77529         reloadIssues();
77530         section.reRender();
77531       });
77532     });
77533     context.map().on(
77534       "move.uiSectionValidationIssues" + id2,
77535       debounce_default(function() {
77536         window.requestIdleCallback(function() {
77537           if (getOptions().where === "visible") {
77538             reloadIssues();
77539           }
77540           section.reRender();
77541         });
77542       }, 1e3)
77543     );
77544     return section;
77545   }
77546   var init_validation_issues = __esm({
77547     "modules/ui/sections/validation_issues.js"() {
77548       "use strict";
77549       init_debounce();
77550       init_src5();
77551       init_geo2();
77552       init_icon();
77553       init_preferences();
77554       init_localizer();
77555       init_util();
77556       init_section();
77557     }
77558   });
77559
77560   // modules/ui/sections/validation_options.js
77561   var validation_options_exports = {};
77562   __export(validation_options_exports, {
77563     uiSectionValidationOptions: () => uiSectionValidationOptions
77564   });
77565   function uiSectionValidationOptions(context) {
77566     var section = uiSection("issues-options", context).content(renderContent);
77567     function renderContent(selection2) {
77568       var container = selection2.selectAll(".issues-options-container").data([0]);
77569       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
77570       var data = [
77571         { key: "what", values: ["edited", "all"] },
77572         { key: "where", values: ["visible", "all"] }
77573       ];
77574       var options = container.selectAll(".issues-option").data(data, function(d2) {
77575         return d2.key;
77576       });
77577       var optionsEnter = options.enter().append("div").attr("class", function(d2) {
77578         return "issues-option issues-option-" + d2.key;
77579       });
77580       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
77581         return _t.html("issues.options." + d2.key + ".title");
77582       });
77583       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
77584         return d2.values.map(function(val) {
77585           return { value: val, key: d2.key };
77586         });
77587       }).enter().append("label");
77588       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
77589         return "issues-option-" + d2.key;
77590       }).attr("value", function(d2) {
77591         return d2.value;
77592       }).property("checked", function(d2) {
77593         return getOptions()[d2.key] === d2.value;
77594       }).on("change", function(d3_event, d2) {
77595         updateOptionValue(d3_event, d2.key, d2.value);
77596       });
77597       valuesEnter.append("span").html(function(d2) {
77598         return _t.html("issues.options." + d2.key + "." + d2.value);
77599       });
77600     }
77601     function getOptions() {
77602       return {
77603         what: corePreferences("validate-what") || "edited",
77604         // 'all', 'edited'
77605         where: corePreferences("validate-where") || "all"
77606         // 'all', 'visible'
77607       };
77608     }
77609     function updateOptionValue(d3_event, d2, val) {
77610       if (!val && d3_event && d3_event.target) {
77611         val = d3_event.target.value;
77612       }
77613       corePreferences("validate-" + d2, val);
77614       context.validator().validate();
77615     }
77616     return section;
77617   }
77618   var init_validation_options = __esm({
77619     "modules/ui/sections/validation_options.js"() {
77620       "use strict";
77621       init_preferences();
77622       init_localizer();
77623       init_section();
77624     }
77625   });
77626
77627   // modules/ui/sections/validation_rules.js
77628   var validation_rules_exports = {};
77629   __export(validation_rules_exports, {
77630     uiSectionValidationRules: () => uiSectionValidationRules
77631   });
77632   function uiSectionValidationRules(context) {
77633     var MINSQUARE = 0;
77634     var MAXSQUARE = 20;
77635     var DEFAULTSQUARE = 5;
77636     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
77637     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
77638       return key !== "maprules";
77639     }).sort(function(key1, key2) {
77640       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
77641     });
77642     function renderDisclosureContent(selection2) {
77643       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
77644       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
77645       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
77646       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
77647       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
77648         d3_event.preventDefault();
77649         context.validator().disableRules(_ruleKeys);
77650       });
77651       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
77652         d3_event.preventDefault();
77653         context.validator().disableRules([]);
77654       });
77655       container = container.merge(containerEnter);
77656       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
77657     }
77658     function drawListItems(selection2, data, type2, name, change, active) {
77659       var items = selection2.selectAll("li").data(data);
77660       items.exit().remove();
77661       var enter = items.enter().append("li");
77662       if (name === "rule") {
77663         enter.call(
77664           uiTooltip().title(function(d2) {
77665             return _t.append("issues." + d2 + ".tip");
77666           }).placement("top")
77667         );
77668       }
77669       var label = enter.append("label");
77670       label.append("input").attr("type", type2).attr("name", name).on("change", change);
77671       label.append("span").html(function(d2) {
77672         var params = {};
77673         if (d2 === "unsquare_way") {
77674           params.val = { html: '<span class="square-degrees"></span>' };
77675         }
77676         return _t.html("issues." + d2 + ".title", params);
77677       });
77678       items = items.merge(enter);
77679       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
77680       var degStr = corePreferences("validate-square-degrees");
77681       if (degStr === null) {
77682         degStr = DEFAULTSQUARE.toString();
77683       }
77684       var span = items.selectAll(".square-degrees");
77685       var input = span.selectAll(".square-degrees-input").data([0]);
77686       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) {
77687         d3_event.preventDefault();
77688         d3_event.stopPropagation();
77689         this.select();
77690       }).on("keyup", function(d3_event) {
77691         if (d3_event.keyCode === 13) {
77692           this.blur();
77693           this.select();
77694         }
77695       }).on("blur", changeSquare).merge(input).property("value", degStr);
77696     }
77697     function changeSquare() {
77698       var input = select_default2(this);
77699       var degStr = utilGetSetValue(input).trim();
77700       var degNum = Number(degStr);
77701       if (!isFinite(degNum)) {
77702         degNum = DEFAULTSQUARE;
77703       } else if (degNum > MAXSQUARE) {
77704         degNum = MAXSQUARE;
77705       } else if (degNum < MINSQUARE) {
77706         degNum = MINSQUARE;
77707       }
77708       degNum = Math.round(degNum * 10) / 10;
77709       degStr = degNum.toString();
77710       input.property("value", degStr);
77711       corePreferences("validate-square-degrees", degStr);
77712       context.validator().revalidateUnsquare();
77713     }
77714     function isRuleEnabled(d2) {
77715       return context.validator().isRuleEnabled(d2);
77716     }
77717     function toggleRule(d3_event, d2) {
77718       context.validator().toggleRule(d2);
77719     }
77720     context.validator().on("validated.uiSectionValidationRules", function() {
77721       window.requestIdleCallback(section.reRender);
77722     });
77723     return section;
77724   }
77725   var init_validation_rules = __esm({
77726     "modules/ui/sections/validation_rules.js"() {
77727       "use strict";
77728       init_src5();
77729       init_preferences();
77730       init_localizer();
77731       init_util();
77732       init_tooltip();
77733       init_section();
77734     }
77735   });
77736
77737   // modules/ui/sections/validation_status.js
77738   var validation_status_exports = {};
77739   __export(validation_status_exports, {
77740     uiSectionValidationStatus: () => uiSectionValidationStatus
77741   });
77742   function uiSectionValidationStatus(context) {
77743     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
77744       var issues = context.validator().getIssues(getOptions());
77745       return issues.length === 0;
77746     });
77747     function getOptions() {
77748       return {
77749         what: corePreferences("validate-what") || "edited",
77750         where: corePreferences("validate-where") || "all"
77751       };
77752     }
77753     function renderContent(selection2) {
77754       var box = selection2.selectAll(".box").data([0]);
77755       var boxEnter = box.enter().append("div").attr("class", "box");
77756       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
77757       var noIssuesMessage = boxEnter.append("span");
77758       noIssuesMessage.append("strong").attr("class", "message");
77759       noIssuesMessage.append("br");
77760       noIssuesMessage.append("span").attr("class", "details");
77761       renderIgnoredIssuesReset(selection2);
77762       setNoIssuesText(selection2);
77763     }
77764     function renderIgnoredIssuesReset(selection2) {
77765       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
77766       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
77767       resetIgnored.exit().remove();
77768       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
77769       resetIgnoredEnter.append("a").attr("href", "#");
77770       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
77771       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
77772       resetIgnored.on("click", function(d3_event) {
77773         d3_event.preventDefault();
77774         context.validator().resetIgnoredIssues();
77775       });
77776     }
77777     function setNoIssuesText(selection2) {
77778       var opts = getOptions();
77779       function checkForHiddenIssues(cases) {
77780         for (var type2 in cases) {
77781           var hiddenOpts = cases[type2];
77782           var hiddenIssues = context.validator().getIssues(hiddenOpts);
77783           if (hiddenIssues.length) {
77784             selection2.select(".box .details").html("").call(_t.append(
77785               "issues.no_issues.hidden_issues." + type2,
77786               { count: hiddenIssues.length.toString() }
77787             ));
77788             return;
77789           }
77790         }
77791         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
77792       }
77793       var messageType;
77794       if (opts.what === "edited" && opts.where === "visible") {
77795         messageType = "edits_in_view";
77796         checkForHiddenIssues({
77797           elsewhere: { what: "edited", where: "all" },
77798           everything_else: { what: "all", where: "visible" },
77799           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
77800           everything_else_elsewhere: { what: "all", where: "all" },
77801           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
77802           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
77803           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
77804         });
77805       } else if (opts.what === "edited" && opts.where === "all") {
77806         messageType = "edits";
77807         checkForHiddenIssues({
77808           everything_else: { what: "all", where: "all" },
77809           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
77810           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
77811         });
77812       } else if (opts.what === "all" && opts.where === "visible") {
77813         messageType = "everything_in_view";
77814         checkForHiddenIssues({
77815           elsewhere: { what: "all", where: "all" },
77816           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
77817           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
77818           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
77819           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
77820         });
77821       } else if (opts.what === "all" && opts.where === "all") {
77822         messageType = "everything";
77823         checkForHiddenIssues({
77824           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
77825           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
77826         });
77827       }
77828       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
77829         messageType = "no_edits";
77830       }
77831       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
77832     }
77833     context.validator().on("validated.uiSectionValidationStatus", function() {
77834       window.requestIdleCallback(section.reRender);
77835     });
77836     context.map().on(
77837       "move.uiSectionValidationStatus",
77838       debounce_default(function() {
77839         window.requestIdleCallback(section.reRender);
77840       }, 1e3)
77841     );
77842     return section;
77843   }
77844   var init_validation_status = __esm({
77845     "modules/ui/sections/validation_status.js"() {
77846       "use strict";
77847       init_debounce();
77848       init_icon();
77849       init_preferences();
77850       init_localizer();
77851       init_section();
77852     }
77853   });
77854
77855   // modules/ui/panes/issues.js
77856   var issues_exports = {};
77857   __export(issues_exports, {
77858     uiPaneIssues: () => uiPaneIssues
77859   });
77860   function uiPaneIssues(context) {
77861     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
77862       uiSectionValidationOptions(context),
77863       uiSectionValidationStatus(context),
77864       uiSectionValidationIssues("issues-errors", "error", context),
77865       uiSectionValidationIssues("issues-warnings", "warning", context),
77866       uiSectionValidationRules(context)
77867     ]);
77868     return issuesPane;
77869   }
77870   var init_issues = __esm({
77871     "modules/ui/panes/issues.js"() {
77872       "use strict";
77873       init_localizer();
77874       init_pane();
77875       init_validation_issues();
77876       init_validation_options();
77877       init_validation_rules();
77878       init_validation_status();
77879     }
77880   });
77881
77882   // modules/ui/settings/custom_data.js
77883   var custom_data_exports = {};
77884   __export(custom_data_exports, {
77885     uiSettingsCustomData: () => uiSettingsCustomData
77886   });
77887   function uiSettingsCustomData(context) {
77888     var dispatch14 = dispatch_default("change");
77889     function render(selection2) {
77890       var dataLayer = context.layers().layer("data");
77891       var _origSettings = {
77892         fileList: dataLayer && dataLayer.fileList() || null,
77893         url: corePreferences("settings-custom-data-url")
77894       };
77895       var _currSettings = {
77896         fileList: dataLayer && dataLayer.fileList() || null
77897         // url: prefs('settings-custom-data-url')
77898       };
77899       var modal = uiConfirm(selection2).okButton();
77900       modal.classed("settings-modal settings-custom-data", true);
77901       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
77902       var textSection = modal.select(".modal-section.message-text");
77903       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
77904       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) {
77905         var files = d3_event.target.files;
77906         if (files && files.length) {
77907           _currSettings.url = "";
77908           textSection.select(".field-url").property("value", "");
77909           _currSettings.fileList = files;
77910         } else {
77911           _currSettings.fileList = null;
77912         }
77913       });
77914       textSection.append("h4").call(_t.append("settings.custom_data.or"));
77915       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
77916       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
77917       var buttonSection = modal.select(".modal-section.buttons");
77918       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
77919       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
77920       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
77921       function isSaveDisabled() {
77922         return null;
77923       }
77924       function clickCancel() {
77925         textSection.select(".field-url").property("value", _origSettings.url);
77926         corePreferences("settings-custom-data-url", _origSettings.url);
77927         this.blur();
77928         modal.close();
77929       }
77930       function clickSave() {
77931         _currSettings.url = textSection.select(".field-url").property("value").trim();
77932         if (_currSettings.url) {
77933           _currSettings.fileList = null;
77934         }
77935         if (_currSettings.fileList) {
77936           _currSettings.url = "";
77937         }
77938         corePreferences("settings-custom-data-url", _currSettings.url);
77939         this.blur();
77940         modal.close();
77941         dispatch14.call("change", this, _currSettings);
77942       }
77943     }
77944     return utilRebind(render, dispatch14, "on");
77945   }
77946   var init_custom_data = __esm({
77947     "modules/ui/settings/custom_data.js"() {
77948       "use strict";
77949       init_src4();
77950       init_preferences();
77951       init_localizer();
77952       init_confirm();
77953       init_util();
77954     }
77955   });
77956
77957   // modules/ui/sections/data_layers.js
77958   var data_layers_exports = {};
77959   __export(data_layers_exports, {
77960     uiSectionDataLayers: () => uiSectionDataLayers
77961   });
77962   function uiSectionDataLayers(context) {
77963     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
77964     var layers = context.layers();
77965     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
77966     function renderDisclosureContent(selection2) {
77967       var container = selection2.selectAll(".data-layer-container").data([0]);
77968       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
77969     }
77970     function showsLayer(which) {
77971       var layer = layers.layer(which);
77972       if (layer) {
77973         return layer.enabled();
77974       }
77975       return false;
77976     }
77977     function setLayer(which, enabled) {
77978       var mode = context.mode();
77979       if (mode && /^draw/.test(mode.id)) return;
77980       var layer = layers.layer(which);
77981       if (layer) {
77982         layer.enabled(enabled);
77983         if (!enabled && (which === "osm" || which === "notes")) {
77984           context.enter(modeBrowse(context));
77985         }
77986       }
77987     }
77988     function toggleLayer(which) {
77989       setLayer(which, !showsLayer(which));
77990     }
77991     function drawOsmItems(selection2) {
77992       var osmKeys = ["osm", "notes"];
77993       var osmLayers = layers.all().filter(function(obj) {
77994         return osmKeys.indexOf(obj.id) !== -1;
77995       });
77996       var ul = selection2.selectAll(".layer-list-osm").data([0]);
77997       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
77998       var li = ul.selectAll(".list-item").data(osmLayers);
77999       li.exit().remove();
78000       var liEnter = li.enter().append("li").attr("class", function(d2) {
78001         return "list-item list-item-" + d2.id;
78002       });
78003       var labelEnter = liEnter.append("label").each(function(d2) {
78004         if (d2.id === "osm") {
78005           select_default2(this).call(
78006             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
78007           );
78008         } else {
78009           select_default2(this).call(
78010             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78011           );
78012         }
78013       });
78014       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78015         toggleLayer(d2.id);
78016       });
78017       labelEnter.append("span").html(function(d2) {
78018         return _t.html("map_data.layers." + d2.id + ".title");
78019       });
78020       li.merge(liEnter).classed("active", function(d2) {
78021         return d2.layer.enabled();
78022       }).selectAll("input").property("checked", function(d2) {
78023         return d2.layer.enabled();
78024       });
78025     }
78026     function drawQAItems(selection2) {
78027       var qaKeys = ["keepRight", "osmose"];
78028       var qaLayers = layers.all().filter(function(obj) {
78029         return qaKeys.indexOf(obj.id) !== -1;
78030       });
78031       var ul = selection2.selectAll(".layer-list-qa").data([0]);
78032       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
78033       var li = ul.selectAll(".list-item").data(qaLayers);
78034       li.exit().remove();
78035       var liEnter = li.enter().append("li").attr("class", function(d2) {
78036         return "list-item list-item-" + d2.id;
78037       });
78038       var labelEnter = liEnter.append("label").each(function(d2) {
78039         select_default2(this).call(
78040           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
78041         );
78042       });
78043       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78044         toggleLayer(d2.id);
78045       });
78046       labelEnter.append("span").each(function(d2) {
78047         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
78048       });
78049       li.merge(liEnter).classed("active", function(d2) {
78050         return d2.layer.enabled();
78051       }).selectAll("input").property("checked", function(d2) {
78052         return d2.layer.enabled();
78053       });
78054     }
78055     function drawVectorItems(selection2) {
78056       var dataLayer = layers.layer("data");
78057       var vtData = [
78058         {
78059           name: "Detroit Neighborhoods/Parks",
78060           src: "neighborhoods-parks",
78061           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
78062           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"
78063         },
78064         {
78065           name: "Detroit Composite POIs",
78066           src: "composite-poi",
78067           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
78068           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"
78069         },
78070         {
78071           name: "Detroit All-The-Places POIs",
78072           src: "alltheplaces-poi",
78073           tooltip: "Public domain business location data created by web scrapers.",
78074           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"
78075         }
78076       ];
78077       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
78078       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
78079       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
78080       container.exit().remove();
78081       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
78082       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
78083       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
78084       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");
78085       container = container.merge(containerEnter);
78086       var ul = container.selectAll(".layer-list-vectortile");
78087       var li = ul.selectAll(".list-item").data(vtData);
78088       li.exit().remove();
78089       var liEnter = li.enter().append("li").attr("class", function(d2) {
78090         return "list-item list-item-" + d2.src;
78091       });
78092       var labelEnter = liEnter.append("label").each(function(d2) {
78093         select_default2(this).call(
78094           uiTooltip().title(d2.tooltip).placement("top")
78095         );
78096       });
78097       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
78098       labelEnter.append("span").text(function(d2) {
78099         return d2.name;
78100       });
78101       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
78102       function isVTLayerSelected(d2) {
78103         return dataLayer && dataLayer.template() === d2.template;
78104       }
78105       function selectVTLayer(d3_event, d2) {
78106         corePreferences("settings-custom-data-url", d2.template);
78107         if (dataLayer) {
78108           dataLayer.template(d2.template, d2.src);
78109           dataLayer.enabled(true);
78110         }
78111       }
78112     }
78113     function drawCustomDataItems(selection2) {
78114       var dataLayer = layers.layer("data");
78115       var hasData = dataLayer && dataLayer.hasData();
78116       var showsData = hasData && dataLayer.enabled();
78117       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
78118       ul.exit().remove();
78119       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
78120       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
78121       var labelEnter = liEnter.append("label").call(
78122         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
78123       );
78124       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
78125         toggleLayer("data");
78126       });
78127       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
78128       liEnter.append("button").attr("class", "open-data-options").call(
78129         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78130       ).on("click", function(d3_event) {
78131         d3_event.preventDefault();
78132         editCustom();
78133       }).call(svgIcon("#iD-icon-more"));
78134       liEnter.append("button").attr("class", "zoom-to-data").call(
78135         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78136       ).on("click", function(d3_event) {
78137         if (select_default2(this).classed("disabled")) return;
78138         d3_event.preventDefault();
78139         d3_event.stopPropagation();
78140         dataLayer.fitZoom();
78141       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78142       ul = ul.merge(ulEnter);
78143       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78144       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78145     }
78146     function editCustom() {
78147       context.container().call(settingsCustomData);
78148     }
78149     function customChanged(d2) {
78150       var dataLayer = layers.layer("data");
78151       if (d2 && d2.url) {
78152         dataLayer.url(d2.url);
78153       } else if (d2 && d2.fileList) {
78154         dataLayer.fileList(d2.fileList);
78155       }
78156     }
78157     function drawPanelItems(selection2) {
78158       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
78159       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
78160         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
78161       );
78162       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78163         d3_event.preventDefault();
78164         context.ui().info.toggle("history");
78165       });
78166       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
78167       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
78168         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
78169       );
78170       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
78171         d3_event.preventDefault();
78172         context.ui().info.toggle("measurement");
78173       });
78174       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
78175     }
78176     context.layers().on("change.uiSectionDataLayers", section.reRender);
78177     context.map().on(
78178       "move.uiSectionDataLayers",
78179       debounce_default(function() {
78180         window.requestIdleCallback(section.reRender);
78181       }, 1e3)
78182     );
78183     return section;
78184   }
78185   var init_data_layers = __esm({
78186     "modules/ui/sections/data_layers.js"() {
78187       "use strict";
78188       init_debounce();
78189       init_src5();
78190       init_preferences();
78191       init_localizer();
78192       init_tooltip();
78193       init_icon();
78194       init_geo2();
78195       init_browse();
78196       init_cmd();
78197       init_section();
78198       init_custom_data();
78199     }
78200   });
78201
78202   // modules/ui/sections/map_features.js
78203   var map_features_exports = {};
78204   __export(map_features_exports, {
78205     uiSectionMapFeatures: () => uiSectionMapFeatures
78206   });
78207   function uiSectionMapFeatures(context) {
78208     var _features = context.features().keys();
78209     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78210     function renderDisclosureContent(selection2) {
78211       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
78212       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
78213       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
78214       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
78215       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
78216         d3_event.preventDefault();
78217         context.features().disableAll();
78218       });
78219       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
78220         d3_event.preventDefault();
78221         context.features().enableAll();
78222       });
78223       container = container.merge(containerEnter);
78224       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
78225     }
78226     function drawListItems(selection2, data, type2, name, change, active) {
78227       var items = selection2.selectAll("li").data(data);
78228       items.exit().remove();
78229       var enter = items.enter().append("li").call(
78230         uiTooltip().title(function(d2) {
78231           var tip = _t.append(name + "." + d2 + ".tooltip");
78232           if (autoHiddenFeature(d2)) {
78233             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
78234             return (selection3) => {
78235               selection3.call(tip);
78236               selection3.append("div").call(msg);
78237             };
78238           }
78239           return tip;
78240         }).placement("top")
78241       );
78242       var label = enter.append("label");
78243       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78244       label.append("span").html(function(d2) {
78245         return _t.html(name + "." + d2 + ".description");
78246       });
78247       items = items.merge(enter);
78248       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
78249     }
78250     function autoHiddenFeature(d2) {
78251       return context.features().autoHidden(d2);
78252     }
78253     function showsFeature(d2) {
78254       return context.features().enabled(d2);
78255     }
78256     function clickFeature(d3_event, d2) {
78257       context.features().toggle(d2);
78258     }
78259     function showsLayer(id2) {
78260       var layer = context.layers().layer(id2);
78261       return layer && layer.enabled();
78262     }
78263     context.features().on("change.map_features", section.reRender);
78264     return section;
78265   }
78266   var init_map_features = __esm({
78267     "modules/ui/sections/map_features.js"() {
78268       "use strict";
78269       init_localizer();
78270       init_tooltip();
78271       init_section();
78272     }
78273   });
78274
78275   // modules/ui/sections/map_style_options.js
78276   var map_style_options_exports = {};
78277   __export(map_style_options_exports, {
78278     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions
78279   });
78280   function uiSectionMapStyleOptions(context) {
78281     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78282     function renderDisclosureContent(selection2) {
78283       var container = selection2.selectAll(".layer-fill-list").data([0]);
78284       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
78285       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
78286       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
78287         return context.surface().classed("highlight-edited");
78288       });
78289     }
78290     function drawListItems(selection2, data, type2, name, change, active) {
78291       var items = selection2.selectAll("li").data(data);
78292       items.exit().remove();
78293       var enter = items.enter().append("li").call(
78294         uiTooltip().title(function(d2) {
78295           return _t.append(name + "." + d2 + ".tooltip");
78296         }).keys(function(d2) {
78297           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
78298           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
78299           return key ? [key] : null;
78300         }).placement("top")
78301       );
78302       var label = enter.append("label");
78303       label.append("input").attr("type", type2).attr("name", name).on("change", change);
78304       label.append("span").html(function(d2) {
78305         return _t.html(name + "." + d2 + ".description");
78306       });
78307       items = items.merge(enter);
78308       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
78309     }
78310     function isActiveFill(d2) {
78311       return context.map().activeAreaFill() === d2;
78312     }
78313     function toggleHighlightEdited(d3_event) {
78314       d3_event.preventDefault();
78315       context.map().toggleHighlightEdited();
78316     }
78317     function setFill(d3_event, d2) {
78318       context.map().activeAreaFill(d2);
78319     }
78320     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
78321     return section;
78322   }
78323   var init_map_style_options = __esm({
78324     "modules/ui/sections/map_style_options.js"() {
78325       "use strict";
78326       init_localizer();
78327       init_tooltip();
78328       init_section();
78329     }
78330   });
78331
78332   // modules/ui/settings/local_photos.js
78333   var local_photos_exports2 = {};
78334   __export(local_photos_exports2, {
78335     uiSettingsLocalPhotos: () => uiSettingsLocalPhotos
78336   });
78337   function uiSettingsLocalPhotos(context) {
78338     var dispatch14 = dispatch_default("change");
78339     var photoLayer = context.layers().layer("local-photos");
78340     var modal;
78341     function render(selection2) {
78342       modal = uiConfirm(selection2).okButton();
78343       modal.classed("settings-modal settings-local-photos", true);
78344       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
78345       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
78346       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
78347       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
78348       instructionsSection.append("input").classed("field-file", true).attr("type", "file").attr("multiple", "multiple").attr("accept", ".jpg,.jpeg,.png,image/png,image/jpeg").style("visibility", "hidden").attr("id", "local-photo-files").on("change", function(d3_event) {
78349         var files = d3_event.target.files;
78350         if (files && files.length) {
78351           photoList.select("ul").append("li").classed("placeholder", true).append("div");
78352           dispatch14.call("change", this, files);
78353         }
78354         d3_event.target.value = null;
78355       });
78356       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
78357       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
78358       photoList.append("ul");
78359       updatePhotoList(photoList.select("ul"));
78360       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
78361     }
78362     function updatePhotoList(container) {
78363       var _a4;
78364       function locationUnavailable(d2) {
78365         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
78366       }
78367       container.selectAll("li.placeholder").remove();
78368       let selection2 = container.selectAll("li").data((_a4 = photoLayer.getPhotos()) != null ? _a4 : [], (d2) => d2.id);
78369       selection2.exit().remove();
78370       const selectionEnter = selection2.enter().append("li");
78371       selectionEnter.append("span").classed("filename", true);
78372       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
78373       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
78374         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
78375       );
78376       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
78377       selection2 = selection2.merge(selectionEnter);
78378       selection2.classed("invalid", locationUnavailable);
78379       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
78380       selection2.select("span.filename").on("click", (d3_event, d2) => {
78381         photoLayer.openPhoto(d3_event, d2, false);
78382       });
78383       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
78384         photoLayer.openPhoto(d3_event, d2, true);
78385       });
78386       selection2.select("button.remove").on("click", (d3_event, d2) => {
78387         photoLayer.removePhoto(d2.id);
78388         updatePhotoList(container);
78389       });
78390     }
78391     return utilRebind(render, dispatch14, "on");
78392   }
78393   var init_local_photos2 = __esm({
78394     "modules/ui/settings/local_photos.js"() {
78395       "use strict";
78396       init_src4();
78397       init_lodash();
78398       init_localizer();
78399       init_confirm();
78400       init_util();
78401       init_tooltip();
78402       init_svg();
78403     }
78404   });
78405
78406   // modules/ui/sections/photo_overlays.js
78407   var photo_overlays_exports = {};
78408   __export(photo_overlays_exports, {
78409     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays
78410   });
78411   function uiSectionPhotoOverlays(context) {
78412     let _savedLayers = [];
78413     let _layersHidden = false;
78414     const _streetLayerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
78415     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
78416     var layers = context.layers();
78417     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
78418     const photoDates = {};
78419     const now3 = +/* @__PURE__ */ new Date();
78420     function renderDisclosureContent(selection2) {
78421       var container = selection2.selectAll(".photo-overlay-container").data([0]);
78422       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateSlider).call(drawUsernameFilter).call(drawLocalPhotos);
78423     }
78424     function drawPhotoItems(selection2) {
78425       var photoKeys = context.photos().overlayLayerIDs();
78426       var photoLayers = layers.all().filter(function(obj) {
78427         return photoKeys.indexOf(obj.id) !== -1;
78428       });
78429       var data = photoLayers.filter(function(obj) {
78430         if (!obj.layer.supported()) return false;
78431         if (layerEnabled(obj)) return true;
78432         if (typeof obj.layer.validHere === "function") {
78433           return obj.layer.validHere(context.map().extent(), context.map().zoom());
78434         }
78435         return true;
78436       });
78437       function layerSupported(d2) {
78438         return d2.layer && d2.layer.supported();
78439       }
78440       function layerEnabled(d2) {
78441         return layerSupported(d2) && (d2.layer.enabled() || _savedLayers.includes(d2.id));
78442       }
78443       function layerRendered(d2) {
78444         var _a4, _b2, _c;
78445         return (_c = (_b2 = (_a4 = d2.layer).rendered) == null ? void 0 : _b2.call(_a4, context.map().zoom())) != null ? _c : true;
78446       }
78447       var ul = selection2.selectAll(".layer-list-photos").data([0]);
78448       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
78449       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
78450       li.exit().remove();
78451       var liEnter = li.enter().append("li").attr("class", function(d2) {
78452         var classes = "list-item-photos list-item-" + d2.id;
78453         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
78454           classes += " indented";
78455         }
78456         return classes;
78457       });
78458       var labelEnter = liEnter.append("label").each(function(d2) {
78459         var titleID;
78460         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
78461         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
78462         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
78463         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
78464         select_default2(this).call(
78465           uiTooltip().title(() => {
78466             if (!layerRendered(d2)) {
78467               return _t.append("street_side.minzoom_tooltip");
78468             } else {
78469               return _t.append(titleID);
78470             }
78471           }).placement("top")
78472         );
78473       });
78474       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78475         toggleLayer(d2.id);
78476       });
78477       labelEnter.append("span").html(function(d2) {
78478         var id2 = d2.id;
78479         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
78480         return _t.html(id2.replace(/-/g, "_") + ".title");
78481       });
78482       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
78483     }
78484     function drawPhotoTypeItems(selection2) {
78485       var data = context.photos().allPhotoTypes();
78486       function typeEnabled(d2) {
78487         return context.photos().showsPhotoType(d2);
78488       }
78489       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
78490       ul.exit().remove();
78491       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
78492       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
78493       li.exit().remove();
78494       var liEnter = li.enter().append("li").attr("class", function(d2) {
78495         return "list-item-photo-types list-item-" + d2;
78496       });
78497       var labelEnter = liEnter.append("label").each(function(d2) {
78498         select_default2(this).call(
78499           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
78500         );
78501       });
78502       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
78503         context.photos().togglePhotoType(d2, true);
78504       });
78505       labelEnter.append("span").html(function(d2) {
78506         return _t.html("photo_overlays.photo_type." + d2 + ".title");
78507       });
78508       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
78509     }
78510     function drawDateSlider(selection2) {
78511       var ul = selection2.selectAll(".layer-list-date-slider").data([0]);
78512       ul.exit().remove();
78513       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-slider").merge(ul);
78514       var li = ul.selectAll(".list-item-date-slider").data(context.photos().shouldFilterDateBySlider() ? ["date-slider"] : []);
78515       li.exit().remove();
78516       var liEnter = li.enter().append("li").attr("class", "list-item-date-slider");
78517       var labelEnter = liEnter.append("label").each(function() {
78518         select_default2(this).call(
78519           uiTooltip().title(() => _t.append("photo_overlays.age_slider_filter.tooltip")).placement("top")
78520         );
78521       });
78522       labelEnter.append("span").attr("class", "dateSliderSpan").call(_t.append("photo_overlays.age_slider_filter.title"));
78523       let sliderWrap = labelEnter.append("div").attr("class", "slider-wrap");
78524       sliderWrap.append("input").attr("type", "range").attr("min", 0).attr("max", 1).attr("step", 1e-3).attr("list", "photo-overlay-data-range").attr("value", () => dateSliderValue("from")).classed("list-option-date-slider", true).classed("from-date", true).style("direction", _mainLocalizer.textDirection() === "rtl" ? "ltr" : "rtl").call(utilNoAuto).on("change", function() {
78525         let value = select_default2(this).property("value");
78526         setYearFilter(value, true, "from");
78527       });
78528       selection2.select("input.from-date").each(function() {
78529         this.value = dateSliderValue("from");
78530       });
78531       sliderWrap.append("div").attr("class", "date-slider-label");
78532       sliderWrap.append("input").attr("type", "range").attr("min", 0).attr("max", 1).attr("step", 1e-3).attr("list", "photo-overlay-data-range-inverted").attr("value", () => 1 - dateSliderValue("to")).classed("list-option-date-slider", true).classed("to-date", true).style("display", () => dateSliderValue("to") === 0 ? "none" : null).style("direction", _mainLocalizer.textDirection()).call(utilNoAuto).on("change", function() {
78533         let value = select_default2(this).property("value");
78534         setYearFilter(1 - value, true, "to");
78535       });
78536       selection2.select("input.to-date").each(function() {
78537         this.value = 1 - dateSliderValue("to");
78538       });
78539       selection2.select(".date-slider-label").call(dateSliderValue("from") === 1 ? _t.addOrUpdate("photo_overlays.age_slider_filter.label_all") : _t.addOrUpdate("photo_overlays.age_slider_filter.label_date", {
78540         date: new Date(now3 - Math.pow(dateSliderValue("from"), 1.45) * 10 * 365.25 * 86400 * 1e3).toLocaleDateString(_mainLocalizer.localeCode())
78541       }));
78542       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range");
78543       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range-inverted");
78544       const dateTicks = /* @__PURE__ */ new Set();
78545       for (const dates of Object.values(photoDates)) {
78546         dates.forEach((date) => {
78547           dateTicks.add(Math.round(1e3 * Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45)) / 1e3);
78548         });
78549       }
78550       const ticks2 = selection2.select("datalist#photo-overlay-data-range").selectAll("option").data([...dateTicks].concat([1, 0]));
78551       ticks2.exit().remove();
78552       ticks2.enter().append("option").merge(ticks2).attr("value", (d2) => d2);
78553       const ticksInverted = selection2.select("datalist#photo-overlay-data-range-inverted").selectAll("option").data([...dateTicks].concat([1, 0]));
78554       ticksInverted.exit().remove();
78555       ticksInverted.enter().append("option").merge(ticksInverted).attr("value", (d2) => 1 - d2);
78556       li.merge(liEnter).classed("active", filterEnabled);
78557       function filterEnabled() {
78558         return !!context.photos().fromDate();
78559       }
78560     }
78561     function dateSliderValue(which) {
78562       const val = which === "from" ? context.photos().fromDate() : context.photos().toDate();
78563       if (val) {
78564         const date = +new Date(val);
78565         return Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45);
78566       } else return which === "from" ? 1 : 0;
78567     }
78568     function setYearFilter(value, updateUrl, which) {
78569       value = +value + (which === "from" ? 1e-3 : -1e-3);
78570       if (value < 1 && value > 0) {
78571         const date = new Date(now3 - Math.pow(value, 1.45) * 10 * 365.25 * 86400 * 1e3).toISOString().substring(0, 10);
78572         context.photos().setDateFilter(`${which}Date`, date, updateUrl);
78573       } else {
78574         context.photos().setDateFilter(`${which}Date`, null, updateUrl);
78575       }
78576     }
78577     ;
78578     function drawUsernameFilter(selection2) {
78579       function filterEnabled() {
78580         return context.photos().usernames();
78581       }
78582       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
78583       ul.exit().remove();
78584       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
78585       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
78586       li.exit().remove();
78587       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
78588       var labelEnter = liEnter.append("label").each(function() {
78589         select_default2(this).call(
78590           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
78591         );
78592       });
78593       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
78594       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
78595         var value = select_default2(this).property("value");
78596         context.photos().setUsernameFilter(value, true);
78597         select_default2(this).property("value", usernameValue);
78598       });
78599       li.merge(liEnter).classed("active", filterEnabled);
78600       function usernameValue() {
78601         var usernames = context.photos().usernames();
78602         if (usernames) return usernames.join("; ");
78603         return usernames;
78604       }
78605     }
78606     function toggleLayer(which) {
78607       setLayer(which, !showsLayer(which));
78608     }
78609     function showsLayer(which) {
78610       var layer = layers.layer(which);
78611       if (layer) {
78612         return layer.enabled();
78613       }
78614       return false;
78615     }
78616     function setLayer(which, enabled) {
78617       var layer = layers.layer(which);
78618       if (layer) {
78619         layer.enabled(enabled);
78620       }
78621     }
78622     function drawLocalPhotos(selection2) {
78623       var photoLayer = layers.layer("local-photos");
78624       var hasData = photoLayer && photoLayer.hasData();
78625       var showsData = hasData && photoLayer.enabled();
78626       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
78627       ul.exit().remove();
78628       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
78629       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
78630       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
78631       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
78632         toggleLayer("local-photos");
78633       });
78634       localPhotosLabelEnter.call(_t.append("local_photos.header"));
78635       localPhotosEnter.append("button").attr("class", "open-data-options").call(
78636         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78637       ).on("click", function(d3_event) {
78638         d3_event.preventDefault();
78639         editLocalPhotos();
78640       }).call(svgIcon("#iD-icon-more"));
78641       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
78642         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
78643       ).on("click", function(d3_event) {
78644         if (select_default2(this).classed("disabled")) return;
78645         d3_event.preventDefault();
78646         d3_event.stopPropagation();
78647         photoLayer.fitZoom();
78648       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
78649       ul = ul.merge(ulEnter);
78650       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
78651       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
78652     }
78653     function editLocalPhotos() {
78654       context.container().call(settingsLocalPhotos);
78655     }
78656     function localPhotosChanged(d2) {
78657       var localPhotosLayer = layers.layer("local-photos");
78658       localPhotosLayer.fileList(d2);
78659     }
78660     function toggleStreetSide() {
78661       let layerContainer = select_default2(".photo-overlay-container");
78662       if (!_layersHidden) {
78663         layers.all().forEach((d2) => {
78664           if (_streetLayerIDs.includes(d2.id)) {
78665             if (showsLayer(d2.id)) _savedLayers.push(d2.id);
78666             setLayer(d2.id, false);
78667           }
78668         });
78669         layerContainer.classed("disabled-panel", true);
78670       } else {
78671         _savedLayers.forEach((d2) => {
78672           setLayer(d2, true);
78673         });
78674         _savedLayers = [];
78675         layerContainer.classed("disabled-panel", false);
78676       }
78677       _layersHidden = !_layersHidden;
78678     }
78679     ;
78680     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
78681     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
78682     context.layers().on("photoDatesChanged.uiSectionPhotoOverlays", function(service, dates) {
78683       photoDates[service] = dates.map((date) => +new Date(date));
78684       section.reRender();
78685     });
78686     context.keybinding().on("\u21E7P", toggleStreetSide);
78687     context.map().on(
78688       "move.photo_overlays",
78689       debounce_default(function() {
78690         window.requestIdleCallback(section.reRender);
78691       }, 1e3)
78692     );
78693     return section;
78694   }
78695   var init_photo_overlays = __esm({
78696     "modules/ui/sections/photo_overlays.js"() {
78697       "use strict";
78698       init_debounce();
78699       init_src5();
78700       init_localizer();
78701       init_tooltip();
78702       init_section();
78703       init_util();
78704       init_local_photos2();
78705       init_svg();
78706     }
78707   });
78708
78709   // modules/ui/panes/map_data.js
78710   var map_data_exports = {};
78711   __export(map_data_exports, {
78712     uiPaneMapData: () => uiPaneMapData
78713   });
78714   function uiPaneMapData(context) {
78715     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([
78716       uiSectionDataLayers(context),
78717       uiSectionPhotoOverlays(context),
78718       uiSectionMapStyleOptions(context),
78719       uiSectionMapFeatures(context)
78720     ]);
78721     return mapDataPane;
78722   }
78723   var init_map_data = __esm({
78724     "modules/ui/panes/map_data.js"() {
78725       "use strict";
78726       init_localizer();
78727       init_pane();
78728       init_data_layers();
78729       init_map_features();
78730       init_map_style_options();
78731       init_photo_overlays();
78732     }
78733   });
78734
78735   // modules/ui/panes/preferences.js
78736   var preferences_exports2 = {};
78737   __export(preferences_exports2, {
78738     uiPanePreferences: () => uiPanePreferences
78739   });
78740   function uiPanePreferences(context) {
78741     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
78742       uiSectionPrivacy(context)
78743     ]);
78744     return preferencesPane;
78745   }
78746   var init_preferences2 = __esm({
78747     "modules/ui/panes/preferences.js"() {
78748       "use strict";
78749       init_localizer();
78750       init_pane();
78751       init_privacy();
78752     }
78753   });
78754
78755   // modules/ui/init.js
78756   var init_exports = {};
78757   __export(init_exports, {
78758     uiInit: () => uiInit
78759   });
78760   function uiInit(context) {
78761     var _initCounter = 0;
78762     var _needWidth = {};
78763     var _lastPointerType;
78764     var overMap;
78765     function render(container) {
78766       container.on("click.ui", function(d3_event) {
78767         if (d3_event.button !== 0) return;
78768         if (!d3_event.composedPath) return;
78769         var isOkayTarget = d3_event.composedPath().some(function(node) {
78770           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
78771           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
78772           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
78773           node.nodeName === "A");
78774         });
78775         if (isOkayTarget) return;
78776         d3_event.preventDefault();
78777       });
78778       var detected = utilDetect();
78779       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
78780       // but we only need to do this on desktop Safari anyway. – #7694
78781       !detected.isMobileWebKit) {
78782         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
78783           d3_event.preventDefault();
78784         });
78785       }
78786       if ("PointerEvent" in window) {
78787         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
78788           var pointerType = d3_event.pointerType || "mouse";
78789           if (_lastPointerType !== pointerType) {
78790             _lastPointerType = pointerType;
78791             container.attr("pointer", pointerType);
78792           }
78793         }, true);
78794       } else {
78795         _lastPointerType = "mouse";
78796         container.attr("pointer", "mouse");
78797       }
78798       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
78799       container.call(uiFullScreen(context));
78800       var map2 = context.map();
78801       map2.redrawEnable(false);
78802       map2.on("hitMinZoom.ui", function() {
78803         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
78804       });
78805       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
78806       container.append("div").attr("class", "sidebar").call(ui.sidebar);
78807       var content = container.append("div").attr("class", "main-content active");
78808       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
78809       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
78810       overMap = content.append("div").attr("class", "over-map");
78811       overMap.append("div").attr("class", "select-trap").text("t");
78812       overMap.call(uiMapInMap(context)).call(uiNotice(context));
78813       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
78814       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
78815       var controls = controlsWrap.append("div").attr("class", "map-controls");
78816       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
78817       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
78818       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
78819       controlsWrap.on("wheel.mapControls", function(d3_event) {
78820         if (!d3_event.deltaX) {
78821           controlsWrap.node().scrollTop += d3_event.deltaY;
78822         }
78823       });
78824       var panes = overMap.append("div").attr("class", "map-panes");
78825       var uiPanes = [
78826         uiPaneBackground(context),
78827         uiPaneMapData(context),
78828         uiPaneIssues(context),
78829         uiPanePreferences(context),
78830         uiPaneHelp(context)
78831       ];
78832       uiPanes.forEach(function(pane) {
78833         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
78834         panes.call(pane.renderPane);
78835       });
78836       ui.info = uiInfo(context);
78837       overMap.call(ui.info);
78838       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
78839       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
78840       var about = content.append("div").attr("class", "map-footer");
78841       about.append("div").attr("class", "api-status").call(uiStatus(context));
78842       var footer = about.append("div").attr("class", "map-footer-bar fillD");
78843       footer.append("div").attr("class", "flash-wrap footer-hide");
78844       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
78845       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
78846       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
78847       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
78848       var apiConnections = context.connection().apiConnections();
78849       if (apiConnections && apiConnections.length > 1) {
78850         aboutList.append("li").attr("class", "source-switch").call(
78851           uiSourceSwitch(context).keys(apiConnections)
78852         );
78853       }
78854       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
78855       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
78856       var issueLinks = aboutList.append("li");
78857       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"));
78858       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"));
78859       aboutList.append("li").attr("class", "version").call(uiVersion(context));
78860       if (!context.embed()) {
78861         aboutList.call(uiAccount(context));
78862       }
78863       ui.onResize();
78864       map2.redrawEnable(true);
78865       ui.hash = behaviorHash(context);
78866       ui.hash();
78867       if (!ui.hash.hadLocation) {
78868         map2.centerZoom([0, 0], 2);
78869       }
78870       window.onbeforeunload = function() {
78871         return context.save();
78872       };
78873       window.onunload = function() {
78874         context.history().unlock();
78875       };
78876       select_default2(window).on("resize.editor", function() {
78877         ui.onResize();
78878       });
78879       var panPixels = 80;
78880       context.keybinding().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) {
78881         if (d3_event) {
78882           d3_event.stopImmediatePropagation();
78883           d3_event.preventDefault();
78884         }
78885         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
78886         if (previousBackground) {
78887           var currentBackground = context.background().baseLayerSource();
78888           corePreferences("background-last-used-toggle", currentBackground.id);
78889           corePreferences("background-last-used", previousBackground.id);
78890           context.background().baseLayerSource(previousBackground);
78891         }
78892       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
78893         d3_event.preventDefault();
78894         d3_event.stopPropagation();
78895         context.map().toggleWireframe();
78896       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
78897         d3_event.preventDefault();
78898         d3_event.stopPropagation();
78899         var mode = context.mode();
78900         if (mode && /^draw/.test(mode.id)) return;
78901         var layer = context.layers().layer("osm");
78902         if (layer) {
78903           layer.enabled(!layer.enabled());
78904           if (!layer.enabled()) {
78905             context.enter(modeBrowse(context));
78906           }
78907         }
78908       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
78909         d3_event.preventDefault();
78910         context.map().toggleHighlightEdited();
78911       });
78912       context.on("enter.editor", function(entered) {
78913         container.classed("mode-" + entered.id, true);
78914       }).on("exit.editor", function(exited) {
78915         container.classed("mode-" + exited.id, false);
78916       });
78917       context.enter(modeBrowse(context));
78918       if (!_initCounter++) {
78919         if (!ui.hash.startWalkthrough) {
78920           context.container().call(uiSplash(context)).call(uiRestore(context));
78921         }
78922         context.container().call(ui.shortcuts);
78923       }
78924       var osm = context.connection();
78925       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
78926       if (osm && auth) {
78927         osm.on("authLoading.ui", function() {
78928           context.container().call(auth);
78929         }).on("authDone.ui", function() {
78930           auth.close();
78931         });
78932       }
78933       _initCounter++;
78934       if (ui.hash.startWalkthrough) {
78935         ui.hash.startWalkthrough = false;
78936         context.container().call(uiIntro(context));
78937       }
78938       function pan(d2) {
78939         return function(d3_event) {
78940           if (d3_event.shiftKey) return;
78941           if (context.container().select(".combobox").size()) return;
78942           d3_event.preventDefault();
78943           context.map().pan(d2, 100);
78944         };
78945       }
78946     }
78947     let ui = {};
78948     let _loadPromise;
78949     ui.ensureLoaded = () => {
78950       if (_loadPromise) return _loadPromise;
78951       return _loadPromise = Promise.all([
78952         // must have strings and presets before loading the UI
78953         _mainLocalizer.ensureLoaded(),
78954         _mainPresetIndex.ensureLoaded()
78955       ]).then(() => {
78956         if (!context.container().empty()) render(context.container());
78957       }).catch((err) => console.error(err));
78958     };
78959     ui.restart = function() {
78960       context.keybinding().clear();
78961       _loadPromise = null;
78962       context.container().selectAll("*").remove();
78963       ui.ensureLoaded();
78964     };
78965     ui.lastPointerType = function() {
78966       return _lastPointerType;
78967     };
78968     ui.svgDefs = svgDefs(context);
78969     ui.flash = uiFlash(context);
78970     ui.sidebar = uiSidebar(context);
78971     ui.photoviewer = uiPhotoviewer(context);
78972     ui.shortcuts = uiShortcuts(context);
78973     ui.onResize = function(withPan) {
78974       var map2 = context.map();
78975       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
78976       utilGetDimensions(context.container().select(".sidebar"), true);
78977       if (withPan !== void 0) {
78978         map2.redrawEnable(false);
78979         map2.pan(withPan);
78980         map2.redrawEnable(true);
78981       }
78982       map2.dimensions(mapDimensions);
78983       ui.photoviewer.onMapResize();
78984       ui.checkOverflow(".top-toolbar");
78985       ui.checkOverflow(".map-footer-bar");
78986       var resizeWindowEvent = document.createEvent("Event");
78987       resizeWindowEvent.initEvent("resizeWindow", true, true);
78988       document.dispatchEvent(resizeWindowEvent);
78989     };
78990     ui.checkOverflow = function(selector, reset) {
78991       if (reset) {
78992         delete _needWidth[selector];
78993       }
78994       var selection2 = context.container().select(selector);
78995       if (selection2.empty()) return;
78996       var scrollWidth = selection2.property("scrollWidth");
78997       var clientWidth = selection2.property("clientWidth");
78998       var needed = _needWidth[selector] || scrollWidth;
78999       if (scrollWidth > clientWidth) {
79000         selection2.classed("narrow", true);
79001         if (!_needWidth[selector]) {
79002           _needWidth[selector] = scrollWidth;
79003         }
79004       } else if (scrollWidth >= needed) {
79005         selection2.classed("narrow", false);
79006       }
79007     };
79008     ui.togglePanes = function(showPane) {
79009       var hidePanes = context.container().selectAll(".map-pane.shown");
79010       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
79011       hidePanes.classed("shown", false).classed("hide", true);
79012       context.container().selectAll(".map-pane-control button").classed("active", false);
79013       if (showPane) {
79014         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
79015         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
79016         showPane.classed("shown", true).classed("hide", false);
79017         if (hidePanes.empty()) {
79018           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
79019         } else {
79020           showPane.style(side, "0px");
79021         }
79022       } else {
79023         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
79024           select_default2(this).classed("shown", false).classed("hide", true);
79025         });
79026       }
79027     };
79028     var _editMenu = uiEditMenu(context);
79029     ui.editMenu = function() {
79030       return _editMenu;
79031     };
79032     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
79033       ui.closeEditMenu();
79034       if (!operations && context.mode().operations) operations = context.mode().operations();
79035       if (!operations || !operations.length) return;
79036       if (!context.map().editableDataEnabled()) return;
79037       var surfaceNode = context.surface().node();
79038       if (surfaceNode.focus) {
79039         surfaceNode.focus();
79040       }
79041       operations.forEach(function(operation2) {
79042         if (operation2.point) operation2.point(anchorPoint);
79043       });
79044       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
79045       overMap.call(_editMenu);
79046     };
79047     ui.closeEditMenu = function() {
79048       if (overMap !== void 0) {
79049         overMap.select(".edit-menu").remove();
79050       }
79051     };
79052     var _saveLoading = select_default2(null);
79053     context.uploader().on("saveStarted.ui", function() {
79054       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
79055       context.container().call(_saveLoading);
79056     }).on("saveEnded.ui", function() {
79057       _saveLoading.close();
79058       _saveLoading = select_default2(null);
79059     });
79060     k.use({
79061       mangle: false,
79062       headerIds: false
79063     });
79064     return ui;
79065   }
79066   var init_init2 = __esm({
79067     "modules/ui/init.js"() {
79068       "use strict";
79069       init_marked_esm();
79070       init_src5();
79071       init_preferences();
79072       init_localizer();
79073       init_presets();
79074       init_behavior();
79075       init_browse();
79076       init_svg();
79077       init_detect();
79078       init_dimensions();
79079       init_account();
79080       init_attribution();
79081       init_contributors();
79082       init_edit_menu();
79083       init_feature_info();
79084       init_flash();
79085       init_full_screen();
79086       init_geolocate2();
79087       init_info();
79088       init_intro2();
79089       init_issues_info();
79090       init_loading();
79091       init_map_in_map();
79092       init_notice();
79093       init_photoviewer();
79094       init_restore();
79095       init_scale2();
79096       init_shortcuts();
79097       init_sidebar();
79098       init_source_switch();
79099       init_spinner();
79100       init_splash();
79101       init_status();
79102       init_tooltip();
79103       init_top_toolbar();
79104       init_version();
79105       init_zoom3();
79106       init_zoom_to_selection();
79107       init_cmd();
79108       init_background3();
79109       init_help();
79110       init_issues();
79111       init_map_data();
79112       init_preferences2();
79113     }
79114   });
79115
79116   // modules/ui/commit_warnings.js
79117   var commit_warnings_exports = {};
79118   __export(commit_warnings_exports, {
79119     uiCommitWarnings: () => uiCommitWarnings
79120   });
79121   function uiCommitWarnings(context) {
79122     function commitWarnings(selection2) {
79123       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
79124       for (var severity in issuesBySeverity) {
79125         var issues = issuesBySeverity[severity];
79126         if (severity !== "error") {
79127           issues = issues.filter(function(issue) {
79128             return issue.type !== "help_request";
79129           });
79130         }
79131         var section = severity + "-section";
79132         var issueItem = severity + "-item";
79133         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
79134         container.exit().remove();
79135         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
79136         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
79137         containerEnter.append("ul").attr("class", "changeset-list");
79138         container = containerEnter.merge(container);
79139         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
79140           return d2.key;
79141         });
79142         items.exit().remove();
79143         var itemsEnter = items.enter().append("li").attr("class", issueItem);
79144         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
79145           if (d2.entityIds) {
79146             context.surface().selectAll(
79147               utilEntityOrMemberSelector(
79148                 d2.entityIds,
79149                 context.graph()
79150               )
79151             ).classed("hover", true);
79152           }
79153         }).on("mouseout", function() {
79154           context.surface().selectAll(".hover").classed("hover", false);
79155         }).on("click", function(d3_event, d2) {
79156           context.validator().focusIssue(d2);
79157         });
79158         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
79159         buttons.append("strong").attr("class", "issue-message");
79160         buttons.filter(function(d2) {
79161           return d2.tooltip;
79162         }).call(
79163           uiTooltip().title(function(d2) {
79164             return d2.tooltip;
79165           }).placement("top")
79166         );
79167         items = itemsEnter.merge(items);
79168         items.selectAll(".issue-message").text("").each(function(d2) {
79169           return d2.message(context)(select_default2(this));
79170         });
79171       }
79172     }
79173     return commitWarnings;
79174   }
79175   var init_commit_warnings = __esm({
79176     "modules/ui/commit_warnings.js"() {
79177       "use strict";
79178       init_src5();
79179       init_localizer();
79180       init_icon();
79181       init_tooltip();
79182       init_util();
79183     }
79184   });
79185
79186   // modules/ui/lasso.js
79187   var lasso_exports = {};
79188   __export(lasso_exports, {
79189     uiLasso: () => uiLasso
79190   });
79191   function uiLasso(context) {
79192     var group, polygon2;
79193     lasso.coordinates = [];
79194     function lasso(selection2) {
79195       context.container().classed("lasso", true);
79196       group = selection2.append("g").attr("class", "lasso hide");
79197       polygon2 = group.append("path").attr("class", "lasso-path");
79198       group.call(uiToggle(true));
79199     }
79200     function draw() {
79201       if (polygon2) {
79202         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
79203           return "M" + d2.join(" L") + " Z";
79204         });
79205       }
79206     }
79207     lasso.extent = function() {
79208       return lasso.coordinates.reduce(function(extent, point) {
79209         return extent.extend(geoExtent(point));
79210       }, geoExtent());
79211     };
79212     lasso.p = function(_3) {
79213       if (!arguments.length) return lasso;
79214       lasso.coordinates.push(_3);
79215       draw();
79216       return lasso;
79217     };
79218     lasso.close = function() {
79219       if (group) {
79220         group.call(uiToggle(false, function() {
79221           select_default2(this).remove();
79222         }));
79223       }
79224       context.container().classed("lasso", false);
79225     };
79226     return lasso;
79227   }
79228   var init_lasso = __esm({
79229     "modules/ui/lasso.js"() {
79230       "use strict";
79231       init_src5();
79232       init_geo2();
79233       init_toggle();
79234     }
79235   });
79236
79237   // node_modules/osm-community-index/lib/simplify.js
79238   function simplify2(str) {
79239     if (typeof str !== "string") return "";
79240     return import_diacritics2.default.remove(
79241       str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
79242     );
79243   }
79244   var import_diacritics2;
79245   var init_simplify2 = __esm({
79246     "node_modules/osm-community-index/lib/simplify.js"() {
79247       import_diacritics2 = __toESM(require_diacritics(), 1);
79248     }
79249   });
79250
79251   // node_modules/osm-community-index/lib/resolve_strings.js
79252   function resolveStrings(item, defaults, localizerFn) {
79253     let itemStrings = Object.assign({}, item.strings);
79254     let defaultStrings = Object.assign({}, defaults[item.type]);
79255     const anyToken = new RegExp(/(\{\w+\})/, "gi");
79256     if (localizerFn) {
79257       if (itemStrings.community) {
79258         const communityID = simplify2(itemStrings.community);
79259         itemStrings.community = localizerFn(`_communities.${communityID}`);
79260       }
79261       ["name", "description", "extendedDescription"].forEach((prop) => {
79262         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
79263         if (itemStrings[prop]) itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
79264       });
79265     }
79266     let replacements = {
79267       account: item.account,
79268       community: itemStrings.community,
79269       signupUrl: itemStrings.signupUrl,
79270       url: itemStrings.url
79271     };
79272     if (!replacements.signupUrl) {
79273       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
79274     }
79275     if (!replacements.url) {
79276       replacements.url = resolve(itemStrings.url || defaultStrings.url);
79277     }
79278     let resolved = {
79279       name: resolve(itemStrings.name || defaultStrings.name),
79280       url: resolve(itemStrings.url || defaultStrings.url),
79281       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
79282       description: resolve(itemStrings.description || defaultStrings.description),
79283       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
79284     };
79285     resolved.nameHTML = linkify(resolved.url, resolved.name);
79286     resolved.urlHTML = linkify(resolved.url);
79287     resolved.signupUrlHTML = linkify(resolved.signupUrl);
79288     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
79289     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
79290     return resolved;
79291     function resolve(s2, addLinks) {
79292       if (!s2) return void 0;
79293       let result = s2;
79294       for (let key in replacements) {
79295         const token = `{${key}}`;
79296         const regex = new RegExp(token, "g");
79297         if (regex.test(result)) {
79298           let replacement = replacements[key];
79299           if (!replacement) {
79300             throw new Error(`Cannot resolve token: ${token}`);
79301           } else {
79302             if (addLinks && (key === "signupUrl" || key === "url")) {
79303               replacement = linkify(replacement);
79304             }
79305             result = result.replace(regex, replacement);
79306           }
79307         }
79308       }
79309       const leftovers = result.match(anyToken);
79310       if (leftovers) {
79311         throw new Error(`Cannot resolve tokens: ${leftovers}`);
79312       }
79313       if (addLinks && item.type === "reddit") {
79314         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
79315       }
79316       return result;
79317     }
79318     function linkify(url, text) {
79319       if (!url) return void 0;
79320       text = text || url;
79321       return `<a target="_blank" href="${url}">${text}</a>`;
79322     }
79323   }
79324   var init_resolve_strings = __esm({
79325     "node_modules/osm-community-index/lib/resolve_strings.js"() {
79326       init_simplify2();
79327     }
79328   });
79329
79330   // node_modules/osm-community-index/index.mjs
79331   var init_osm_community_index = __esm({
79332     "node_modules/osm-community-index/index.mjs"() {
79333       init_resolve_strings();
79334       init_simplify2();
79335     }
79336   });
79337
79338   // modules/ui/success.js
79339   var success_exports = {};
79340   __export(success_exports, {
79341     uiSuccess: () => uiSuccess
79342   });
79343   function uiSuccess(context) {
79344     const MAXEVENTS = 2;
79345     const dispatch14 = dispatch_default("cancel");
79346     let _changeset2;
79347     let _location;
79348     ensureOSMCommunityIndex();
79349     function ensureOSMCommunityIndex() {
79350       const data = _mainFileFetcher;
79351       return Promise.all([
79352         data.get("oci_features"),
79353         data.get("oci_resources"),
79354         data.get("oci_defaults")
79355       ]).then((vals) => {
79356         if (_oci) return _oci;
79357         if (vals[0] && Array.isArray(vals[0].features)) {
79358           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
79359         }
79360         let ociResources = Object.values(vals[1].resources);
79361         if (ociResources.length) {
79362           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
79363             _oci = {
79364               resources: ociResources,
79365               defaults: vals[2].defaults
79366             };
79367             return _oci;
79368           });
79369         } else {
79370           _oci = {
79371             resources: [],
79372             // no resources?
79373             defaults: vals[2].defaults
79374           };
79375           return _oci;
79376         }
79377       });
79378     }
79379     function parseEventDate(when) {
79380       if (!when) return;
79381       let raw = when.trim();
79382       if (!raw) return;
79383       if (!/Z$/.test(raw)) {
79384         raw += "Z";
79385       }
79386       const parsed = new Date(raw);
79387       return new Date(parsed.toUTCString().slice(0, 25));
79388     }
79389     function success(selection2) {
79390       let header = selection2.append("div").attr("class", "header fillL");
79391       header.append("h2").call(_t.append("success.just_edited"));
79392       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
79393       let body = selection2.append("div").attr("class", "body save-success fillL");
79394       let summary = body.append("div").attr("class", "save-summary");
79395       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
79396       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"));
79397       let osm = context.connection();
79398       if (!osm) return;
79399       let changesetURL = osm.changesetURL(_changeset2.id);
79400       let table = summary.append("table").attr("class", "summary-table");
79401       let row = table.append("tr").attr("class", "summary-row");
79402       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");
79403       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
79404       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
79405       summaryDetail.append("div").html(_t.html("success.changeset_id", {
79406         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
79407       }));
79408       if (showDonationMessage !== false) {
79409         const donationUrl = "https://supporting.openstreetmap.org/";
79410         let supporting = body.append("div").attr("class", "save-supporting");
79411         supporting.append("h3").call(_t.append("success.supporting.title"));
79412         supporting.append("p").call(_t.append("success.supporting.details"));
79413         table = supporting.append("table").attr("class", "supporting-table");
79414         row = table.append("tr").attr("class", "supporting-row");
79415         row.append("td").attr("class", "cell-icon supporting-icon").append("a").attr("target", "_blank").attr("href", donationUrl).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-donation");
79416         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
79417         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
79418         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
79419       }
79420       ensureOSMCommunityIndex().then((oci) => {
79421         const loc = context.map().center();
79422         const validHere = _sharedLocationManager.locationSetsAt(loc);
79423         let communities = [];
79424         oci.resources.forEach((resource) => {
79425           let area = validHere[resource.locationSetID];
79426           if (!area) return;
79427           const localizer = (stringID) => _t.html(`community.${stringID}`);
79428           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
79429           communities.push({
79430             area,
79431             order: resource.order || 0,
79432             resource
79433           });
79434         });
79435         communities.sort((a4, b3) => a4.area - b3.area || b3.order - a4.order);
79436         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
79437       });
79438     }
79439     function showCommunityLinks(selection2, resources) {
79440       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
79441       communityLinks.append("h3").call(_t.append("success.like_osm"));
79442       let table = communityLinks.append("table").attr("class", "community-table");
79443       let row = table.selectAll(".community-row").data(resources);
79444       let rowEnter = row.enter().append("tr").attr("class", "community-row");
79445       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d2) => d2.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d2) => `#community-${d2.type}`);
79446       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
79447       communityDetail.each(showCommunityDetails);
79448       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"));
79449     }
79450     function showCommunityDetails(d2) {
79451       let selection2 = select_default2(this);
79452       let communityID = d2.id;
79453       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
79454       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
79455       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
79456         selection2.append("div").call(
79457           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
79458         );
79459       }
79460       let nextEvents = (d2.events || []).map((event) => {
79461         event.date = parseEventDate(event.when);
79462         return event;
79463       }).filter((event) => {
79464         const t2 = event.date.getTime();
79465         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
79466         return !isNaN(t2) && t2 >= now3;
79467       }).sort((a4, b3) => {
79468         return a4.date < b3.date ? -1 : a4.date > b3.date ? 1 : 0;
79469       }).slice(0, MAXEVENTS);
79470       if (nextEvents.length) {
79471         selection2.append("div").call(
79472           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
79473         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
79474       }
79475       function showMore(selection3) {
79476         let more = selection3.selectAll(".community-more").data([0]);
79477         let moreEnter = more.enter().append("div").attr("class", "community-more");
79478         if (d2.resolved.extendedDescriptionHTML) {
79479           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
79480         }
79481         if (d2.languageCodes && d2.languageCodes.length) {
79482           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
79483           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
79484         }
79485       }
79486       function showNextEvents(selection3) {
79487         let events = selection3.append("div").attr("class", "community-events");
79488         let item = events.selectAll(".community-event").data(nextEvents);
79489         let itemEnter = item.enter().append("div").attr("class", "community-event");
79490         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
79491           let name = d4.name;
79492           if (d4.i18n && d4.id) {
79493             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
79494           }
79495           return name;
79496         });
79497         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
79498           let options = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
79499           if (d4.date.getHours() || d4.date.getMinutes()) {
79500             options.hour = "numeric";
79501             options.minute = "numeric";
79502           }
79503           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options);
79504         });
79505         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
79506           let where = d4.where;
79507           if (d4.i18n && d4.id) {
79508             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
79509           }
79510           return where;
79511         });
79512         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
79513           let description = d4.description;
79514           if (d4.i18n && d4.id) {
79515             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
79516           }
79517           return description;
79518         });
79519       }
79520     }
79521     success.changeset = function(val) {
79522       if (!arguments.length) return _changeset2;
79523       _changeset2 = val;
79524       return success;
79525     };
79526     success.location = function(val) {
79527       if (!arguments.length) return _location;
79528       _location = val;
79529       return success;
79530     };
79531     return utilRebind(success, dispatch14, "on");
79532   }
79533   var _oci;
79534   var init_success = __esm({
79535     "modules/ui/success.js"() {
79536       "use strict";
79537       init_src4();
79538       init_src5();
79539       init_osm_community_index();
79540       init_id();
79541       init_file_fetcher();
79542       init_LocationManager();
79543       init_localizer();
79544       init_icon();
79545       init_disclosure();
79546       init_rebind();
79547       _oci = null;
79548     }
79549   });
79550
79551   // modules/ui/index.js
79552   var ui_exports = {};
79553   __export(ui_exports, {
79554     uiAccount: () => uiAccount,
79555     uiAttribution: () => uiAttribution,
79556     uiChangesetEditor: () => uiChangesetEditor,
79557     uiCmd: () => uiCmd,
79558     uiCombobox: () => uiCombobox,
79559     uiCommit: () => uiCommit,
79560     uiCommitWarnings: () => uiCommitWarnings,
79561     uiConfirm: () => uiConfirm,
79562     uiConflicts: () => uiConflicts,
79563     uiContributors: () => uiContributors,
79564     uiCurtain: () => uiCurtain,
79565     uiDataEditor: () => uiDataEditor,
79566     uiDataHeader: () => uiDataHeader,
79567     uiDisclosure: () => uiDisclosure,
79568     uiEditMenu: () => uiEditMenu,
79569     uiEntityEditor: () => uiEntityEditor,
79570     uiFeatureInfo: () => uiFeatureInfo,
79571     uiFeatureList: () => uiFeatureList,
79572     uiField: () => uiField,
79573     uiFieldHelp: () => uiFieldHelp,
79574     uiFlash: () => uiFlash,
79575     uiFormFields: () => uiFormFields,
79576     uiFullScreen: () => uiFullScreen,
79577     uiGeolocate: () => uiGeolocate,
79578     uiInfo: () => uiInfo,
79579     uiInit: () => uiInit,
79580     uiInspector: () => uiInspector,
79581     uiIssuesInfo: () => uiIssuesInfo,
79582     uiKeepRightDetails: () => uiKeepRightDetails,
79583     uiKeepRightEditor: () => uiKeepRightEditor,
79584     uiKeepRightHeader: () => uiKeepRightHeader,
79585     uiLasso: () => uiLasso,
79586     uiLengthIndicator: () => uiLengthIndicator,
79587     uiLoading: () => uiLoading,
79588     uiMapInMap: () => uiMapInMap,
79589     uiModal: () => uiModal,
79590     uiNoteComments: () => uiNoteComments,
79591     uiNoteEditor: () => uiNoteEditor,
79592     uiNoteHeader: () => uiNoteHeader,
79593     uiNoteReport: () => uiNoteReport,
79594     uiNotice: () => uiNotice,
79595     uiPopover: () => uiPopover,
79596     uiPresetIcon: () => uiPresetIcon,
79597     uiPresetList: () => uiPresetList,
79598     uiRestore: () => uiRestore,
79599     uiScale: () => uiScale,
79600     uiSidebar: () => uiSidebar,
79601     uiSourceSwitch: () => uiSourceSwitch,
79602     uiSpinner: () => uiSpinner,
79603     uiSplash: () => uiSplash,
79604     uiStatus: () => uiStatus,
79605     uiSuccess: () => uiSuccess,
79606     uiTagReference: () => uiTagReference,
79607     uiToggle: () => uiToggle,
79608     uiTooltip: () => uiTooltip,
79609     uiVersion: () => uiVersion,
79610     uiViewOnKeepRight: () => uiViewOnKeepRight,
79611     uiViewOnOSM: () => uiViewOnOSM,
79612     uiZoom: () => uiZoom
79613   });
79614   var init_ui = __esm({
79615     "modules/ui/index.js"() {
79616       "use strict";
79617       init_init2();
79618       init_account();
79619       init_attribution();
79620       init_changeset_editor();
79621       init_cmd();
79622       init_combobox();
79623       init_commit();
79624       init_commit_warnings();
79625       init_confirm();
79626       init_conflicts();
79627       init_contributors();
79628       init_curtain();
79629       init_data_editor();
79630       init_data_header();
79631       init_disclosure();
79632       init_edit_menu();
79633       init_entity_editor();
79634       init_feature_info();
79635       init_feature_list();
79636       init_field2();
79637       init_field_help();
79638       init_flash();
79639       init_form_fields();
79640       init_full_screen();
79641       init_geolocate2();
79642       init_info();
79643       init_inspector();
79644       init_issues_info();
79645       init_keepRight_details();
79646       init_keepRight_editor();
79647       init_keepRight_header();
79648       init_length_indicator();
79649       init_lasso();
79650       init_loading();
79651       init_map_in_map();
79652       init_modal();
79653       init_notice();
79654       init_note_comments();
79655       init_note_editor();
79656       init_note_header();
79657       init_note_report();
79658       init_popover();
79659       init_preset_icon();
79660       init_preset_list();
79661       init_restore();
79662       init_scale2();
79663       init_sidebar();
79664       init_source_switch();
79665       init_spinner();
79666       init_splash();
79667       init_status();
79668       init_success();
79669       init_tag_reference();
79670       init_toggle();
79671       init_tooltip();
79672       init_version();
79673       init_view_on_osm();
79674       init_view_on_keepRight();
79675       init_zoom3();
79676     }
79677   });
79678
79679   // modules/ui/fields/input.js
79680   var input_exports = {};
79681   __export(input_exports, {
79682     likelyRawNumberFormat: () => likelyRawNumberFormat,
79683     uiFieldColour: () => uiFieldText,
79684     uiFieldEmail: () => uiFieldText,
79685     uiFieldIdentifier: () => uiFieldText,
79686     uiFieldNumber: () => uiFieldText,
79687     uiFieldTel: () => uiFieldText,
79688     uiFieldText: () => uiFieldText,
79689     uiFieldUrl: () => uiFieldText
79690   });
79691   function uiFieldText(field, context) {
79692     var dispatch14 = dispatch_default("change");
79693     var input = select_default2(null);
79694     var outlinkButton = select_default2(null);
79695     var wrap2 = select_default2(null);
79696     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
79697     var _entityIDs = [];
79698     var _tags;
79699     var _phoneFormats = {};
79700     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
79701     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
79702     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
79703     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
79704     if (field.type === "tel") {
79705       _mainFileFetcher.get("phone_formats").then(function(d2) {
79706         _phoneFormats = d2;
79707         updatePhonePlaceholder();
79708       }).catch(function() {
79709       });
79710     }
79711     function calcLocked() {
79712       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
79713         var entity = context.graph().hasEntity(entityID);
79714         if (!entity) return false;
79715         if (entity.tags.wikidata) return true;
79716         var preset = _mainPresetIndex.match(entity, context.graph());
79717         var isSuggestion = preset && preset.suggestion;
79718         var which = field.id;
79719         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
79720       });
79721       field.locked(isLocked);
79722     }
79723     function i3(selection2) {
79724       calcLocked();
79725       var isLocked = field.locked();
79726       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
79727       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
79728       input = wrap2.selectAll("input").data([0]);
79729       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);
79730       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
79731       wrap2.call(_lengthIndicator);
79732       if (field.type === "tel") {
79733         updatePhonePlaceholder();
79734       } else if (field.type === "number") {
79735         var rtl = _mainLocalizer.textDirection() === "rtl";
79736         input.attr("type", "text");
79737         var inc = field.increment;
79738         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
79739         buttons.enter().append("button").attr("class", function(d2) {
79740           var which = d2 > 0 ? "increment" : "decrement";
79741           return "form-field-button " + which;
79742         }).attr("title", function(d2) {
79743           var which = d2 > 0 ? "increment" : "decrement";
79744           return _t(`inspector.${which}`);
79745         }).merge(buttons).on("click", function(d3_event, d2) {
79746           d3_event.preventDefault();
79747           var isMixed = Array.isArray(_tags[field.key]);
79748           if (isMixed) return;
79749           var raw_vals = input.node().value || "0";
79750           var vals = raw_vals.split(";");
79751           vals = vals.map(function(v3) {
79752             v3 = v3.trim();
79753             const isRawNumber = likelyRawNumberFormat.test(v3);
79754             var num = isRawNumber ? parseFloat(v3) : parseLocaleFloat(v3);
79755             if (isDirectionField) {
79756               const compassDir = cardinal[v3.toLowerCase()];
79757               if (compassDir !== void 0) {
79758                 num = compassDir;
79759               }
79760             }
79761             if (!isFinite(num)) return v3;
79762             num = parseFloat(num);
79763             if (!isFinite(num)) return v3;
79764             num += d2;
79765             if (isDirectionField) {
79766               num = (num % 360 + 360) % 360;
79767             }
79768             return formatFloat(clamped(num), isRawNumber ? v3.includes(".") ? v3.split(".")[1].length : 0 : countDecimalPlaces(v3));
79769           });
79770           input.node().value = vals.join(";");
79771           change()();
79772         });
79773       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
79774         input.attr("type", "text");
79775         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79776         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
79777           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
79778           if (domainResults.length >= 2 && domainResults[1]) {
79779             var domain = domainResults[1];
79780             return _t("icons.view_on", { domain });
79781           }
79782           return "";
79783         }).merge(outlinkButton);
79784         outlinkButton.on("click", function(d3_event) {
79785           d3_event.preventDefault();
79786           var value = validIdentifierValueForLink();
79787           if (value) {
79788             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
79789             window.open(url, "_blank");
79790           }
79791         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
79792       } else if (field.type === "url") {
79793         input.attr("type", "text");
79794         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
79795         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) {
79796           d3_event.preventDefault();
79797           const value = validIdentifierValueForLink();
79798           if (value) window.open(value, "_blank");
79799         }).merge(outlinkButton);
79800       } else if (field.type === "colour") {
79801         input.attr("type", "text");
79802         updateColourPreview();
79803       } else if (field.type === "date") {
79804         input.attr("type", "text");
79805         updateDateField();
79806       }
79807     }
79808     function updateColourPreview() {
79809       wrap2.selectAll(".colour-preview").remove();
79810       const colour = utilGetSetValue(input);
79811       if (!isColourValid(colour) && colour !== "") {
79812         wrap2.selectAll("input.colour-selector").remove();
79813         wrap2.selectAll(".form-field-button").remove();
79814         return;
79815       }
79816       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
79817       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
79818         d3_event.preventDefault();
79819         var colour2 = this.value;
79820         if (!isColourValid(colour2)) return;
79821         utilGetSetValue(input, this.value);
79822         change()();
79823         updateColourPreview();
79824       }, 100));
79825       wrap2.selectAll("input.colour-selector").attr("value", colour);
79826       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
79827       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
79828       if (colour === "") {
79829         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
79830       }
79831       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
79832     }
79833     function updateDateField() {
79834       function isDateValid(date2) {
79835         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
79836       }
79837       const date = utilGetSetValue(input);
79838       const now3 = /* @__PURE__ */ new Date();
79839       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
79840       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
79841         wrap2.selectAll(".date-set-today").data([0]).enter().append("button").attr("class", "form-field-button date-set-today").call(svgIcon("#fas-rotate")).call(uiTooltip().title(() => _t.append("inspector.set_today"))).on("click", () => {
79842           utilGetSetValue(input, today);
79843           change()();
79844           updateDateField();
79845         });
79846       } else {
79847         wrap2.selectAll(".date-set-today").remove();
79848       }
79849       if (!isDateValid(date) && date !== "") {
79850         wrap2.selectAll("input.date-selector").remove();
79851         wrap2.selectAll(".date-calendar").remove();
79852         return;
79853       }
79854       if (utilDetect().browser !== "Safari") {
79855         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
79856         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
79857           d3_event.preventDefault();
79858           var date2 = this.value;
79859           if (!isDateValid(date2)) return;
79860           utilGetSetValue(input, this.value);
79861           change()();
79862           updateDateField();
79863         }, 100));
79864         wrap2.selectAll("input.date-selector").attr("value", date);
79865         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
79866         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
79867         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
79868       }
79869     }
79870     function updatePhonePlaceholder() {
79871       if (input.empty() || !Object.keys(_phoneFormats).length) return;
79872       var extent = combinedEntityExtent();
79873       var countryCode = extent && iso1A2Code(extent.center());
79874       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
79875       if (format2) input.attr("placeholder", format2);
79876     }
79877     function validIdentifierValueForLink() {
79878       var _a4;
79879       const value = utilGetSetValue(input).trim();
79880       if (field.type === "url" && value) {
79881         try {
79882           return new URL(value).href;
79883         } catch {
79884           return null;
79885         }
79886       }
79887       if (field.type === "identifier" && field.pattern) {
79888         return value && ((_a4 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a4[0]);
79889       }
79890       return null;
79891     }
79892     function clamped(num) {
79893       if (field.minValue !== void 0) {
79894         num = Math.max(num, field.minValue);
79895       }
79896       if (field.maxValue !== void 0) {
79897         num = Math.min(num, field.maxValue);
79898       }
79899       return num;
79900     }
79901     function getVals(tags) {
79902       if (field.keys) {
79903         const multiSelection = context.selectedIDs();
79904         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
79905         return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a4, b3) => /* @__PURE__ */ new Set([...a4, ...b3]));
79906       } else {
79907         return new Set([].concat(tags[field.key]));
79908       }
79909     }
79910     function change(onInput) {
79911       return function() {
79912         var t2 = {};
79913         var val = utilGetSetValue(input);
79914         if (!onInput) val = context.cleanTagValue(val);
79915         if (!val && getVals(_tags).size > 1) return;
79916         let displayVal = val;
79917         if (field.type === "number" && val) {
79918           const numbers2 = val.split(";").map((v3) => {
79919             if (likelyRawNumberFormat.test(v3)) {
79920               return {
79921                 v: v3,
79922                 num: parseFloat(v3),
79923                 fractionDigits: v3.includes(".") ? v3.split(".")[1].length : 0
79924               };
79925             } else {
79926               return {
79927                 v: v3,
79928                 num: parseLocaleFloat(v3),
79929                 fractionDigits: countDecimalPlaces(v3)
79930               };
79931             }
79932           });
79933           val = numbers2.map(({ num, v: v3, fractionDigits }) => {
79934             if (!isFinite(num)) return v3;
79935             return clamped(num).toFixed(fractionDigits);
79936           }).join(";");
79937           displayVal = numbers2.map(({ num, v: v3, fractionDigits }) => {
79938             if (!isFinite(num)) return v3;
79939             return formatFloat(clamped(num), fractionDigits);
79940           }).join(";");
79941         }
79942         if (!onInput) utilGetSetValue(input, displayVal);
79943         t2[field.key] = val || void 0;
79944         if (field.keys) {
79945           dispatch14.call("change", this, (tags) => {
79946             if (field.keys.some((key) => tags[key])) {
79947               field.keys.filter((key) => tags[key]).forEach((key) => {
79948                 tags[key] = val || void 0;
79949               });
79950             } else {
79951               tags[field.key] = val || void 0;
79952             }
79953             return tags;
79954           }, onInput);
79955         } else {
79956           dispatch14.call("change", this, t2, onInput);
79957         }
79958       };
79959     }
79960     i3.entityIDs = function(val) {
79961       if (!arguments.length) return _entityIDs;
79962       _entityIDs = val;
79963       return i3;
79964     };
79965     i3.tags = function(tags) {
79966       var _a4;
79967       _tags = tags;
79968       const vals = getVals(tags);
79969       const isMixed = vals.size > 1;
79970       var val = vals.size === 1 ? (_a4 = [...vals][0]) != null ? _a4 : "" : "";
79971       var shouldUpdate;
79972       if (field.type === "number" && val) {
79973         var numbers2 = val.split(";");
79974         var oriNumbers = utilGetSetValue(input).split(";");
79975         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
79976         numbers2 = numbers2.map(function(v3) {
79977           v3 = v3.trim();
79978           var num = Number(v3);
79979           if (!isFinite(num) || v3 === "") return v3;
79980           const fractionDigits = v3.includes(".") ? v3.split(".")[1].length : 0;
79981           return formatFloat(num, fractionDigits);
79982         });
79983         val = numbers2.join(";");
79984         shouldUpdate = (inputValue, setValue) => {
79985           const inputNums = inputValue.split(";").map((val2) => {
79986             const parsedNum = likelyRawNumberFormat.test(val2) ? parseFloat(val2) : parseLocaleFloat(val2);
79987             if (!isFinite(parsedNum)) return val2;
79988             return parsedNum;
79989           });
79990           const setNums = setValue.split(";").map((val2) => {
79991             const parsedNum = parseLocaleFloat(val2);
79992             if (!isFinite(parsedNum)) return val2;
79993             return parsedNum;
79994           });
79995           return !isEqual_default(inputNums, setNums);
79996         };
79997       }
79998       utilGetSetValue(input, val, shouldUpdate).attr("title", isMixed ? [...vals].join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
79999       if (field.type === "number") {
80000         const buttons = wrap2.selectAll(".increment, .decrement");
80001         if (isMixed) {
80002           buttons.attr("disabled", "disabled").classed("disabled", true);
80003         } else {
80004           var raw_vals = tags[field.key] || "0";
80005           const canIncDec = raw_vals.split(";").some(
80006             (val2) => isFinite(Number(val2)) || isDirectionField && val2.trim().toLowerCase() in cardinal
80007           );
80008           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
80009         }
80010       }
80011       if (field.type === "tel") updatePhonePlaceholder();
80012       if (field.type === "colour") updateColourPreview();
80013       if (field.type === "date") updateDateField();
80014       if (outlinkButton && !outlinkButton.empty()) {
80015         var disabled = !validIdentifierValueForLink();
80016         outlinkButton.classed("disabled", disabled);
80017       }
80018       if (!isMixed) {
80019         _lengthIndicator.update(tags[field.key]);
80020       }
80021     };
80022     i3.focus = function() {
80023       var node = input.node();
80024       if (node) node.focus();
80025     };
80026     function combinedEntityExtent() {
80027       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80028     }
80029     return utilRebind(i3, dispatch14, "on");
80030   }
80031   var likelyRawNumberFormat;
80032   var init_input = __esm({
80033     "modules/ui/fields/input.js"() {
80034       "use strict";
80035       init_src4();
80036       init_src5();
80037       init_debounce();
80038       init_country_coder();
80039       init_presets();
80040       init_file_fetcher();
80041       init_localizer();
80042       init_util();
80043       init_icon();
80044       init_node2();
80045       init_tags();
80046       init_ui();
80047       init_tooltip();
80048       init_lodash();
80049       likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
80050     }
80051   });
80052
80053   // modules/ui/fields/access.js
80054   var access_exports = {};
80055   __export(access_exports, {
80056     uiFieldAccess: () => uiFieldAccess
80057   });
80058   function uiFieldAccess(field, context) {
80059     var dispatch14 = dispatch_default("change");
80060     var items = select_default2(null);
80061     var _tags;
80062     function access(selection2) {
80063       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80064       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80065       var list = wrap2.selectAll("ul").data([0]);
80066       list = list.enter().append("ul").attr("class", "rows").merge(list);
80067       items = list.selectAll("li").data(field.keys);
80068       var enter = items.enter().append("li").attr("class", function(d2) {
80069         return "labeled-input preset-access-" + d2;
80070       });
80071       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
80072         return "preset-input-access-" + d2;
80073       }).html(function(d2) {
80074         return field.t.html("types." + d2);
80075       });
80076       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
80077         return "preset-input-access preset-input-access-" + d2;
80078       }).call(utilNoAuto).each(function(d2) {
80079         select_default2(this).call(
80080           uiCombobox(context, "access-" + d2).data(access.options(d2))
80081         );
80082       });
80083       items = items.merge(enter);
80084       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
80085     }
80086     function change(d3_event, d2) {
80087       var tag = {};
80088       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
80089       if (!value && typeof _tags[d2] !== "string") return;
80090       tag[d2] = value || void 0;
80091       dispatch14.call("change", this, tag);
80092     }
80093     access.options = function(type2) {
80094       var options = [
80095         "yes",
80096         "no",
80097         "designated",
80098         "permissive",
80099         "destination",
80100         "customers",
80101         "private",
80102         "permit",
80103         "unknown"
80104       ];
80105       if (type2 === "access") {
80106         options = options.filter((v3) => v3 !== "yes" && v3 !== "designated");
80107       }
80108       if (type2 === "bicycle") {
80109         options.splice(options.length - 4, 0, "dismount");
80110       }
80111       var stringsField = field.resolveReference("stringsCrossReference");
80112       return options.map(function(option) {
80113         return {
80114           title: stringsField.t("options." + option + ".description"),
80115           value: option
80116         };
80117       });
80118     };
80119     const placeholdersByTag = {
80120       highway: {
80121         footway: {
80122           foot: "designated",
80123           motor_vehicle: "no"
80124         },
80125         steps: {
80126           foot: "yes",
80127           motor_vehicle: "no",
80128           bicycle: "no",
80129           horse: "no"
80130         },
80131         ladder: {
80132           foot: "yes",
80133           motor_vehicle: "no",
80134           bicycle: "no",
80135           horse: "no"
80136         },
80137         pedestrian: {
80138           foot: "yes",
80139           motor_vehicle: "no"
80140         },
80141         cycleway: {
80142           motor_vehicle: "no",
80143           bicycle: "designated"
80144         },
80145         bridleway: {
80146           motor_vehicle: "no",
80147           horse: "designated"
80148         },
80149         path: {
80150           foot: "yes",
80151           motor_vehicle: "no",
80152           bicycle: "yes",
80153           horse: "yes"
80154         },
80155         motorway: {
80156           foot: "no",
80157           motor_vehicle: "yes",
80158           bicycle: "no",
80159           horse: "no"
80160         },
80161         trunk: {
80162           motor_vehicle: "yes"
80163         },
80164         primary: {
80165           foot: "yes",
80166           motor_vehicle: "yes",
80167           bicycle: "yes",
80168           horse: "yes"
80169         },
80170         secondary: {
80171           foot: "yes",
80172           motor_vehicle: "yes",
80173           bicycle: "yes",
80174           horse: "yes"
80175         },
80176         tertiary: {
80177           foot: "yes",
80178           motor_vehicle: "yes",
80179           bicycle: "yes",
80180           horse: "yes"
80181         },
80182         residential: {
80183           foot: "yes",
80184           motor_vehicle: "yes",
80185           bicycle: "yes",
80186           horse: "yes"
80187         },
80188         unclassified: {
80189           foot: "yes",
80190           motor_vehicle: "yes",
80191           bicycle: "yes",
80192           horse: "yes"
80193         },
80194         service: {
80195           foot: "yes",
80196           motor_vehicle: "yes",
80197           bicycle: "yes",
80198           horse: "yes"
80199         },
80200         motorway_link: {
80201           foot: "no",
80202           motor_vehicle: "yes",
80203           bicycle: "no",
80204           horse: "no"
80205         },
80206         trunk_link: {
80207           motor_vehicle: "yes"
80208         },
80209         primary_link: {
80210           foot: "yes",
80211           motor_vehicle: "yes",
80212           bicycle: "yes",
80213           horse: "yes"
80214         },
80215         secondary_link: {
80216           foot: "yes",
80217           motor_vehicle: "yes",
80218           bicycle: "yes",
80219           horse: "yes"
80220         },
80221         tertiary_link: {
80222           foot: "yes",
80223           motor_vehicle: "yes",
80224           bicycle: "yes",
80225           horse: "yes"
80226         },
80227         construction: {
80228           access: "no"
80229         },
80230         busway: {
80231           access: "no",
80232           bus: "designated",
80233           emergency: "yes"
80234         }
80235       },
80236       barrier: {
80237         bollard: {
80238           access: "no",
80239           bicycle: "yes",
80240           foot: "yes"
80241         },
80242         bus_trap: {
80243           motor_vehicle: "no",
80244           psv: "yes",
80245           foot: "yes",
80246           bicycle: "yes"
80247         },
80248         city_wall: {
80249           access: "no"
80250         },
80251         coupure: {
80252           access: "yes"
80253         },
80254         cycle_barrier: {
80255           motor_vehicle: "no"
80256         },
80257         ditch: {
80258           access: "no"
80259         },
80260         entrance: {
80261           access: "yes"
80262         },
80263         fence: {
80264           access: "no"
80265         },
80266         hedge: {
80267           access: "no"
80268         },
80269         jersey_barrier: {
80270           access: "no"
80271         },
80272         motorcycle_barrier: {
80273           motor_vehicle: "no"
80274         },
80275         rail_guard: {
80276           access: "no"
80277         }
80278       }
80279     };
80280     access.tags = function(tags) {
80281       _tags = tags;
80282       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
80283         return typeof tags[d2] === "string" ? tags[d2] : "";
80284       }).classed("mixed", function(accessField) {
80285         return tags[accessField] && Array.isArray(tags[accessField]) || new Set(getAllPlaceholders(tags, accessField)).size > 1;
80286       }).attr("title", function(accessField) {
80287         return tags[accessField] && Array.isArray(tags[accessField]) && tags[accessField].filter(Boolean).join("\n");
80288       }).attr("placeholder", function(accessField) {
80289         let placeholders = getAllPlaceholders(tags, accessField);
80290         if (new Set(placeholders).size === 1) {
80291           return placeholders[0];
80292         } else {
80293           return _t("inspector.multiple_values");
80294         }
80295       });
80296       function getAllPlaceholders(tags2, accessField) {
80297         let allTags = tags2[Symbol.for("allTags")];
80298         if (allTags && allTags.length > 1) {
80299           const placeholders = [];
80300           allTags.forEach((tags3) => {
80301             placeholders.push(getPlaceholder(tags3, accessField));
80302           });
80303           return placeholders;
80304         } else {
80305           return [getPlaceholder(tags2, accessField)];
80306         }
80307       }
80308       function getPlaceholder(tags2, accessField) {
80309         if (tags2[accessField]) {
80310           return tags2[accessField];
80311         }
80312         if (tags2.motorroad === "yes" && (accessField === "foot" || accessField === "bicycle" || accessField === "horse")) {
80313           return "no";
80314         }
80315         if (tags2.vehicle && (accessField === "bicycle" || accessField === "motor_vehicle")) {
80316           return tags2.vehicle;
80317         }
80318         if (tags2.access) {
80319           return tags2.access;
80320         }
80321         for (const key in placeholdersByTag) {
80322           if (tags2[key]) {
80323             if (placeholdersByTag[key][tags2[key]] && placeholdersByTag[key][tags2[key]][accessField]) {
80324               return placeholdersByTag[key][tags2[key]][accessField];
80325             }
80326           }
80327         }
80328         if (accessField === "access" && !tags2.barrier) {
80329           return "yes";
80330         }
80331         return field.placeholder();
80332       }
80333     };
80334     access.focus = function() {
80335       items.selectAll(".preset-input-access").node().focus();
80336     };
80337     return utilRebind(access, dispatch14, "on");
80338   }
80339   var init_access = __esm({
80340     "modules/ui/fields/access.js"() {
80341       "use strict";
80342       init_src4();
80343       init_src5();
80344       init_combobox();
80345       init_util();
80346       init_localizer();
80347     }
80348   });
80349
80350   // modules/ui/fields/address.js
80351   var address_exports = {};
80352   __export(address_exports, {
80353     uiFieldAddress: () => uiFieldAddress
80354   });
80355   function uiFieldAddress(field, context) {
80356     var dispatch14 = dispatch_default("change");
80357     var _selection = select_default2(null);
80358     var _wrap = select_default2(null);
80359     var addrField = _mainPresetIndex.field("address");
80360     var _entityIDs = [];
80361     var _tags;
80362     var _countryCode;
80363     var _addressFormats = [{
80364       format: [
80365         ["housenumber", "street"],
80366         ["city", "postcode"]
80367       ]
80368     }];
80369     _mainFileFetcher.get("address_formats").then(function(d2) {
80370       _addressFormats = d2;
80371       if (!_selection.empty()) {
80372         _selection.call(address);
80373       }
80374     }).catch(function() {
80375     });
80376     function getNear(isAddressable, type2, searchRadius, resultProp) {
80377       var extent = combinedEntityExtent();
80378       var l2 = extent.center();
80379       var box = extent.padByMeters(searchRadius);
80380       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
80381         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
80382         if (d2.geometry(context.graph()) === "line") {
80383           var loc = context.projection([
80384             (extent[0][0] + extent[1][0]) / 2,
80385             (extent[0][1] + extent[1][1]) / 2
80386           ]);
80387           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
80388           dist = geoSphericalDistance(choice.loc, l2);
80389         }
80390         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80391         let title = value;
80392         if (type2 === "street") {
80393           title = `${addrField.t("placeholders.street")}: ${title}`;
80394         } else if (type2 === "place") {
80395           title = `${addrField.t("placeholders.place")}: ${title}`;
80396         }
80397         return {
80398           title,
80399           value,
80400           dist,
80401           type: type2,
80402           klass: `address-${type2}`
80403         };
80404       }).sort(function(a4, b3) {
80405         return a4.dist - b3.dist;
80406       });
80407       return utilArrayUniqBy(features, "value");
80408     }
80409     function getEnclosing(isAddressable, type2, resultProp) {
80410       var extent = combinedEntityExtent();
80411       var features = context.history().intersects(extent).filter(isAddressable).map((d2) => {
80412         if (d2.geometry(context.graph()) !== "area") {
80413           return false;
80414         }
80415         const geom = d2.asGeoJSON(context.graph()).coordinates[0];
80416         if (!geoPolygonContainsPolygon(geom, extent.polygon())) {
80417           return false;
80418         }
80419         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
80420         return {
80421           title: value,
80422           value,
80423           dist: 0,
80424           geom,
80425           type: type2,
80426           klass: `address-${type2}`
80427         };
80428       }).filter(Boolean);
80429       return utilArrayUniqBy(features, "value");
80430     }
80431     function getNearStreets() {
80432       function isAddressable(d2) {
80433         return d2.tags.highway && d2.tags.name && d2.type === "way";
80434       }
80435       return getNear(isAddressable, "street", 200);
80436     }
80437     function getNearPlaces() {
80438       function isAddressable(d2) {
80439         if (d2.tags.name) {
80440           if (d2.tags.place) return true;
80441           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
80442         }
80443         return false;
80444       }
80445       return getNear(isAddressable, "place", 200);
80446     }
80447     function getNearCities() {
80448       function isAddressable(d2) {
80449         if (d2.tags.name) {
80450           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
80451           if (d2.tags.border_type === "city") return true;
80452           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
80453         }
80454         if (d2.tags[`${field.key}:city`]) return true;
80455         return false;
80456       }
80457       return getNear(isAddressable, "city", 200, `${field.key}:city`);
80458     }
80459     function getNearPostcodes() {
80460       const postcodes = [].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code"));
80461       return utilArrayUniqBy(postcodes, (item) => item.value);
80462     }
80463     function getNearValues(key) {
80464       const tagKey = `${field.key}:${key}`;
80465       function hasTag(d2) {
80466         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80467       }
80468       return getNear(hasTag, key, 200, tagKey);
80469     }
80470     function getEnclosingValues(key) {
80471       const tagKey = `${field.key}:${key}`;
80472       function hasTag(d2) {
80473         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
80474       }
80475       const enclosingAddresses = getEnclosing(hasTag, key, tagKey);
80476       function isBuilding(d2) {
80477         return _entityIDs.indexOf(d2.id) === -1 && d2.tags.building && d2.tags.building !== "no";
80478       }
80479       const enclosingBuildings = getEnclosing(isBuilding, "building", "building").map((d2) => d2.geom);
80480       function isInNearbyBuilding(d2) {
80481         return hasTag(d2) && d2.type === "node" && enclosingBuildings.some(
80482           (geom) => geoPointInPolygon(d2.loc, geom) || geom.indexOf(d2.loc) !== -1
80483         );
80484       }
80485       const nearPointAddresses = getNear(isInNearbyBuilding, key, 100, tagKey);
80486       return utilArrayUniqBy([
80487         ...enclosingAddresses,
80488         ...nearPointAddresses
80489       ], "value").sort((a4, b3) => a4.value > b3.value ? 1 : -1);
80490     }
80491     function updateForCountryCode() {
80492       if (!_countryCode) return;
80493       var addressFormat;
80494       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
80495         var format2 = _addressFormats[i3];
80496         if (!format2.countryCodes) {
80497           addressFormat = format2;
80498         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
80499           addressFormat = format2;
80500           break;
80501         }
80502       }
80503       const maybeDropdowns = /* @__PURE__ */ new Set([
80504         "housenumber",
80505         "housename"
80506       ]);
80507       const dropdowns = /* @__PURE__ */ new Set([
80508         "block_number",
80509         "city",
80510         "country",
80511         "county",
80512         "district",
80513         "floor",
80514         "hamlet",
80515         "neighbourhood",
80516         "place",
80517         "postcode",
80518         "province",
80519         "quarter",
80520         "state",
80521         "street",
80522         "street+place",
80523         "subdistrict",
80524         "suburb",
80525         "town",
80526         ...maybeDropdowns
80527       ]);
80528       var widths = addressFormat.widths || {
80529         housenumber: 1 / 5,
80530         unit: 1 / 5,
80531         street: 1 / 2,
80532         place: 1 / 2,
80533         city: 2 / 3,
80534         state: 1 / 4,
80535         postcode: 1 / 3
80536       };
80537       function row(r2) {
80538         var total = r2.reduce(function(sum, key) {
80539           return sum + (widths[key] || 0.5);
80540         }, 0);
80541         return r2.map(function(key) {
80542           return {
80543             id: key,
80544             width: (widths[key] || 0.5) / total
80545           };
80546         });
80547       }
80548       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
80549         return d2.toString();
80550       });
80551       rows.exit().remove();
80552       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").attr("id", (d2) => d2.id === "housenumber" ? field.domId : null).attr("class", function(d2) {
80553         return "addr-" + d2.id;
80554       }).call(utilNoAuto).each(addDropdown).call(updatePlaceholder).style("width", function(d2) {
80555         return d2.width * 100 + "%";
80556       });
80557       function addDropdown(d2) {
80558         if (!dropdowns.has(d2.id)) {
80559           return false;
80560         }
80561         var nearValues;
80562         switch (d2.id) {
80563           case "street":
80564             nearValues = getNearStreets;
80565             break;
80566           case "place":
80567             nearValues = getNearPlaces;
80568             break;
80569           case "street+place":
80570             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
80571             d2.isAutoStreetPlace = true;
80572             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
80573             break;
80574           case "city":
80575             nearValues = getNearCities;
80576             break;
80577           case "postcode":
80578             nearValues = getNearPostcodes;
80579             break;
80580           case "housenumber":
80581           case "housename":
80582             nearValues = getEnclosingValues;
80583             break;
80584           default:
80585             nearValues = getNearValues;
80586         }
80587         if (maybeDropdowns.has(d2.id)) {
80588           const candidates = nearValues(d2.id);
80589           if (candidates.length === 0) return false;
80590         }
80591         select_default2(this).call(
80592           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
80593             typedValue = typedValue.toLowerCase();
80594             callback(nearValues(d2.id).filter((v3) => v3.value.toLowerCase().indexOf(typedValue) !== -1));
80595           }).on("accept", function(selected) {
80596             if (d2.isAutoStreetPlace) {
80597               d2.id = selected ? selected.type : "street";
80598               utilTriggerEvent(select_default2(this), "change");
80599             }
80600           })
80601         );
80602       }
80603       _wrap.selectAll("input").on("input", change(true)).on("blur", change()).on("change", change());
80604       if (_tags) updateTags(_tags);
80605     }
80606     function address(selection2) {
80607       _selection = selection2;
80608       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
80609       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
80610       var extent = combinedEntityExtent();
80611       if (extent) {
80612         var countryCode;
80613         if (context.inIntro()) {
80614           countryCode = _t("intro.graph.countrycode");
80615         } else {
80616           var center = extent.center();
80617           countryCode = iso1A2Code(center);
80618         }
80619         if (countryCode) {
80620           _countryCode = countryCode.toLowerCase();
80621           updateForCountryCode();
80622         }
80623       }
80624     }
80625     function change(onInput) {
80626       return function() {
80627         var tags = {};
80628         _wrap.selectAll("input").each(function(subfield) {
80629           var key = field.key + ":" + subfield.id;
80630           var value = this.value;
80631           if (!onInput) value = context.cleanTagValue(value);
80632           if (Array.isArray(_tags[key]) && !value) return;
80633           if (subfield.isAutoStreetPlace) {
80634             if (subfield.id === "street") {
80635               tags[`${field.key}:place`] = void 0;
80636             } else if (subfield.id === "place") {
80637               tags[`${field.key}:street`] = void 0;
80638             }
80639           }
80640           tags[key] = value || void 0;
80641         });
80642         Object.keys(tags).filter((k3) => tags[k3]).forEach((k3) => _tags[k3] = tags[k3]);
80643         dispatch14.call("change", this, tags, onInput);
80644       };
80645     }
80646     function updatePlaceholder(inputSelection) {
80647       return inputSelection.attr("placeholder", function(subfield) {
80648         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
80649           return _t("inspector.multiple_values");
80650         }
80651         if (subfield.isAutoStreetPlace) {
80652           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
80653         }
80654         return getLocalPlaceholder(subfield.id);
80655       });
80656     }
80657     function getLocalPlaceholder(key) {
80658       if (_countryCode) {
80659         var localkey = key + "!" + _countryCode;
80660         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
80661         return addrField.t("placeholders." + tkey);
80662       }
80663     }
80664     function updateTags(tags) {
80665       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
80666         var val;
80667         if (subfield.isAutoStreetPlace) {
80668           const streetKey = `${field.key}:street`;
80669           const placeKey = `${field.key}:place`;
80670           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
80671             val = tags[streetKey];
80672             subfield.id = "street";
80673           } else {
80674             val = tags[placeKey];
80675             subfield.id = "place";
80676           }
80677         } else {
80678           val = tags[`${field.key}:${subfield.id}`];
80679         }
80680         return typeof val === "string" ? val : "";
80681       }).attr("title", function(subfield) {
80682         var val = tags[field.key + ":" + subfield.id];
80683         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
80684       }).classed("mixed", function(subfield) {
80685         return Array.isArray(tags[field.key + ":" + subfield.id]);
80686       }).call(updatePlaceholder);
80687     }
80688     function combinedEntityExtent() {
80689       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
80690     }
80691     address.entityIDs = function(val) {
80692       if (!arguments.length) return _entityIDs;
80693       _entityIDs = val;
80694       return address;
80695     };
80696     address.tags = function(tags) {
80697       _tags = tags;
80698       updateTags(tags);
80699     };
80700     address.focus = function() {
80701       var node = _wrap.selectAll("input").node();
80702       if (node) node.focus();
80703     };
80704     return utilRebind(address, dispatch14, "on");
80705   }
80706   var init_address = __esm({
80707     "modules/ui/fields/address.js"() {
80708       "use strict";
80709       init_src4();
80710       init_src5();
80711       init_country_coder();
80712       init_presets();
80713       init_file_fetcher();
80714       init_geo2();
80715       init_combobox();
80716       init_util();
80717       init_localizer();
80718     }
80719   });
80720
80721   // modules/ui/fields/directional_combo.js
80722   var directional_combo_exports = {};
80723   __export(directional_combo_exports, {
80724     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo
80725   });
80726   function uiFieldDirectionalCombo(field, context) {
80727     var dispatch14 = dispatch_default("change");
80728     var items = select_default2(null);
80729     var wrap2 = select_default2(null);
80730     var _tags;
80731     var _combos = {};
80732     if (field.type === "cycleway") {
80733       field = {
80734         ...field,
80735         key: field.keys[0],
80736         keys: field.keys.slice(1)
80737       };
80738     }
80739     function directionalCombo(selection2) {
80740       function stripcolon(s2) {
80741         return s2.replace(":", "");
80742       }
80743       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80744       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80745       var div = wrap2.selectAll("ul").data([0]);
80746       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
80747       items = div.selectAll("li").data(field.keys);
80748       var enter = items.enter().append("li").attr("class", function(d2) {
80749         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
80750       });
80751       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
80752         return "preset-input-directionalcombo-" + stripcolon(d2);
80753       }).html(function(d2) {
80754         return field.t.html("types." + d2);
80755       });
80756       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
80757         const subField = {
80758           ...field,
80759           type: "combo",
80760           key
80761         };
80762         const combo = uiFieldCombo(subField, context);
80763         combo.on("change", (t2) => change(key, t2[key]));
80764         _combos[key] = combo;
80765         select_default2(this).call(combo);
80766       });
80767       items = items.merge(enter);
80768       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
80769     }
80770     function change(key, newValue) {
80771       const commonKey = field.key;
80772       const otherCommonKey = field.key.endsWith(":both") ? field.key.replace(/:both$/, "") : `${field.key}:both`;
80773       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
80774       dispatch14.call("change", this, (tags) => {
80775         const otherValue = tags[otherKey] || tags[commonKey] || tags[otherCommonKey];
80776         if (newValue === otherValue) {
80777           tags[commonKey] = newValue;
80778           delete tags[key];
80779           delete tags[otherKey];
80780           delete tags[otherCommonKey];
80781         } else {
80782           tags[key] = newValue;
80783           delete tags[commonKey];
80784           delete tags[otherCommonKey];
80785           tags[otherKey] = otherValue;
80786         }
80787         return tags;
80788       });
80789     }
80790     directionalCombo.tags = function(tags) {
80791       _tags = tags;
80792       const commonKey = field.key.replace(/:both$/, "");
80793       for (let key in _combos) {
80794         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[`${commonKey}:both`]).concat(_tags[key]).filter(Boolean))];
80795         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
80796       }
80797     };
80798     directionalCombo.focus = function() {
80799       var node = wrap2.selectAll("input").node();
80800       if (node) node.focus();
80801     };
80802     return utilRebind(directionalCombo, dispatch14, "on");
80803   }
80804   var init_directional_combo = __esm({
80805     "modules/ui/fields/directional_combo.js"() {
80806       "use strict";
80807       init_src4();
80808       init_src5();
80809       init_util();
80810       init_combo();
80811     }
80812   });
80813
80814   // modules/ui/fields/lanes.js
80815   var lanes_exports2 = {};
80816   __export(lanes_exports2, {
80817     uiFieldLanes: () => uiFieldLanes
80818   });
80819   function uiFieldLanes(field, context) {
80820     var dispatch14 = dispatch_default("change");
80821     var LANE_WIDTH = 40;
80822     var LANE_HEIGHT = 200;
80823     var _entityIDs = [];
80824     function lanes(selection2) {
80825       var lanesData = context.entity(_entityIDs[0]).lanes();
80826       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
80827         selection2.call(lanes.off);
80828         return;
80829       }
80830       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80831       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80832       var surface = wrap2.selectAll(".surface").data([0]);
80833       var d2 = utilGetDimensions(wrap2);
80834       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
80835       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
80836       var lanesSelection = surface.selectAll(".lanes").data([0]);
80837       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
80838       lanesSelection.attr("transform", function() {
80839         return "translate(" + freeSpace / 2 + ", 0)";
80840       });
80841       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
80842       lane.exit().remove();
80843       var enter = lane.enter().append("g").attr("class", "lane");
80844       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
80845       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
80846       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
80847       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
80848       lane = lane.merge(enter);
80849       lane.attr("transform", function(d4) {
80850         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
80851       });
80852       lane.select(".forward").style("visibility", function(d4) {
80853         return d4.direction === "forward" ? "visible" : "hidden";
80854       });
80855       lane.select(".bothways").style("visibility", function(d4) {
80856         return d4.direction === "bothways" ? "visible" : "hidden";
80857       });
80858       lane.select(".backward").style("visibility", function(d4) {
80859         return d4.direction === "backward" ? "visible" : "hidden";
80860       });
80861     }
80862     lanes.entityIDs = function(val) {
80863       _entityIDs = val;
80864     };
80865     lanes.tags = function() {
80866     };
80867     lanes.focus = function() {
80868     };
80869     lanes.off = function() {
80870     };
80871     return utilRebind(lanes, dispatch14, "on");
80872   }
80873   var init_lanes2 = __esm({
80874     "modules/ui/fields/lanes.js"() {
80875       "use strict";
80876       init_src4();
80877       init_rebind();
80878       init_dimensions();
80879       uiFieldLanes.supportsMultiselection = false;
80880     }
80881   });
80882
80883   // modules/ui/fields/localized.js
80884   var localized_exports = {};
80885   __export(localized_exports, {
80886     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
80887     uiFieldLocalized: () => uiFieldLocalized
80888   });
80889   function uiFieldLocalized(field, context) {
80890     var dispatch14 = dispatch_default("change", "input");
80891     var wikipedia = services.wikipedia;
80892     var input = select_default2(null);
80893     var localizedInputs = select_default2(null);
80894     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
80895     var _countryCode;
80896     var _tags;
80897     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
80898     });
80899     var _territoryLanguages = {};
80900     _mainFileFetcher.get("territory_languages").then(function(d2) {
80901       _territoryLanguages = d2;
80902     }).catch(function() {
80903     });
80904     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
80905     var _selection = select_default2(null);
80906     var _multilingual = [];
80907     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
80908     var _wikiTitles;
80909     var _entityIDs = [];
80910     function loadLanguagesArray(dataLanguages) {
80911       if (_languagesArray.length !== 0) return;
80912       var replacements = {
80913         sr: "sr-Cyrl",
80914         // in OSM, `sr` implies Cyrillic
80915         "sr-Cyrl": false
80916         // `sr-Cyrl` isn't used in OSM
80917       };
80918       for (var code in dataLanguages) {
80919         if (replacements[code] === false) continue;
80920         var metaCode = code;
80921         if (replacements[code]) metaCode = replacements[code];
80922         _languagesArray.push({
80923           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
80924           nativeName: dataLanguages[metaCode].nativeName,
80925           code,
80926           label: _mainLocalizer.languageName(metaCode)
80927         });
80928       }
80929     }
80930     function calcLocked() {
80931       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
80932         var entity = context.graph().hasEntity(entityID);
80933         if (!entity) return false;
80934         if (entity.tags.wikidata) return true;
80935         if (entity.tags["name:etymology:wikidata"]) return true;
80936         var preset = _mainPresetIndex.match(entity, context.graph());
80937         if (preset) {
80938           var isSuggestion = preset.suggestion;
80939           var fields = preset.fields(entity.extent(context.graph()).center());
80940           var showsBrandField = fields.some(function(d2) {
80941             return d2.id === "brand";
80942           });
80943           var showsOperatorField = fields.some(function(d2) {
80944             return d2.id === "operator";
80945           });
80946           var setsName = preset.addTags.name;
80947           var setsBrandWikidata = preset.addTags["brand:wikidata"];
80948           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
80949           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
80950         }
80951         return false;
80952       });
80953       field.locked(isLocked);
80954     }
80955     function calcMultilingual(tags) {
80956       var existingLangsOrdered = _multilingual.map(function(item2) {
80957         return item2.lang;
80958       });
80959       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
80960       for (var k3 in tags) {
80961         var m3 = k3.match(LANGUAGE_SUFFIX_REGEX);
80962         if (m3 && m3[1] === field.key && m3[2]) {
80963           var item = { lang: m3[2], value: tags[k3] };
80964           if (existingLangs.has(item.lang)) {
80965             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
80966             existingLangs.delete(item.lang);
80967           } else {
80968             _multilingual.push(item);
80969           }
80970         }
80971       }
80972       _multilingual.forEach(function(item2) {
80973         if (item2.lang && existingLangs.has(item2.lang)) {
80974           item2.value = "";
80975         }
80976       });
80977     }
80978     function localized(selection2) {
80979       _selection = selection2;
80980       calcLocked();
80981       var isLocked = field.locked();
80982       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
80983       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
80984       input = wrap2.selectAll(".localized-main").data([0]);
80985       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
80986       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
80987       wrap2.call(_lengthIndicator);
80988       var translateButton = wrap2.selectAll(".localized-add").data([0]);
80989       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);
80990       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
80991       if (_tags && !_multilingual.length) {
80992         calcMultilingual(_tags);
80993       }
80994       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
80995       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
80996       localizedInputs.call(renderMultilingual);
80997       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
80998       selection2.selectAll(".combobox-caret").classed("nope", true);
80999       function addNew(d3_event) {
81000         d3_event.preventDefault();
81001         if (field.locked()) return;
81002         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
81003         var langExists = _multilingual.find(function(datum2) {
81004           return datum2.lang === defaultLang;
81005         });
81006         var isLangEn = defaultLang.indexOf("en") > -1;
81007         if (isLangEn || langExists) {
81008           defaultLang = "";
81009           langExists = _multilingual.find(function(datum2) {
81010             return datum2.lang === defaultLang;
81011           });
81012         }
81013         if (!langExists) {
81014           _multilingual.unshift({ lang: defaultLang, value: "" });
81015           localizedInputs.call(renderMultilingual);
81016         }
81017       }
81018       function change(onInput) {
81019         return function(d3_event) {
81020           if (field.locked()) {
81021             d3_event.preventDefault();
81022             return;
81023           }
81024           var val = utilGetSetValue(select_default2(this));
81025           if (!onInput) val = context.cleanTagValue(val);
81026           if (!val && Array.isArray(_tags[field.key])) return;
81027           var t2 = {};
81028           t2[field.key] = val || void 0;
81029           dispatch14.call("change", this, t2, onInput);
81030         };
81031       }
81032     }
81033     function key(lang) {
81034       return field.key + ":" + lang;
81035     }
81036     function changeLang(d3_event, d2) {
81037       var tags = {};
81038       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
81039       var language = _languagesArray.find(function(d4) {
81040         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
81041       });
81042       if (language) lang = language.code;
81043       if (d2.lang && d2.lang !== lang) {
81044         tags[key(d2.lang)] = void 0;
81045       }
81046       var newKey = lang && context.cleanTagKey(key(lang));
81047       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
81048       if (newKey && value) {
81049         tags[newKey] = value;
81050       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
81051         tags[newKey] = _wikiTitles[d2.lang];
81052       }
81053       d2.lang = lang;
81054       dispatch14.call("change", this, tags);
81055     }
81056     function changeValue(d3_event, d2) {
81057       if (!d2.lang) return;
81058       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
81059       if (!value && Array.isArray(d2.value)) return;
81060       var t2 = {};
81061       t2[key(d2.lang)] = value;
81062       d2.value = value;
81063       dispatch14.call("change", this, t2);
81064     }
81065     function fetchLanguages(value, cb) {
81066       var v3 = value.toLowerCase();
81067       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
81068       if (_countryCode && _territoryLanguages[_countryCode]) {
81069         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
81070       }
81071       var langItems = [];
81072       langCodes.forEach(function(code) {
81073         var langItem = _languagesArray.find(function(item) {
81074           return item.code === code;
81075         });
81076         if (langItem) langItems.push(langItem);
81077       });
81078       langItems = utilArrayUniq(langItems.concat(_languagesArray));
81079       cb(langItems.filter(function(d2) {
81080         return d2.label.toLowerCase().indexOf(v3) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v3) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v3) >= 0 || d2.code.toLowerCase().indexOf(v3) >= 0;
81081       }).map(function(d2) {
81082         return { value: d2.label };
81083       }));
81084     }
81085     function renderMultilingual(selection2) {
81086       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
81087         return d2.lang;
81088       });
81089       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
81090       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_3, index) {
81091         var wrap2 = select_default2(this);
81092         var domId = utilUniqueDomId(index);
81093         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
81094         var text = label.append("span").attr("class", "label-text");
81095         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
81096         text.append("span").attr("class", "label-textannotation");
81097         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
81098           if (field.locked()) return;
81099           d3_event.preventDefault();
81100           _multilingual.splice(_multilingual.indexOf(d2), 1);
81101           var langKey = d2.lang && key(d2.lang);
81102           if (langKey && langKey in _tags) {
81103             delete _tags[langKey];
81104             var t2 = {};
81105             t2[langKey] = void 0;
81106             dispatch14.call("change", this, t2);
81107             return;
81108           }
81109           renderMultilingual(selection2);
81110         }).call(svgIcon("#iD-operation-delete"));
81111         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);
81112         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
81113       });
81114       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() {
81115         select_default2(this).style("max-height", "").style("overflow", "visible");
81116       });
81117       entries = entries.merge(entriesEnter);
81118       entries.order();
81119       entries.classed("present", true);
81120       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
81121         var langItem = _languagesArray.find(function(item) {
81122           return item.code === d2.lang;
81123         });
81124         if (langItem) return langItem.label;
81125         return d2.lang;
81126       });
81127       utilGetSetValue(entries.select(".localized-value"), function(d2) {
81128         return typeof d2.value === "string" ? d2.value : "";
81129       }).attr("title", function(d2) {
81130         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
81131       }).attr("placeholder", function(d2) {
81132         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
81133       }).attr("lang", function(d2) {
81134         return d2.lang;
81135       }).classed("mixed", function(d2) {
81136         return Array.isArray(d2.value);
81137       });
81138     }
81139     localized.tags = function(tags) {
81140       _tags = tags;
81141       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
81142         _wikiTitles = {};
81143         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
81144         if (wm && wm[0] && wm[1]) {
81145           wikipedia.translations(wm[1], wm[2], function(err, d2) {
81146             if (err || !d2) return;
81147             _wikiTitles = d2;
81148           });
81149         }
81150       }
81151       var isMixed = Array.isArray(tags[field.key]);
81152       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);
81153       calcMultilingual(tags);
81154       _selection.call(localized);
81155       if (!isMixed) {
81156         _lengthIndicator.update(tags[field.key]);
81157       }
81158     };
81159     localized.focus = function() {
81160       input.node().focus();
81161     };
81162     localized.entityIDs = function(val) {
81163       if (!arguments.length) return _entityIDs;
81164       _entityIDs = val;
81165       _multilingual = [];
81166       loadCountryCode();
81167       return localized;
81168     };
81169     function loadCountryCode() {
81170       var extent = combinedEntityExtent();
81171       var countryCode = extent && iso1A2Code(extent.center());
81172       _countryCode = countryCode && countryCode.toLowerCase();
81173     }
81174     function combinedEntityExtent() {
81175       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81176     }
81177     return utilRebind(localized, dispatch14, "on");
81178   }
81179   var _languagesArray, LANGUAGE_SUFFIX_REGEX;
81180   var init_localized = __esm({
81181     "modules/ui/fields/localized.js"() {
81182       "use strict";
81183       init_src4();
81184       init_src5();
81185       init_country_coder();
81186       init_presets();
81187       init_file_fetcher();
81188       init_localizer();
81189       init_services();
81190       init_svg();
81191       init_tooltip();
81192       init_combobox();
81193       init_util();
81194       init_length_indicator();
81195       _languagesArray = [];
81196       LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
81197     }
81198   });
81199
81200   // modules/ui/fields/roadheight.js
81201   var roadheight_exports = {};
81202   __export(roadheight_exports, {
81203     uiFieldRoadheight: () => uiFieldRoadheight
81204   });
81205   function uiFieldRoadheight(field, context) {
81206     var dispatch14 = dispatch_default("change");
81207     var primaryUnitInput = select_default2(null);
81208     var primaryInput = select_default2(null);
81209     var secondaryInput = select_default2(null);
81210     var secondaryUnitInput = select_default2(null);
81211     var _entityIDs = [];
81212     var _tags;
81213     var _isImperial;
81214     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81215     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81216     var primaryUnits = [
81217       {
81218         value: "m",
81219         title: _t("inspector.roadheight.meter")
81220       },
81221       {
81222         value: "ft",
81223         title: _t("inspector.roadheight.foot")
81224       }
81225     ];
81226     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
81227     function roadheight(selection2) {
81228       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81229       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81230       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
81231       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
81232       primaryInput.on("change", change).on("blur", change);
81233       var loc = combinedEntityExtent().center();
81234       _isImperial = roadHeightUnit(loc) === "ft";
81235       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
81236       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
81237       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
81238       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
81239       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
81240       secondaryInput.on("change", change).on("blur", change);
81241       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
81242       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
81243       function changeUnits() {
81244         var primaryUnit = utilGetSetValue(primaryUnitInput);
81245         if (primaryUnit === "m") {
81246           _isImperial = false;
81247         } else if (primaryUnit === "ft") {
81248           _isImperial = true;
81249         }
81250         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81251         setUnitSuggestions();
81252         change();
81253       }
81254     }
81255     function setUnitSuggestions() {
81256       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
81257     }
81258     function change() {
81259       var tag = {};
81260       var primaryValue = utilGetSetValue(primaryInput).trim();
81261       var secondaryValue = utilGetSetValue(secondaryInput).trim();
81262       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
81263       if (!primaryValue && !secondaryValue) {
81264         tag[field.key] = void 0;
81265       } else {
81266         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
81267         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
81268         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
81269         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
81270         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
81271           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
81272         } else {
81273           if (rawPrimaryValue !== "") {
81274             rawPrimaryValue = rawPrimaryValue + "'";
81275           }
81276           if (rawSecondaryValue !== "") {
81277             rawSecondaryValue = rawSecondaryValue + '"';
81278           }
81279           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
81280         }
81281       }
81282       dispatch14.call("change", this, tag);
81283     }
81284     roadheight.tags = function(tags) {
81285       _tags = tags;
81286       var primaryValue = tags[field.key];
81287       var secondaryValue;
81288       var isMixed = Array.isArray(primaryValue);
81289       if (!isMixed) {
81290         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
81291           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
81292           if (secondaryValue !== null) {
81293             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
81294           }
81295           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
81296           if (primaryValue !== null) {
81297             primaryValue = formatFloat(parseFloat(primaryValue[1]));
81298           }
81299           _isImperial = true;
81300         } else if (primaryValue) {
81301           var rawValue = primaryValue;
81302           primaryValue = parseFloat(rawValue);
81303           if (isNaN(primaryValue)) {
81304             primaryValue = rawValue;
81305           } else {
81306             primaryValue = formatFloat(primaryValue);
81307           }
81308           _isImperial = false;
81309         }
81310       }
81311       setUnitSuggestions();
81312       var inchesPlaceholder = formatFloat(0);
81313       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);
81314       utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? inchesPlaceholder : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
81315       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
81316     };
81317     roadheight.focus = function() {
81318       primaryInput.node().focus();
81319     };
81320     roadheight.entityIDs = function(val) {
81321       _entityIDs = val;
81322     };
81323     function combinedEntityExtent() {
81324       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81325     }
81326     return utilRebind(roadheight, dispatch14, "on");
81327   }
81328   var init_roadheight = __esm({
81329     "modules/ui/fields/roadheight.js"() {
81330       "use strict";
81331       init_src4();
81332       init_src5();
81333       init_country_coder();
81334       init_combobox();
81335       init_localizer();
81336       init_util();
81337       init_input();
81338     }
81339   });
81340
81341   // modules/ui/fields/roadspeed.js
81342   var roadspeed_exports = {};
81343   __export(roadspeed_exports, {
81344     uiFieldRoadspeed: () => uiFieldRoadspeed
81345   });
81346   function uiFieldRoadspeed(field, context) {
81347     var dispatch14 = dispatch_default("change");
81348     var unitInput = select_default2(null);
81349     var input = select_default2(null);
81350     var _entityIDs = [];
81351     var _tags;
81352     var _isImperial;
81353     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
81354     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
81355     var speedCombo = uiCombobox(context, "roadspeed");
81356     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
81357     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
81358     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
81359     function roadspeed(selection2) {
81360       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81361       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81362       input = wrap2.selectAll("input.roadspeed-number").data([0]);
81363       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
81364       input.on("change", change).on("blur", change);
81365       var loc = combinedEntityExtent().center();
81366       _isImperial = roadSpeedUnit(loc) === "mph";
81367       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
81368       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
81369       unitInput.on("blur", changeUnits).on("change", changeUnits);
81370       function changeUnits() {
81371         var unit2 = utilGetSetValue(unitInput);
81372         if (unit2 === "km/h") {
81373           _isImperial = false;
81374         } else if (unit2 === "mph") {
81375           _isImperial = true;
81376         }
81377         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81378         setUnitSuggestions();
81379         change();
81380       }
81381     }
81382     function setUnitSuggestions() {
81383       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
81384       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
81385     }
81386     function comboValues(d2) {
81387       return {
81388         value: formatFloat(d2),
81389         title: formatFloat(d2)
81390       };
81391     }
81392     function change() {
81393       var tag = {};
81394       var value = utilGetSetValue(input).trim();
81395       if (!value && Array.isArray(_tags[field.key])) return;
81396       if (!value) {
81397         tag[field.key] = void 0;
81398       } else {
81399         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
81400         if (isNaN(rawValue)) rawValue = value;
81401         if (isNaN(rawValue) || !_isImperial) {
81402           tag[field.key] = context.cleanTagValue(rawValue);
81403         } else {
81404           tag[field.key] = context.cleanTagValue(rawValue + " mph");
81405         }
81406       }
81407       dispatch14.call("change", this, tag);
81408     }
81409     roadspeed.tags = function(tags) {
81410       _tags = tags;
81411       var rawValue = tags[field.key];
81412       var value = rawValue;
81413       var isMixed = Array.isArray(value);
81414       if (!isMixed) {
81415         if (rawValue && rawValue.indexOf("mph") >= 0) {
81416           _isImperial = true;
81417         } else if (rawValue) {
81418           _isImperial = false;
81419         }
81420         value = parseInt(value, 10);
81421         if (isNaN(value)) {
81422           value = rawValue;
81423         } else {
81424           value = formatFloat(value);
81425         }
81426       }
81427       setUnitSuggestions();
81428       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);
81429     };
81430     roadspeed.focus = function() {
81431       input.node().focus();
81432     };
81433     roadspeed.entityIDs = function(val) {
81434       _entityIDs = val;
81435     };
81436     function combinedEntityExtent() {
81437       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
81438     }
81439     return utilRebind(roadspeed, dispatch14, "on");
81440   }
81441   var init_roadspeed = __esm({
81442     "modules/ui/fields/roadspeed.js"() {
81443       "use strict";
81444       init_src4();
81445       init_src5();
81446       init_country_coder();
81447       init_combobox();
81448       init_localizer();
81449       init_util();
81450       init_input();
81451     }
81452   });
81453
81454   // modules/ui/fields/radio.js
81455   var radio_exports = {};
81456   __export(radio_exports, {
81457     uiFieldRadio: () => uiFieldRadio,
81458     uiFieldStructureRadio: () => uiFieldRadio
81459   });
81460   function uiFieldRadio(field, context) {
81461     var dispatch14 = dispatch_default("change");
81462     var placeholder = select_default2(null);
81463     var wrap2 = select_default2(null);
81464     var labels = select_default2(null);
81465     var radios = select_default2(null);
81466     var strings = field.resolveReference("stringsCrossReference");
81467     var radioData = (field.options || strings.options || field.keys).slice();
81468     var typeField;
81469     var layerField;
81470     var _oldType = {};
81471     var _entityIDs = [];
81472     function selectedKey() {
81473       var node = wrap2.selectAll(".form-field-input-radio label.active input");
81474       return !node.empty() && node.datum();
81475     }
81476     function radio(selection2) {
81477       selection2.classed("preset-radio", true);
81478       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81479       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
81480       enter.append("span").attr("class", "placeholder");
81481       wrap2 = wrap2.merge(enter);
81482       placeholder = wrap2.selectAll(".placeholder");
81483       labels = wrap2.selectAll("label").data(radioData);
81484       enter = labels.enter().append("label");
81485       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
81486         return strings.t("options." + d2, { "default": d2 });
81487       }).attr("checked", false);
81488       enter.append("span").each(function(d2) {
81489         strings.t.append("options." + d2, { "default": d2 })(select_default2(this));
81490       });
81491       labels = labels.merge(enter);
81492       radios = labels.selectAll("input").on("change", changeRadio);
81493     }
81494     function structureExtras(selection2, tags) {
81495       var selected = selectedKey() || tags.layer !== void 0;
81496       var type2 = _mainPresetIndex.field(selected);
81497       var layer = _mainPresetIndex.field("layer");
81498       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
81499       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
81500       extrasWrap.exit().remove();
81501       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
81502       var list = extrasWrap.selectAll("ul").data([0]);
81503       list = list.enter().append("ul").attr("class", "rows").merge(list);
81504       if (type2) {
81505         if (!typeField || typeField.id !== selected) {
81506           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
81507         }
81508         typeField.tags(tags);
81509       } else {
81510         typeField = null;
81511       }
81512       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
81513         return d2.id;
81514       });
81515       typeItem.exit().remove();
81516       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
81517       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
81518       typeEnter.append("div").attr("class", "structure-input-type-wrap");
81519       typeItem = typeItem.merge(typeEnter);
81520       if (typeField) {
81521         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
81522       }
81523       if (layer && showLayer) {
81524         if (!layerField) {
81525           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
81526         }
81527         layerField.tags(tags);
81528         field.keys = utilArrayUnion(field.keys, ["layer"]);
81529       } else {
81530         layerField = null;
81531         field.keys = field.keys.filter(function(k3) {
81532           return k3 !== "layer";
81533         });
81534       }
81535       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
81536       layerItem.exit().remove();
81537       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
81538       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
81539       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
81540       layerItem = layerItem.merge(layerEnter);
81541       if (layerField) {
81542         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
81543       }
81544     }
81545     function changeType(t2, onInput) {
81546       var key = selectedKey();
81547       if (!key) return;
81548       var val = t2[key];
81549       if (val !== "no") {
81550         _oldType[key] = val;
81551       }
81552       if (field.type === "structureRadio") {
81553         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
81554           t2.layer = void 0;
81555         }
81556         if (t2.layer === void 0) {
81557           if (key === "bridge" && val !== "no") {
81558             t2.layer = "1";
81559           }
81560           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
81561             t2.layer = "-1";
81562           }
81563         }
81564       }
81565       dispatch14.call("change", this, t2, onInput);
81566     }
81567     function changeLayer(t2, onInput) {
81568       if (t2.layer === "0") {
81569         t2.layer = void 0;
81570       }
81571       dispatch14.call("change", this, t2, onInput);
81572     }
81573     function changeRadio() {
81574       var t2 = {};
81575       var activeKey;
81576       if (field.key) {
81577         t2[field.key] = void 0;
81578       }
81579       radios.each(function(d2) {
81580         var active = select_default2(this).property("checked");
81581         if (active) activeKey = d2;
81582         if (field.key) {
81583           if (active) t2[field.key] = d2;
81584         } else {
81585           var val = _oldType[activeKey] || "yes";
81586           t2[d2] = active ? val : void 0;
81587         }
81588       });
81589       if (field.type === "structureRadio") {
81590         if (activeKey === "bridge") {
81591           t2.layer = "1";
81592         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
81593           t2.layer = "-1";
81594         } else {
81595           t2.layer = void 0;
81596         }
81597       }
81598       dispatch14.call("change", this, t2);
81599     }
81600     radio.tags = function(tags) {
81601       function isOptionChecked(d2) {
81602         if (field.key) {
81603           return tags[field.key] === d2;
81604         }
81605         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81606       }
81607       function isMixed(d2) {
81608         if (field.key) {
81609           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
81610         }
81611         return Array.isArray(tags[d2]);
81612       }
81613       radios.property("checked", function(d2) {
81614         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
81615       });
81616       labels.classed("active", function(d2) {
81617         if (field.key) {
81618           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
81619         }
81620         return Array.isArray(tags[d2]) && tags[d2].some((v3) => typeof v3 === "string" && v3.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
81621       }).classed("mixed", isMixed).attr("title", function(d2) {
81622         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
81623       });
81624       var selection2 = radios.filter(function() {
81625         return this.checked;
81626       });
81627       if (selection2.empty()) {
81628         placeholder.text("");
81629         placeholder.call(_t.append("inspector.none"));
81630       } else {
81631         placeholder.text(selection2.attr("value"));
81632         _oldType[selection2.datum()] = tags[selection2.datum()];
81633       }
81634       if (field.type === "structureRadio") {
81635         if (!!tags.waterway && !_oldType.tunnel) {
81636           _oldType.tunnel = "culvert";
81637         }
81638         if (!!tags.waterway && !_oldType.bridge) {
81639           _oldType.bridge = "aqueduct";
81640         }
81641         wrap2.call(structureExtras, tags);
81642       }
81643     };
81644     radio.focus = function() {
81645       radios.node().focus();
81646     };
81647     radio.entityIDs = function(val) {
81648       if (!arguments.length) return _entityIDs;
81649       _entityIDs = val;
81650       _oldType = {};
81651       return radio;
81652     };
81653     radio.isAllowed = function() {
81654       return _entityIDs.length === 1;
81655     };
81656     return utilRebind(radio, dispatch14, "on");
81657   }
81658   var init_radio = __esm({
81659     "modules/ui/fields/radio.js"() {
81660       "use strict";
81661       init_src4();
81662       init_src5();
81663       init_presets();
81664       init_localizer();
81665       init_field2();
81666       init_util();
81667     }
81668   });
81669
81670   // modules/ui/fields/restrictions.js
81671   var restrictions_exports = {};
81672   __export(restrictions_exports, {
81673     uiFieldRestrictions: () => uiFieldRestrictions
81674   });
81675   function uiFieldRestrictions(field, context) {
81676     var dispatch14 = dispatch_default("change");
81677     var breathe = behaviorBreathe(context);
81678     corePreferences("turn-restriction-via-way", null);
81679     var storedViaWay = corePreferences("turn-restriction-via-way0");
81680     var storedDistance = corePreferences("turn-restriction-distance");
81681     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
81682     var _maxDistance = storedDistance ? +storedDistance : 30;
81683     var _initialized3 = false;
81684     var _parent = select_default2(null);
81685     var _container = select_default2(null);
81686     var _oldTurns;
81687     var _graph;
81688     var _vertexID;
81689     var _intersection;
81690     var _fromWayID;
81691     var _lastXPos;
81692     function restrictions(selection2) {
81693       _parent = selection2;
81694       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
81695         _graph = context.graph();
81696         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
81697       }
81698       var isOK = _intersection && _intersection.vertices.length && // has vertices
81699       _intersection.vertices.filter(function(vertex) {
81700         return vertex.id === _vertexID;
81701       }).length && _intersection.ways.length > 2;
81702       select_default2(selection2.node().parentNode).classed("hide", !isOK);
81703       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
81704         selection2.call(restrictions.off);
81705         return;
81706       }
81707       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
81708       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
81709       var container = wrap2.selectAll(".restriction-container").data([0]);
81710       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
81711       containerEnter.append("div").attr("class", "restriction-help");
81712       _container = containerEnter.merge(container).call(renderViewer);
81713       var controls = wrap2.selectAll(".restriction-controls").data([0]);
81714       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
81715     }
81716     function renderControls(selection2) {
81717       var distControl = selection2.selectAll(".restriction-distance").data([0]);
81718       distControl.exit().remove();
81719       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
81720       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
81721       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
81722       distControlEnter.append("span").attr("class", "restriction-distance-text");
81723       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
81724         var val = select_default2(this).property("value");
81725         _maxDistance = +val;
81726         _intersection = null;
81727         _container.selectAll(".layer-osm .layer-turns *").remove();
81728         corePreferences("turn-restriction-distance", _maxDistance);
81729         _parent.call(restrictions);
81730       });
81731       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
81732       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
81733       viaControl.exit().remove();
81734       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
81735       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
81736       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
81737       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
81738       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
81739         var val = select_default2(this).property("value");
81740         _maxViaWay = +val;
81741         _container.selectAll(".layer-osm .layer-turns *").remove();
81742         corePreferences("turn-restriction-via-way0", _maxViaWay);
81743         _parent.call(restrictions);
81744       });
81745       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
81746     }
81747     function renderViewer(selection2) {
81748       if (!_intersection) return;
81749       var vgraph = _intersection.graph;
81750       var filter2 = utilFunctor(true);
81751       var projection2 = geoRawMercator();
81752       var sdims = utilGetDimensions(context.container().select(".sidebar"));
81753       var d2 = [sdims[0] - 50, 370];
81754       var c2 = geoVecScale(d2, 0.5);
81755       var z3 = 22;
81756       projection2.scale(geoZoomToScale(z3));
81757       var extent = geoExtent();
81758       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
81759         extent._extend(_intersection.vertices[i3].extent());
81760       }
81761       var padTop = 35;
81762       if (_intersection.vertices.length > 1) {
81763         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
81764         var vPadding = 160;
81765         var tl = projection2([extent[0][0], extent[1][1]]);
81766         var br = projection2([extent[1][0], extent[0][1]]);
81767         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
81768         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
81769         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
81770         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
81771         z3 = z3 - Math.max(hZoomDiff, vZoomDiff);
81772         projection2.scale(geoZoomToScale(z3));
81773       }
81774       var extentCenter = projection2(extent.center());
81775       extentCenter[1] = extentCenter[1] - padTop / 2;
81776       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
81777       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
81778       var drawVertices = svgVertices(projection2, context);
81779       var drawLines = svgLines(projection2, context);
81780       var drawTurns = svgTurns(projection2, context);
81781       var firstTime = selection2.selectAll(".surface").empty();
81782       selection2.call(drawLayers);
81783       var surface = selection2.selectAll(".surface").classed("tr", true);
81784       if (firstTime) {
81785         _initialized3 = true;
81786         surface.call(breathe);
81787       }
81788       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
81789         _fromWayID = null;
81790         _oldTurns = null;
81791       }
81792       surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z3).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
81793       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
81794       surface.selectAll(".selected").classed("selected", false);
81795       surface.selectAll(".related").classed("related", false);
81796       var way;
81797       if (_fromWayID) {
81798         way = vgraph.entity(_fromWayID);
81799         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81800       }
81801       document.addEventListener("resizeWindow", function() {
81802         utilSetDimensions(_container, null);
81803         redraw(1);
81804       }, false);
81805       updateHints(null);
81806       function click(d3_event) {
81807         surface.call(breathe.off).call(breathe);
81808         var datum2 = d3_event.target.__data__;
81809         var entity = datum2 && datum2.properties && datum2.properties.entity;
81810         if (entity) {
81811           datum2 = entity;
81812         }
81813         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
81814           _fromWayID = datum2.id;
81815           _oldTurns = null;
81816           redraw();
81817         } else if (datum2 instanceof osmTurn) {
81818           var actions, extraActions, turns, i4;
81819           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81820           if (datum2.restrictionID && !datum2.direct) {
81821             return;
81822           } else if (datum2.restrictionID && !datum2.only) {
81823             var seen = {};
81824             var datumOnly = JSON.parse(JSON.stringify(datum2));
81825             datumOnly.only = true;
81826             restrictionType = restrictionType.replace(/^no/, "only");
81827             turns = _intersection.turns(_fromWayID, 2);
81828             extraActions = [];
81829             _oldTurns = [];
81830             for (i4 = 0; i4 < turns.length; i4++) {
81831               var turn = turns[i4];
81832               if (seen[turn.restrictionID]) continue;
81833               if (turn.direct && turn.path[1] === datum2.path[1]) {
81834                 seen[turns[i4].restrictionID] = true;
81835                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
81836                 _oldTurns.push(turn);
81837                 extraActions.push(actionUnrestrictTurn(turn));
81838               }
81839             }
81840             actions = _intersection.actions.concat(extraActions, [
81841               actionRestrictTurn(datumOnly, restrictionType),
81842               _t("operations.restriction.annotation.create")
81843             ]);
81844           } else if (datum2.restrictionID) {
81845             turns = _oldTurns || [];
81846             extraActions = [];
81847             for (i4 = 0; i4 < turns.length; i4++) {
81848               if (turns[i4].key !== datum2.key) {
81849                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
81850               }
81851             }
81852             _oldTurns = null;
81853             actions = _intersection.actions.concat(extraActions, [
81854               actionUnrestrictTurn(datum2),
81855               _t("operations.restriction.annotation.delete")
81856             ]);
81857           } else {
81858             actions = _intersection.actions.concat([
81859               actionRestrictTurn(datum2, restrictionType),
81860               _t("operations.restriction.annotation.create")
81861             ]);
81862           }
81863           context.perform.apply(context, actions);
81864           var s2 = surface.selectAll("." + datum2.key);
81865           datum2 = s2.empty() ? null : s2.datum();
81866           updateHints(datum2);
81867         } else {
81868           _fromWayID = null;
81869           _oldTurns = null;
81870           redraw();
81871         }
81872       }
81873       function mouseover(d3_event) {
81874         var datum2 = d3_event.target.__data__;
81875         updateHints(datum2);
81876       }
81877       _lastXPos = _lastXPos || sdims[0];
81878       function redraw(minChange) {
81879         var xPos = -1;
81880         if (minChange) {
81881           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
81882         }
81883         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
81884           if (context.hasEntity(_vertexID)) {
81885             _lastXPos = xPos;
81886             _container.call(renderViewer);
81887           }
81888         }
81889       }
81890       function highlightPathsFrom(wayID) {
81891         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
81892         surface.selectAll("." + wayID).classed("related", true);
81893         if (wayID) {
81894           var turns = _intersection.turns(wayID, _maxViaWay);
81895           for (var i4 = 0; i4 < turns.length; i4++) {
81896             var turn = turns[i4];
81897             var ids = [turn.to.way];
81898             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
81899             if (turn.only || turns.length === 1) {
81900               if (turn.via.ways) {
81901                 ids = ids.concat(turn.via.ways);
81902               }
81903             } else if (turn.to.way === wayID) {
81904               continue;
81905             }
81906             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81907           }
81908         }
81909       }
81910       function updateHints(datum2) {
81911         var help = _container.selectAll(".restriction-help").html("");
81912         var placeholders = {};
81913         ["from", "via", "to"].forEach(function(k3) {
81914           placeholders[k3] = { html: '<span class="qualifier">' + _t("restriction.help." + k3) + "</span>" };
81915         });
81916         var entity = datum2 && datum2.properties && datum2.properties.entity;
81917         if (entity) {
81918           datum2 = entity;
81919         }
81920         if (_fromWayID) {
81921           way = vgraph.entity(_fromWayID);
81922           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
81923         }
81924         if (datum2 instanceof osmWay && datum2.__from) {
81925           way = datum2;
81926           highlightPathsFrom(_fromWayID ? null : way.id);
81927           surface.selectAll("." + way.id).classed("related", true);
81928           var clickSelect = !_fromWayID || _fromWayID !== way.id;
81929           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
81930             from: placeholders.from,
81931             fromName: displayName(way.id, vgraph)
81932           }));
81933         } else if (datum2 instanceof osmTurn) {
81934           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
81935           var turnType = restrictionType.replace(/^(only|no)\_/, "");
81936           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
81937           var klass, turnText, nextText;
81938           if (datum2.no) {
81939             klass = "restrict";
81940             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
81941             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
81942           } else if (datum2.only) {
81943             klass = "only";
81944             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
81945             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
81946           } else {
81947             klass = "allow";
81948             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
81949             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
81950           }
81951           help.append("div").attr("class", "qualifier " + klass).html(turnText);
81952           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
81953             from: placeholders.from,
81954             fromName: displayName(datum2.from.way, vgraph),
81955             to: placeholders.to,
81956             toName: displayName(datum2.to.way, vgraph)
81957           }));
81958           if (datum2.via.ways && datum2.via.ways.length) {
81959             var names = [];
81960             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
81961               var prev = names[names.length - 1];
81962               var curr = displayName(datum2.via.ways[i4], vgraph);
81963               if (!prev || curr !== prev) {
81964                 names.push(curr);
81965               }
81966             }
81967             help.append("div").html(_t.html("restriction.help.via_names", {
81968               via: placeholders.via,
81969               viaNames: names.join(", ")
81970             }));
81971           }
81972           if (!indirect) {
81973             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
81974           }
81975           highlightPathsFrom(null);
81976           var alongIDs = datum2.path.slice();
81977           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
81978         } else {
81979           highlightPathsFrom(null);
81980           if (_fromWayID) {
81981             help.append("div").html(_t.html("restriction.help.from_name", {
81982               from: placeholders.from,
81983               fromName: displayName(_fromWayID, vgraph)
81984             }));
81985           } else {
81986             help.append("div").html(_t.html("restriction.help.select_from", {
81987               from: placeholders.from
81988             }));
81989           }
81990         }
81991       }
81992     }
81993     function displayMaxDistance(maxDist) {
81994       return (selection2) => {
81995         var isImperial = !_mainLocalizer.usesMetric();
81996         var opts;
81997         if (isImperial) {
81998           var distToFeet = {
81999             // imprecise conversion for prettier display
82000             20: 70,
82001             25: 85,
82002             30: 100,
82003             35: 115,
82004             40: 130,
82005             45: 145,
82006             50: 160
82007           }[maxDist];
82008           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
82009         } else {
82010           opts = { distance: _t("units.meters", { quantity: maxDist }) };
82011         }
82012         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
82013       };
82014     }
82015     function displayMaxVia(maxVia) {
82016       return (selection2) => {
82017         selection2 = selection2.html("");
82018         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"));
82019       };
82020     }
82021     function displayName(entityID, graph) {
82022       var entity = graph.entity(entityID);
82023       var name = utilDisplayName(entity) || "";
82024       var matched = _mainPresetIndex.match(entity, graph);
82025       var type2 = matched && matched.name() || utilDisplayType(entity.id);
82026       return name || type2;
82027     }
82028     restrictions.entityIDs = function(val) {
82029       _intersection = null;
82030       _fromWayID = null;
82031       _oldTurns = null;
82032       _vertexID = val[0];
82033     };
82034     restrictions.tags = function() {
82035     };
82036     restrictions.focus = function() {
82037     };
82038     restrictions.off = function(selection2) {
82039       if (!_initialized3) return;
82040       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
82041       select_default2(window).on("resize.restrictions", null);
82042     };
82043     return utilRebind(restrictions, dispatch14, "on");
82044   }
82045   var init_restrictions = __esm({
82046     "modules/ui/fields/restrictions.js"() {
82047       "use strict";
82048       init_src4();
82049       init_src5();
82050       init_presets();
82051       init_preferences();
82052       init_localizer();
82053       init_restrict_turn();
82054       init_unrestrict_turn();
82055       init_breathe();
82056       init_geo2();
82057       init_osm();
82058       init_svg();
82059       init_util();
82060       init_dimensions();
82061       uiFieldRestrictions.supportsMultiselection = false;
82062     }
82063   });
82064
82065   // modules/ui/fields/textarea.js
82066   var textarea_exports = {};
82067   __export(textarea_exports, {
82068     uiFieldTextarea: () => uiFieldTextarea
82069   });
82070   function uiFieldTextarea(field, context) {
82071     var dispatch14 = dispatch_default("change");
82072     var input = select_default2(null);
82073     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
82074     var _tags;
82075     function textarea(selection2) {
82076       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82077       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
82078       input = wrap2.selectAll("textarea").data([0]);
82079       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
82080       wrap2.call(_lengthIndicator);
82081       function change(onInput) {
82082         return function() {
82083           var val = utilGetSetValue(input);
82084           if (!onInput) val = context.cleanTagValue(val);
82085           if (!val && Array.isArray(_tags[field.key])) return;
82086           var t2 = {};
82087           t2[field.key] = val || void 0;
82088           dispatch14.call("change", this, t2, onInput);
82089         };
82090       }
82091     }
82092     textarea.tags = function(tags) {
82093       _tags = tags;
82094       var isMixed = Array.isArray(tags[field.key]);
82095       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);
82096       if (!isMixed) {
82097         _lengthIndicator.update(tags[field.key]);
82098       }
82099     };
82100     textarea.focus = function() {
82101       input.node().focus();
82102     };
82103     return utilRebind(textarea, dispatch14, "on");
82104   }
82105   var init_textarea = __esm({
82106     "modules/ui/fields/textarea.js"() {
82107       "use strict";
82108       init_src4();
82109       init_src5();
82110       init_localizer();
82111       init_util();
82112       init_ui();
82113     }
82114   });
82115
82116   // modules/ui/fields/wikidata.js
82117   var wikidata_exports2 = {};
82118   __export(wikidata_exports2, {
82119     uiFieldWikidata: () => uiFieldWikidata
82120   });
82121   function uiFieldWikidata(field, context) {
82122     var wikidata = services.wikidata;
82123     var dispatch14 = dispatch_default("change");
82124     var _selection = select_default2(null);
82125     var _searchInput = select_default2(null);
82126     var _qid = null;
82127     var _wikidataEntity = null;
82128     var _wikiURL = "";
82129     var _entityIDs = [];
82130     var _wikipediaKey = field.keys && field.keys.find(function(key) {
82131       return key.includes("wikipedia");
82132     });
82133     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
82134     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
82135     function wiki(selection2) {
82136       _selection = selection2;
82137       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82138       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
82139       var list = wrap2.selectAll("ul").data([0]);
82140       list = list.enter().append("ul").attr("class", "rows").merge(list);
82141       var searchRow = list.selectAll("li.wikidata-search").data([0]);
82142       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
82143       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
82144         var node = select_default2(this).node();
82145         node.setSelectionRange(0, node.value.length);
82146       }).on("blur", function() {
82147         setLabelForEntity();
82148       }).call(combobox.fetcher(fetchWikidataItems));
82149       combobox.on("accept", function(d2) {
82150         if (d2) {
82151           _qid = d2.id;
82152           change();
82153         }
82154       }).on("cancel", function() {
82155         setLabelForEntity();
82156       });
82157       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) {
82158         d3_event.preventDefault();
82159         if (_wikiURL) window.open(_wikiURL, "_blank");
82160       });
82161       searchRow = searchRow.merge(searchRowEnter);
82162       _searchInput = searchRow.select("input");
82163       var wikidataProperties = ["description", "identifier"];
82164       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
82165       var enter = items.enter().append("li").attr("class", function(d2) {
82166         return "labeled-input preset-wikidata-" + d2;
82167       });
82168       enter.append("div").attr("class", "label").html(function(d2) {
82169         return _t.html("wikidata." + d2);
82170       });
82171       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
82172       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
82173         d3_event.preventDefault();
82174         select_default2(this.parentNode).select("input").node().select();
82175         document.execCommand("copy");
82176       });
82177     }
82178     function fetchWikidataItems(q3, callback) {
82179       if (!q3 && _hintKey) {
82180         for (var i3 in _entityIDs) {
82181           var entity = context.hasEntity(_entityIDs[i3]);
82182           if (entity.tags[_hintKey]) {
82183             q3 = entity.tags[_hintKey];
82184             break;
82185           }
82186         }
82187       }
82188       wikidata.itemsForSearchQuery(q3, function(err, data) {
82189         if (err) {
82190           if (err !== "No query") console.error(err);
82191           return;
82192         }
82193         var result = data.map(function(item) {
82194           return {
82195             id: item.id,
82196             value: item.display.label.value + " (" + item.id + ")",
82197             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
82198             title: item.display.description && item.display.description.value,
82199             terms: item.aliases
82200           };
82201         });
82202         if (callback) callback(result);
82203       });
82204     }
82205     function change() {
82206       var syncTags = {};
82207       syncTags[field.key] = _qid;
82208       dispatch14.call("change", this, syncTags);
82209       var initGraph = context.graph();
82210       var initEntityIDs = _entityIDs;
82211       wikidata.entityByQID(_qid, function(err, entity) {
82212         if (err) return;
82213         if (context.graph() !== initGraph) return;
82214         if (!entity.sitelinks) return;
82215         var langs = wikidata.languagesToQuery();
82216         ["labels", "descriptions"].forEach(function(key) {
82217           if (!entity[key]) return;
82218           var valueLangs = Object.keys(entity[key]);
82219           if (valueLangs.length === 0) return;
82220           var valueLang = valueLangs[0];
82221           if (langs.indexOf(valueLang) === -1) {
82222             langs.push(valueLang);
82223           }
82224         });
82225         var newWikipediaValue;
82226         if (_wikipediaKey) {
82227           var foundPreferred;
82228           for (var i3 in langs) {
82229             var lang = langs[i3];
82230             var siteID = lang.replace("-", "_") + "wiki";
82231             if (entity.sitelinks[siteID]) {
82232               foundPreferred = true;
82233               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
82234               break;
82235             }
82236           }
82237           if (!foundPreferred) {
82238             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
82239               return site.endsWith("wiki");
82240             });
82241             if (wikiSiteKeys.length === 0) {
82242               newWikipediaValue = null;
82243             } else {
82244               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
82245               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
82246               newWikipediaValue = wikiLang + ":" + wikiTitle;
82247             }
82248           }
82249         }
82250         if (newWikipediaValue) {
82251           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
82252         }
82253         if (typeof newWikipediaValue === "undefined") return;
82254         var actions = initEntityIDs.map(function(entityID) {
82255           var entity2 = context.hasEntity(entityID);
82256           if (!entity2) return null;
82257           var currTags = Object.assign({}, entity2.tags);
82258           if (newWikipediaValue === null) {
82259             if (!currTags[_wikipediaKey]) return null;
82260             delete currTags[_wikipediaKey];
82261           } else {
82262             currTags[_wikipediaKey] = newWikipediaValue;
82263           }
82264           return actionChangeTags(entityID, currTags);
82265         }).filter(Boolean);
82266         if (!actions.length) return;
82267         context.overwrite(
82268           function actionUpdateWikipediaTags(graph) {
82269             actions.forEach(function(action) {
82270               graph = action(graph);
82271             });
82272             return graph;
82273           },
82274           context.history().undoAnnotation()
82275         );
82276       });
82277     }
82278     function setLabelForEntity() {
82279       var label = {
82280         value: ""
82281       };
82282       if (_wikidataEntity) {
82283         label = entityPropertyForDisplay(_wikidataEntity, "labels");
82284         if (label.value.length === 0) {
82285           label.value = _wikidataEntity.id.toString();
82286         }
82287       }
82288       utilGetSetValue(_searchInput, label.value).attr("lang", label.language);
82289     }
82290     wiki.tags = function(tags) {
82291       var isMixed = Array.isArray(tags[field.key]);
82292       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
82293       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
82294       if (!/^Q[0-9]*$/.test(_qid)) {
82295         unrecognized();
82296         return;
82297       }
82298       _wikiURL = "https://wikidata.org/wiki/" + _qid;
82299       wikidata.entityByQID(_qid, function(err, entity) {
82300         if (err) {
82301           unrecognized();
82302           return;
82303         }
82304         _wikidataEntity = entity;
82305         setLabelForEntity();
82306         var description = entityPropertyForDisplay(entity, "descriptions");
82307         _selection.select("button.wiki-link").classed("disabled", false);
82308         _selection.select(".preset-wikidata-description").style("display", function() {
82309           return description.value.length > 0 ? "flex" : "none";
82310         }).select("input").attr("value", description.value).attr("lang", description.language);
82311         _selection.select(".preset-wikidata-identifier").style("display", function() {
82312           return entity.id ? "flex" : "none";
82313         }).select("input").attr("value", entity.id);
82314       });
82315       function unrecognized() {
82316         _wikidataEntity = null;
82317         setLabelForEntity();
82318         _selection.select(".preset-wikidata-description").style("display", "none");
82319         _selection.select(".preset-wikidata-identifier").style("display", "none");
82320         _selection.select("button.wiki-link").classed("disabled", true);
82321         if (_qid && _qid !== "") {
82322           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
82323         } else {
82324           _wikiURL = "";
82325         }
82326       }
82327     };
82328     function entityPropertyForDisplay(wikidataEntity, propKey) {
82329       var blankResponse = { value: "" };
82330       if (!wikidataEntity[propKey]) return blankResponse;
82331       var propObj = wikidataEntity[propKey];
82332       var langKeys = Object.keys(propObj);
82333       if (langKeys.length === 0) return blankResponse;
82334       var langs = wikidata.languagesToQuery();
82335       for (var i3 in langs) {
82336         var lang = langs[i3];
82337         var valueObj = propObj[lang];
82338         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj;
82339       }
82340       return propObj[langKeys[0]];
82341     }
82342     wiki.entityIDs = function(val) {
82343       if (!arguments.length) return _entityIDs;
82344       _entityIDs = val;
82345       return wiki;
82346     };
82347     wiki.focus = function() {
82348       _searchInput.node().focus();
82349     };
82350     return utilRebind(wiki, dispatch14, "on");
82351   }
82352   var init_wikidata2 = __esm({
82353     "modules/ui/fields/wikidata.js"() {
82354       "use strict";
82355       init_src4();
82356       init_src5();
82357       init_change_tags();
82358       init_services();
82359       init_icon();
82360       init_util();
82361       init_combobox();
82362       init_localizer();
82363     }
82364   });
82365
82366   // modules/ui/fields/wikipedia.js
82367   var wikipedia_exports2 = {};
82368   __export(wikipedia_exports2, {
82369     uiFieldWikipedia: () => uiFieldWikipedia
82370   });
82371   function uiFieldWikipedia(field, context) {
82372     const scheme = "https://";
82373     const domain = "wikipedia.org";
82374     const dispatch14 = dispatch_default("change");
82375     const wikipedia = services.wikipedia;
82376     const wikidata = services.wikidata;
82377     let _langInput = select_default2(null);
82378     let _titleInput = select_default2(null);
82379     let _wikiURL = "";
82380     let _entityIDs;
82381     let _tags;
82382     let _dataWikipedia = [];
82383     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
82384       _dataWikipedia = d2;
82385       if (_tags) updateForTags(_tags);
82386     }).catch(() => {
82387     });
82388     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
82389       const v3 = value.toLowerCase();
82390       callback(
82391         _dataWikipedia.filter((d2) => {
82392           return d2[0].toLowerCase().indexOf(v3) >= 0 || d2[1].toLowerCase().indexOf(v3) >= 0 || d2[2].toLowerCase().indexOf(v3) >= 0;
82393         }).map((d2) => ({ value: d2[1] }))
82394       );
82395     });
82396     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
82397       if (!value) {
82398         value = "";
82399         for (let i3 in _entityIDs) {
82400           let entity = context.hasEntity(_entityIDs[i3]);
82401           if (entity.tags.name) {
82402             value = entity.tags.name;
82403             break;
82404           }
82405         }
82406       }
82407       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
82408       searchfn(language()[2], value, (query, data) => {
82409         callback(data.map((d2) => ({ value: d2 })));
82410       });
82411     });
82412     function wiki(selection2) {
82413       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
82414       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
82415       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
82416       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
82417       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
82418       _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);
82419       _langInput.on("blur", changeLang).on("change", changeLang);
82420       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
82421       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
82422       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
82423       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
82424       _titleInput.on("blur", function() {
82425         change(true);
82426       }).on("change", function() {
82427         change(false);
82428       });
82429       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
82430       link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link2);
82431       link2.on("click", (d3_event) => {
82432         d3_event.preventDefault();
82433         if (_wikiURL) window.open(_wikiURL, "_blank");
82434       });
82435     }
82436     function defaultLanguageInfo(skipEnglishFallback) {
82437       const langCode = _mainLocalizer.languageCode().toLowerCase();
82438       for (let i3 in _dataWikipedia) {
82439         let d2 = _dataWikipedia[i3];
82440         if (d2[2] === langCode) return d2;
82441       }
82442       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
82443     }
82444     function language(skipEnglishFallback) {
82445       const value = utilGetSetValue(_langInput).toLowerCase();
82446       for (let i3 in _dataWikipedia) {
82447         let d2 = _dataWikipedia[i3];
82448         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
82449       }
82450       return defaultLanguageInfo(skipEnglishFallback);
82451     }
82452     function changeLang() {
82453       utilGetSetValue(_langInput, language()[1]);
82454       change(true);
82455     }
82456     function change(skipWikidata) {
82457       let value = utilGetSetValue(_titleInput);
82458       const m3 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
82459       const langInfo = m3 && _dataWikipedia.find((d2) => m3[1] === d2[2]);
82460       let syncTags = {};
82461       if (langInfo) {
82462         const nativeLangName = langInfo[1];
82463         value = decodeURIComponent(m3[2]).replace(/_/g, " ");
82464         if (m3[3]) {
82465           let anchor;
82466           anchor = decodeURIComponent(m3[3]);
82467           value += "#" + anchor.replace(/_/g, " ");
82468         }
82469         value = value.slice(0, 1).toUpperCase() + value.slice(1);
82470         utilGetSetValue(_langInput, nativeLangName).attr("lang", langInfo[2]);
82471         utilGetSetValue(_titleInput, value);
82472       }
82473       if (value) {
82474         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
82475       } else {
82476         syncTags.wikipedia = void 0;
82477       }
82478       dispatch14.call("change", this, syncTags);
82479       if (skipWikidata || !value || !language()[2]) return;
82480       const initGraph = context.graph();
82481       const initEntityIDs = _entityIDs;
82482       wikidata.itemsByTitle(language()[2], value, (err, data) => {
82483         if (err || !data || !Object.keys(data).length) return;
82484         if (context.graph() !== initGraph) return;
82485         const qids = Object.keys(data);
82486         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
82487         let actions = initEntityIDs.map((entityID) => {
82488           let entity = context.entity(entityID).tags;
82489           let currTags = Object.assign({}, entity);
82490           if (currTags.wikidata !== value2) {
82491             currTags.wikidata = value2;
82492             return actionChangeTags(entityID, currTags);
82493           }
82494           return null;
82495         }).filter(Boolean);
82496         if (!actions.length) return;
82497         context.overwrite(
82498           function actionUpdateWikidataTags(graph) {
82499             actions.forEach(function(action) {
82500               graph = action(graph);
82501             });
82502             return graph;
82503           },
82504           context.history().undoAnnotation()
82505         );
82506       });
82507     }
82508     wiki.tags = (tags) => {
82509       _tags = tags;
82510       updateForTags(tags);
82511     };
82512     function updateForTags(tags) {
82513       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
82514       const m3 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
82515       const tagLang = m3 && m3[1];
82516       const tagArticleTitle = m3 && m3[2];
82517       let anchor = m3 && m3[3];
82518       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
82519       if (tagLangInfo) {
82520         const nativeLangName = tagLangInfo[1];
82521         utilGetSetValue(_langInput, nativeLangName);
82522         _titleInput.attr("lang", tagLangInfo[2]);
82523         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
82524         _wikiURL = `${scheme}${tagLang}.${domain}/wiki/${wiki.encodePath(tagArticleTitle, anchor)}`;
82525       } else {
82526         utilGetSetValue(_titleInput, value);
82527         if (value && value !== "") {
82528           utilGetSetValue(_langInput, "");
82529           const defaultLangInfo = defaultLanguageInfo();
82530           _wikiURL = `${scheme}${defaultLangInfo[2]}.${domain}/w/index.php?fulltext=1&search=${value}`;
82531         } else {
82532           const shownOrDefaultLangInfo = language(
82533             true
82534             /* skipEnglishFallback */
82535           );
82536           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
82537           _wikiURL = "";
82538         }
82539       }
82540     }
82541     wiki.encodePath = (tagArticleTitle, anchor) => {
82542       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
82543       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
82544       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
82545       return `${uriEncodedUnderscoredTitle}${uriEncodedAnchorFragment}`;
82546     };
82547     wiki.encodeURIAnchorFragment = (anchor) => {
82548       if (!anchor) return "";
82549       const underscoredAnchor = anchor.replace(/ /g, "_");
82550       return "#" + encodeURIComponent(underscoredAnchor);
82551     };
82552     wiki.entityIDs = (val) => {
82553       if (!arguments.length) return _entityIDs;
82554       _entityIDs = val;
82555       return wiki;
82556     };
82557     wiki.focus = () => {
82558       _titleInput.node().focus();
82559     };
82560     return utilRebind(wiki, dispatch14, "on");
82561   }
82562   var init_wikipedia2 = __esm({
82563     "modules/ui/fields/wikipedia.js"() {
82564       "use strict";
82565       init_src4();
82566       init_src5();
82567       init_file_fetcher();
82568       init_localizer();
82569       init_change_tags();
82570       init_services();
82571       init_icon();
82572       init_combobox();
82573       init_util();
82574       uiFieldWikipedia.supportsMultiselection = false;
82575     }
82576   });
82577
82578   // modules/ui/fields/index.js
82579   var fields_exports = {};
82580   __export(fields_exports, {
82581     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
82582     likelyRawNumberFormat: () => likelyRawNumberFormat,
82583     uiFieldAccess: () => uiFieldAccess,
82584     uiFieldAddress: () => uiFieldAddress,
82585     uiFieldCheck: () => uiFieldCheck,
82586     uiFieldColour: () => uiFieldText,
82587     uiFieldCombo: () => uiFieldCombo,
82588     uiFieldDefaultCheck: () => uiFieldCheck,
82589     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
82590     uiFieldEmail: () => uiFieldText,
82591     uiFieldIdentifier: () => uiFieldText,
82592     uiFieldLanes: () => uiFieldLanes,
82593     uiFieldLocalized: () => uiFieldLocalized,
82594     uiFieldManyCombo: () => uiFieldCombo,
82595     uiFieldMultiCombo: () => uiFieldCombo,
82596     uiFieldNetworkCombo: () => uiFieldCombo,
82597     uiFieldNumber: () => uiFieldText,
82598     uiFieldOnewayCheck: () => uiFieldCheck,
82599     uiFieldRadio: () => uiFieldRadio,
82600     uiFieldRestrictions: () => uiFieldRestrictions,
82601     uiFieldRoadheight: () => uiFieldRoadheight,
82602     uiFieldRoadspeed: () => uiFieldRoadspeed,
82603     uiFieldSemiCombo: () => uiFieldCombo,
82604     uiFieldStructureRadio: () => uiFieldRadio,
82605     uiFieldTel: () => uiFieldText,
82606     uiFieldText: () => uiFieldText,
82607     uiFieldTextarea: () => uiFieldTextarea,
82608     uiFieldTypeCombo: () => uiFieldCombo,
82609     uiFieldUrl: () => uiFieldText,
82610     uiFieldWikidata: () => uiFieldWikidata,
82611     uiFieldWikipedia: () => uiFieldWikipedia,
82612     uiFields: () => uiFields
82613   });
82614   var uiFields;
82615   var init_fields = __esm({
82616     "modules/ui/fields/index.js"() {
82617       "use strict";
82618       init_check();
82619       init_combo();
82620       init_input();
82621       init_access();
82622       init_address();
82623       init_directional_combo();
82624       init_lanes2();
82625       init_localized();
82626       init_roadheight();
82627       init_roadspeed();
82628       init_radio();
82629       init_restrictions();
82630       init_textarea();
82631       init_wikidata2();
82632       init_wikipedia2();
82633       init_check();
82634       init_combo();
82635       init_input();
82636       init_radio();
82637       init_access();
82638       init_address();
82639       init_directional_combo();
82640       init_lanes2();
82641       init_localized();
82642       init_roadheight();
82643       init_roadspeed();
82644       init_restrictions();
82645       init_textarea();
82646       init_wikidata2();
82647       init_wikipedia2();
82648       uiFields = {
82649         access: uiFieldAccess,
82650         address: uiFieldAddress,
82651         check: uiFieldCheck,
82652         colour: uiFieldText,
82653         combo: uiFieldCombo,
82654         cycleway: uiFieldDirectionalCombo,
82655         date: uiFieldText,
82656         defaultCheck: uiFieldCheck,
82657         directionalCombo: uiFieldDirectionalCombo,
82658         email: uiFieldText,
82659         identifier: uiFieldText,
82660         lanes: uiFieldLanes,
82661         localized: uiFieldLocalized,
82662         roadheight: uiFieldRoadheight,
82663         roadspeed: uiFieldRoadspeed,
82664         manyCombo: uiFieldCombo,
82665         multiCombo: uiFieldCombo,
82666         networkCombo: uiFieldCombo,
82667         number: uiFieldText,
82668         onewayCheck: uiFieldCheck,
82669         radio: uiFieldRadio,
82670         restrictions: uiFieldRestrictions,
82671         semiCombo: uiFieldCombo,
82672         structureRadio: uiFieldRadio,
82673         tel: uiFieldText,
82674         text: uiFieldText,
82675         textarea: uiFieldTextarea,
82676         typeCombo: uiFieldCombo,
82677         url: uiFieldText,
82678         wikidata: uiFieldWikidata,
82679         wikipedia: uiFieldWikipedia
82680       };
82681     }
82682   });
82683
82684   // modules/ui/field.js
82685   var field_exports2 = {};
82686   __export(field_exports2, {
82687     uiField: () => uiField
82688   });
82689   function uiField(context, presetField2, entityIDs, options) {
82690     options = Object.assign({
82691       show: true,
82692       wrap: true,
82693       remove: true,
82694       revert: true,
82695       info: true
82696     }, options);
82697     var dispatch14 = dispatch_default("change", "revert");
82698     var field = Object.assign({}, presetField2);
82699     field.domId = utilUniqueDomId("form-field-" + field.safeid);
82700     var _show = options.show;
82701     var _state = "";
82702     var _tags = {};
82703     var _entityExtent;
82704     if (entityIDs && entityIDs.length) {
82705       _entityExtent = entityIDs.reduce(function(extent, entityID) {
82706         var entity = context.graph().entity(entityID);
82707         return extent.extend(entity.extent(context.graph()));
82708       }, geoExtent());
82709     }
82710     var _locked = false;
82711     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
82712     if (_show && !field.impl) {
82713       createField();
82714     }
82715     function createField() {
82716       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
82717         dispatch14.call("change", field, t2, onInput);
82718       });
82719       if (entityIDs) {
82720         field.entityIDs = entityIDs;
82721         if (field.impl.entityIDs) {
82722           field.impl.entityIDs(entityIDs);
82723         }
82724       }
82725     }
82726     function allKeys() {
82727       let keys2 = field.keys || [field.key];
82728       if (field.type === "directionalCombo" && field.key) {
82729         const baseKey = field.key.replace(/:both$/, "");
82730         keys2 = keys2.concat(baseKey, `${baseKey}:both`);
82731       }
82732       return keys2;
82733     }
82734     function isModified() {
82735       if (!entityIDs || !entityIDs.length) return false;
82736       return entityIDs.some(function(entityID) {
82737         var original = context.graph().base().entities[entityID];
82738         var latest = context.graph().entity(entityID);
82739         return allKeys().some(function(key) {
82740           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
82741         });
82742       });
82743     }
82744     function tagsContainFieldKey() {
82745       return allKeys().some(function(key) {
82746         if (field.type === "multiCombo") {
82747           for (var tagKey in _tags) {
82748             if (tagKey.indexOf(key) === 0) {
82749               return true;
82750             }
82751           }
82752           return false;
82753         }
82754         if (field.type === "localized") {
82755           for (let tagKey2 in _tags) {
82756             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
82757             if (match && match[1] === field.key && match[2]) {
82758               return true;
82759             }
82760           }
82761         }
82762         return _tags[key] !== void 0;
82763       });
82764     }
82765     function revert(d3_event, d2) {
82766       d3_event.stopPropagation();
82767       d3_event.preventDefault();
82768       if (!entityIDs || _locked) return;
82769       dispatch14.call("revert", d2, allKeys());
82770     }
82771     function remove2(d3_event, d2) {
82772       d3_event.stopPropagation();
82773       d3_event.preventDefault();
82774       if (_locked) return;
82775       var t2 = {};
82776       allKeys().forEach(function(key) {
82777         t2[key] = void 0;
82778       });
82779       dispatch14.call("change", d2, t2);
82780     }
82781     field.render = function(selection2) {
82782       var container = selection2.selectAll(".form-field").data([field]);
82783       var enter = container.enter().append("div").attr("class", function(d2) {
82784         return "form-field form-field-" + d2.safeid;
82785       }).classed("nowrap", !options.wrap);
82786       if (options.wrap) {
82787         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
82788           return d2.domId;
82789         });
82790         var textEnter = labelEnter.append("span").attr("class", "label-text");
82791         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
82792           d2.label()(select_default2(this));
82793         });
82794         textEnter.append("span").attr("class", "label-textannotation");
82795         if (options.remove) {
82796           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
82797         }
82798         if (options.revert) {
82799           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
82800         }
82801       }
82802       container = container.merge(enter);
82803       container.select(".field-label > .remove-icon").on("click", remove2);
82804       container.select(".field-label > .modified-icon").on("click", revert);
82805       container.each(function(d2) {
82806         var selection3 = select_default2(this);
82807         if (!d2.impl) {
82808           createField();
82809         }
82810         var reference, help;
82811         if (options.wrap && field.type === "restrictions") {
82812           help = uiFieldHelp(context, "restrictions");
82813         }
82814         if (options.wrap && options.info) {
82815           var referenceKey = d2.key || "";
82816           if (d2.type === "multiCombo") {
82817             referenceKey = referenceKey.replace(/:$/, "");
82818           }
82819           var referenceOptions = d2.reference || {
82820             key: referenceKey,
82821             value: _tags[referenceKey]
82822           };
82823           reference = uiTagReference(referenceOptions, context);
82824           if (_state === "hover") {
82825             reference.showing(false);
82826           }
82827         }
82828         selection3.call(d2.impl);
82829         if (help) {
82830           selection3.call(help.body).select(".field-label").call(help.button);
82831         }
82832         if (reference) {
82833           selection3.call(reference.body).select(".field-label").call(reference.button);
82834         }
82835         d2.impl.tags(_tags);
82836       });
82837       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
82838       var annotation = container.selectAll(".field-label .label-textannotation");
82839       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
82840       icon2.exit().remove();
82841       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
82842       container.call(_locked ? _lockedTip : _lockedTip.destroy);
82843     };
82844     field.state = function(val) {
82845       if (!arguments.length) return _state;
82846       _state = val;
82847       return field;
82848     };
82849     field.tags = function(val) {
82850       if (!arguments.length) return _tags;
82851       _tags = val;
82852       if (tagsContainFieldKey() && !_show) {
82853         _show = true;
82854         if (!field.impl) {
82855           createField();
82856         }
82857       }
82858       return field;
82859     };
82860     field.locked = function(val) {
82861       if (!arguments.length) return _locked;
82862       _locked = val;
82863       return field;
82864     };
82865     field.show = function() {
82866       _show = true;
82867       if (!field.impl) {
82868         createField();
82869       }
82870       if (field.default && field.key && _tags[field.key] !== field.default) {
82871         var t2 = {};
82872         t2[field.key] = field.default;
82873         dispatch14.call("change", this, t2);
82874       }
82875     };
82876     field.isShown = function() {
82877       return _show;
82878     };
82879     field.isAllowed = function() {
82880       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
82881       if (field.geometry && !entityIDs.every(function(entityID) {
82882         return field.matchGeometry(context.graph().geometry(entityID));
82883       })) return false;
82884       if (entityIDs && _entityExtent && field.locationSetID) {
82885         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
82886         if (!validHere[field.locationSetID]) return false;
82887       }
82888       var prerequisiteTag = field.prerequisiteTag;
82889       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
82890       prerequisiteTag) {
82891         if (!entityIDs.every(function(entityID) {
82892           var entity = context.graph().entity(entityID);
82893           if (prerequisiteTag.key) {
82894             var value = entity.tags[prerequisiteTag.key];
82895             if (!value) return false;
82896             if (prerequisiteTag.valueNot) {
82897               return prerequisiteTag.valueNot !== value;
82898             }
82899             if (prerequisiteTag.value) {
82900               return prerequisiteTag.value === value;
82901             }
82902           } else if (prerequisiteTag.keyNot) {
82903             if (entity.tags[prerequisiteTag.keyNot]) return false;
82904           }
82905           return true;
82906         })) return false;
82907       }
82908       return true;
82909     };
82910     field.focus = function() {
82911       if (field.impl) {
82912         field.impl.focus();
82913       }
82914     };
82915     return utilRebind(field, dispatch14, "on");
82916   }
82917   var init_field2 = __esm({
82918     "modules/ui/field.js"() {
82919       "use strict";
82920       init_src4();
82921       init_src5();
82922       init_localizer();
82923       init_LocationManager();
82924       init_icon();
82925       init_tooltip();
82926       init_extent();
82927       init_field_help();
82928       init_fields();
82929       init_localized();
82930       init_tag_reference();
82931       init_util();
82932     }
82933   });
82934
82935   // modules/ui/changeset_editor.js
82936   var changeset_editor_exports = {};
82937   __export(changeset_editor_exports, {
82938     uiChangesetEditor: () => uiChangesetEditor
82939   });
82940   function uiChangesetEditor(context) {
82941     var dispatch14 = dispatch_default("change");
82942     var formFields = uiFormFields(context);
82943     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
82944     var _fieldsArr;
82945     var _tags;
82946     var _changesetID;
82947     function changesetEditor(selection2) {
82948       render(selection2);
82949     }
82950     function render(selection2) {
82951       var _a4;
82952       var initial = false;
82953       if (!_fieldsArr) {
82954         initial = true;
82955         var presets = _mainPresetIndex;
82956         _fieldsArr = [
82957           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
82958           uiField(context, presets.field("source"), null, { show: true, revert: false }),
82959           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
82960         ];
82961         _fieldsArr.forEach(function(field) {
82962           field.on("change", function(t2, onInput) {
82963             dispatch14.call("change", field, void 0, t2, onInput);
82964           });
82965         });
82966       }
82967       _fieldsArr.forEach(function(field) {
82968         field.tags(_tags);
82969       });
82970       selection2.call(formFields.fieldsArr(_fieldsArr));
82971       if (initial) {
82972         var commentField = selection2.select(".form-field-comment textarea");
82973         const sourceField = _fieldsArr.find((field) => field.id === "source");
82974         var commentNode = commentField.node();
82975         if (commentNode) {
82976           commentNode.focus();
82977           commentNode.select();
82978         }
82979         utilTriggerEvent(commentField, "blur");
82980         var osm = context.connection();
82981         if (osm) {
82982           osm.userChangesets(function(err, changesets) {
82983             if (err) return;
82984             var comments = changesets.map(function(changeset) {
82985               var comment = changeset.tags.comment;
82986               return comment ? { title: comment, value: comment } : null;
82987             }).filter(Boolean);
82988             commentField.call(
82989               commentCombo.data(utilArrayUniqBy(comments, "title"))
82990             );
82991             const recentSources = changesets.flatMap((changeset) => {
82992               var _a5;
82993               return (_a5 = changeset.tags.source) == null ? void 0 : _a5.split(";");
82994             }).filter((value) => !sourceField.options.includes(value)).filter(Boolean).map((title) => ({ title, value: title, klass: "raw-option" }));
82995             sourceField.impl.setCustomOptions(utilArrayUniqBy(recentSources, "title"));
82996           });
82997         }
82998       }
82999       const warnings = [];
83000       if ((_a4 = _tags.comment) == null ? void 0 : _a4.match(/google/i)) {
83001         warnings.push({
83002           id: 'contains "google"',
83003           msg: _t.append("commit.google_warning"),
83004           link: _t("commit.google_warning_link")
83005         });
83006       }
83007       const maxChars = context.maxCharsForTagValue();
83008       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
83009       if (strLen > maxChars || false) {
83010         warnings.push({
83011           id: "message too long",
83012           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
83013         });
83014       }
83015       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
83016       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
83017       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
83018       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
83019       commentEnter.transition().duration(200).style("opacity", 1);
83020       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
83021         let selection3 = select_default2(this);
83022         if (d2.link) {
83023           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
83024         }
83025         selection3.call(d2.msg);
83026       });
83027     }
83028     changesetEditor.tags = function(_3) {
83029       if (!arguments.length) return _tags;
83030       _tags = _3;
83031       return changesetEditor;
83032     };
83033     changesetEditor.changesetID = function(_3) {
83034       if (!arguments.length) return _changesetID;
83035       if (_changesetID === _3) return changesetEditor;
83036       _changesetID = _3;
83037       _fieldsArr = null;
83038       return changesetEditor;
83039     };
83040     return utilRebind(changesetEditor, dispatch14, "on");
83041   }
83042   var init_changeset_editor = __esm({
83043     "modules/ui/changeset_editor.js"() {
83044       "use strict";
83045       init_src4();
83046       init_src5();
83047       init_presets();
83048       init_localizer();
83049       init_icon();
83050       init_combobox();
83051       init_field2();
83052       init_form_fields();
83053       init_util();
83054     }
83055   });
83056
83057   // modules/ui/sections/changes.js
83058   var changes_exports = {};
83059   __export(changes_exports, {
83060     uiSectionChanges: () => uiSectionChanges
83061   });
83062   function uiSectionChanges(context) {
83063     var _discardTags = {};
83064     _mainFileFetcher.get("discarded").then(function(d2) {
83065       _discardTags = d2;
83066     }).catch(function() {
83067     });
83068     var section = uiSection("changes-list", context).label(function() {
83069       var history = context.history();
83070       var summary = history.difference().summary();
83071       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
83072     }).disclosureContent(renderDisclosureContent);
83073     function renderDisclosureContent(selection2) {
83074       var history = context.history();
83075       var summary = history.difference().summary();
83076       var container = selection2.selectAll(".commit-section").data([0]);
83077       var containerEnter = container.enter().append("div").attr("class", "commit-section");
83078       containerEnter.append("ul").attr("class", "changeset-list");
83079       container = containerEnter.merge(container);
83080       var items = container.select("ul").selectAll("li").data(summary);
83081       var itemsEnter = items.enter().append("li").attr("class", "change-item");
83082       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
83083       buttons.each(function(d2) {
83084         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
83085       });
83086       buttons.append("span").attr("class", "change-type").html(function(d2) {
83087         return _t.html("commit." + d2.changeType) + " ";
83088       });
83089       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
83090         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
83091         return matched && matched.name() || utilDisplayType(d2.entity.id);
83092       });
83093       buttons.append("span").attr("class", "entity-name").text(function(d2) {
83094         var name = utilDisplayName(d2.entity) || "", string = "";
83095         if (name !== "") {
83096           string += ":";
83097         }
83098         return string += " " + name;
83099       });
83100       items = itemsEnter.merge(items);
83101       var changeset = new osmChangeset().update({ id: void 0 });
83102       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
83103       delete changeset.id;
83104       var data = JXON.stringify(changeset.osmChangeJXON(changes));
83105       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
83106       var fileName = "changes.osc";
83107       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
83108       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
83109       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
83110       function mouseover(d3_event, d2) {
83111         if (d2.entity) {
83112           context.surface().selectAll(
83113             utilEntityOrMemberSelector([d2.entity.id], context.graph())
83114           ).classed("hover", true);
83115         }
83116       }
83117       function mouseout() {
83118         context.surface().selectAll(".hover").classed("hover", false);
83119       }
83120       function click(d3_event, change) {
83121         if (change.changeType !== "deleted") {
83122           var entity = change.entity;
83123           context.map().zoomToEase(entity);
83124           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
83125         }
83126       }
83127     }
83128     return section;
83129   }
83130   var init_changes = __esm({
83131     "modules/ui/sections/changes.js"() {
83132       "use strict";
83133       init_src5();
83134       init_presets();
83135       init_file_fetcher();
83136       init_localizer();
83137       init_jxon();
83138       init_discard_tags();
83139       init_osm();
83140       init_icon();
83141       init_section();
83142       init_util();
83143     }
83144   });
83145
83146   // modules/ui/commit.js
83147   var commit_exports = {};
83148   __export(commit_exports, {
83149     uiCommit: () => uiCommit
83150   });
83151   function uiCommit(context) {
83152     var dispatch14 = dispatch_default("cancel");
83153     var _userDetails2;
83154     var _selection;
83155     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
83156     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
83157     var commitChanges = uiSectionChanges(context);
83158     var commitWarnings = uiCommitWarnings(context);
83159     function commit(selection2) {
83160       _selection = selection2;
83161       if (!context.changeset) initChangeset();
83162       loadDerivedChangesetTags();
83163       selection2.call(render);
83164     }
83165     function initChangeset() {
83166       var commentDate = +corePreferences("commentDate") || 0;
83167       var currDate = Date.now();
83168       var cutoff = 2 * 86400 * 1e3;
83169       if (commentDate > currDate || currDate - commentDate > cutoff) {
83170         corePreferences("comment", null);
83171         corePreferences("hashtags", null);
83172         corePreferences("source", null);
83173       }
83174       if (context.defaultChangesetComment()) {
83175         corePreferences("comment", context.defaultChangesetComment());
83176         corePreferences("commentDate", Date.now());
83177       }
83178       if (context.defaultChangesetSource()) {
83179         corePreferences("source", context.defaultChangesetSource());
83180         corePreferences("commentDate", Date.now());
83181       }
83182       if (context.defaultChangesetHashtags()) {
83183         corePreferences("hashtags", context.defaultChangesetHashtags());
83184         corePreferences("commentDate", Date.now());
83185       }
83186       var detected = utilDetect();
83187       var tags = {
83188         comment: corePreferences("comment") || "",
83189         created_by: context.cleanTagValue("iD " + context.version),
83190         host: context.cleanTagValue(detected.host),
83191         locale: context.cleanTagValue(_mainLocalizer.localeCode())
83192       };
83193       findHashtags(tags, true);
83194       var hashtags = corePreferences("hashtags");
83195       if (hashtags) {
83196         tags.hashtags = hashtags;
83197       }
83198       var source = corePreferences("source");
83199       if (source) {
83200         tags.source = source;
83201       }
83202       var photoOverlaysUsed = context.history().photoOverlaysUsed();
83203       if (photoOverlaysUsed.length) {
83204         var sources = (tags.source || "").split(";");
83205         if (sources.indexOf("streetlevel imagery") === -1) {
83206           sources.push("streetlevel imagery");
83207         }
83208         photoOverlaysUsed.forEach(function(photoOverlay) {
83209           if (sources.indexOf(photoOverlay) === -1) {
83210             sources.push(photoOverlay);
83211           }
83212         });
83213         tags.source = context.cleanTagValue(sources.filter(Boolean).join(";"));
83214       }
83215       context.changeset = new osmChangeset({ tags });
83216     }
83217     function loadDerivedChangesetTags() {
83218       var osm = context.connection();
83219       if (!osm) return;
83220       var tags = Object.assign({}, context.changeset.tags);
83221       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
83222       tags.imagery_used = imageryUsed || "None";
83223       var osmClosed = osm.getClosedIDs();
83224       var itemType;
83225       if (osmClosed.length) {
83226         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
83227       }
83228       if (services.keepRight) {
83229         var krClosed = services.keepRight.getClosedIDs();
83230         if (krClosed.length) {
83231           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
83232         }
83233       }
83234       if (services.osmose) {
83235         var osmoseClosed = services.osmose.getClosedCounts();
83236         for (itemType in osmoseClosed) {
83237           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
83238         }
83239       }
83240       for (var key in tags) {
83241         if (key.match(/(^warnings:)|(^resolved:)/)) {
83242           delete tags[key];
83243         }
83244       }
83245       function addIssueCounts(issues, prefix) {
83246         var issuesByType = utilArrayGroupBy(issues, "type");
83247         for (var issueType in issuesByType) {
83248           var issuesOfType = issuesByType[issueType];
83249           if (issuesOfType[0].subtype) {
83250             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
83251             for (var issueSubtype in issuesBySubtype) {
83252               var issuesOfSubtype = issuesBySubtype[issueSubtype];
83253               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
83254             }
83255           } else {
83256             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
83257           }
83258         }
83259       }
83260       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
83261         return issue.type !== "help_request";
83262       });
83263       addIssueCounts(warnings, "warnings");
83264       var resolvedIssues = context.validator().getResolvedIssues();
83265       addIssueCounts(resolvedIssues, "resolved");
83266       context.changeset = context.changeset.update({ tags });
83267     }
83268     function render(selection2) {
83269       var osm = context.connection();
83270       if (!osm) return;
83271       var header = selection2.selectAll(".header").data([0]);
83272       var headerTitle = header.enter().append("div").attr("class", "header fillL");
83273       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
83274       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
83275         dispatch14.call("cancel", this);
83276       }).call(svgIcon("#iD-icon-close"));
83277       var body = selection2.selectAll(".body").data([0]);
83278       body = body.enter().append("div").attr("class", "body").merge(body);
83279       var changesetSection = body.selectAll(".changeset-editor").data([0]);
83280       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
83281       changesetSection.call(
83282         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
83283       );
83284       body.call(commitWarnings);
83285       var saveSection = body.selectAll(".save-section").data([0]);
83286       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
83287       var prose = saveSection.selectAll(".commit-info").data([0]);
83288       if (prose.enter().size()) {
83289         _userDetails2 = null;
83290       }
83291       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
83292       osm.userDetails(function(err, user) {
83293         if (err) return;
83294         if (_userDetails2 === user) return;
83295         _userDetails2 = user;
83296         var userLink = select_default2(document.createElement("div"));
83297         if (user.image_url) {
83298           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
83299         }
83300         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
83301         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
83302       });
83303       var requestReview = saveSection.selectAll(".request-review").data([0]);
83304       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
83305       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
83306       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
83307       if (!labelEnter.empty()) {
83308         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
83309       }
83310       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
83311       labelEnter.append("span").call(_t.append("commit.request_review"));
83312       requestReview = requestReview.merge(requestReviewEnter);
83313       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
83314       var buttonSection = saveSection.selectAll(".buttons").data([0]);
83315       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
83316       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
83317       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
83318       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
83319       var uploadBlockerTooltipText = getUploadBlockerMessage();
83320       buttonSection = buttonSection.merge(buttonEnter);
83321       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
83322         dispatch14.call("cancel", this);
83323       });
83324       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
83325         if (!select_default2(this).classed("disabled")) {
83326           this.blur();
83327           for (var key in context.changeset.tags) {
83328             if (!key) delete context.changeset.tags[key];
83329           }
83330           context.uploader().save(context.changeset);
83331         }
83332       });
83333       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
83334       if (uploadBlockerTooltipText) {
83335         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
83336       }
83337       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
83338       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
83339       tagSection.call(
83340         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83341       );
83342       var changesSection = body.selectAll(".commit-changes-section").data([0]);
83343       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
83344       changesSection.call(commitChanges.render);
83345       function toggleRequestReview() {
83346         var rr = requestReviewInput.property("checked");
83347         updateChangeset({ review_requested: rr ? "yes" : void 0 });
83348         tagSection.call(
83349           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
83350         );
83351       }
83352     }
83353     function getUploadBlockerMessage() {
83354       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
83355       if (errors.length) {
83356         return _t.append("commit.outstanding_errors_message", { count: errors.length });
83357       } else {
83358         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
83359         if (!hasChangesetComment) {
83360           return _t.append("commit.comment_needed_message");
83361         }
83362       }
83363       return null;
83364     }
83365     function changeTags(_3, changed, onInput) {
83366       if (changed.hasOwnProperty("comment")) {
83367         if (!onInput) {
83368           corePreferences("comment", changed.comment);
83369           corePreferences("commentDate", Date.now());
83370         }
83371       }
83372       if (changed.hasOwnProperty("source")) {
83373         if (changed.source === void 0) {
83374           corePreferences("source", null);
83375         } else if (!onInput) {
83376           corePreferences("source", changed.source);
83377           corePreferences("commentDate", Date.now());
83378         }
83379       }
83380       updateChangeset(changed, onInput);
83381       if (_selection) {
83382         _selection.call(render);
83383       }
83384     }
83385     function findHashtags(tags, commentOnly) {
83386       var detectedHashtags = commentHashtags();
83387       if (detectedHashtags.length) {
83388         corePreferences("hashtags", null);
83389       }
83390       if (!detectedHashtags.length || !commentOnly) {
83391         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
83392       }
83393       var allLowerCase = /* @__PURE__ */ new Set();
83394       return detectedHashtags.filter(function(hashtag) {
83395         var lowerCase = hashtag.toLowerCase();
83396         if (!allLowerCase.has(lowerCase)) {
83397           allLowerCase.add(lowerCase);
83398           return true;
83399         }
83400         return false;
83401       });
83402       function commentHashtags() {
83403         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
83404         return matches || [];
83405       }
83406       function hashtagHashtags() {
83407         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
83408           if (s2[0] !== "#") {
83409             s2 = "#" + s2;
83410           }
83411           var matched = s2.match(hashtagRegex);
83412           return matched && matched[0];
83413         }).filter(Boolean);
83414         return matches || [];
83415       }
83416     }
83417     function isReviewRequested(tags) {
83418       var rr = tags.review_requested;
83419       if (rr === void 0) return false;
83420       rr = rr.trim().toLowerCase();
83421       return !(rr === "" || rr === "no");
83422     }
83423     function updateChangeset(changed, onInput) {
83424       var tags = Object.assign({}, context.changeset.tags);
83425       Object.keys(changed).forEach(function(k3) {
83426         var v3 = changed[k3];
83427         k3 = context.cleanTagKey(k3);
83428         if (readOnlyTags.indexOf(k3) !== -1) return;
83429         if (v3 === void 0) {
83430           delete tags[k3];
83431         } else if (onInput) {
83432           tags[k3] = v3;
83433         } else {
83434           tags[k3] = context.cleanTagValue(v3);
83435         }
83436       });
83437       if (!onInput) {
83438         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
83439         var arr = findHashtags(tags, commentOnly);
83440         if (arr.length) {
83441           tags.hashtags = context.cleanTagValue(arr.join(";"));
83442           corePreferences("hashtags", tags.hashtags);
83443         } else {
83444           delete tags.hashtags;
83445           corePreferences("hashtags", null);
83446         }
83447       }
83448       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
83449         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
83450         tags.changesets_count = String(changesetsCount);
83451         if (changesetsCount <= 100) {
83452           var s2;
83453           s2 = corePreferences("walkthrough_completed");
83454           if (s2) {
83455             tags["ideditor:walkthrough_completed"] = s2;
83456           }
83457           s2 = corePreferences("walkthrough_progress");
83458           if (s2) {
83459             tags["ideditor:walkthrough_progress"] = s2;
83460           }
83461           s2 = corePreferences("walkthrough_started");
83462           if (s2) {
83463             tags["ideditor:walkthrough_started"] = s2;
83464           }
83465         }
83466       } else {
83467         delete tags.changesets_count;
83468       }
83469       if (!(0, import_fast_deep_equal11.default)(context.changeset.tags, tags)) {
83470         context.changeset = context.changeset.update({ tags });
83471       }
83472     }
83473     commit.reset = function() {
83474       context.changeset = null;
83475     };
83476     return utilRebind(commit, dispatch14, "on");
83477   }
83478   var import_fast_deep_equal11, readOnlyTags, hashtagRegex;
83479   var init_commit = __esm({
83480     "modules/ui/commit.js"() {
83481       "use strict";
83482       init_src4();
83483       init_src5();
83484       import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
83485       init_preferences();
83486       init_localizer();
83487       init_osm();
83488       init_icon();
83489       init_services();
83490       init_tooltip();
83491       init_changeset_editor();
83492       init_changes();
83493       init_commit_warnings();
83494       init_raw_tag_editor();
83495       init_util();
83496       init_detect();
83497       readOnlyTags = [
83498         /^changesets_count$/,
83499         /^created_by$/,
83500         /^ideditor:/,
83501         /^imagery_used$/,
83502         /^host$/,
83503         /^locale$/,
83504         /^warnings:/,
83505         /^resolved:/,
83506         /^closed:note$/,
83507         /^closed:keepright$/,
83508         /^closed:osmose:/
83509       ];
83510       hashtagRegex = /([##][^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
83511     }
83512   });
83513
83514   // modules/modes/save.js
83515   var save_exports2 = {};
83516   __export(save_exports2, {
83517     modeSave: () => modeSave
83518   });
83519   function modeSave(context) {
83520     var mode = { id: "save" };
83521     var keybinding = utilKeybinding("modeSave");
83522     var commit = uiCommit(context).on("cancel", cancel);
83523     var _conflictsUi;
83524     var _location;
83525     var _success;
83526     var uploader = context.uploader().on("saveStarted.modeSave", function() {
83527       keybindingOff();
83528     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
83529       cancel();
83530     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
83531     function cancel() {
83532       context.enter(modeBrowse(context));
83533     }
83534     function showProgress(num, total) {
83535       var modal = context.container().select(".loading-modal .modal-section");
83536       var progress = modal.selectAll(".progress").data([0]);
83537       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
83538     }
83539     function showConflicts(changeset, conflicts, origChanges) {
83540       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
83541       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83542       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
83543         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83544         selection2.remove();
83545         keybindingOn();
83546         uploader.cancelConflictResolution();
83547       }).on("save", function() {
83548         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83549         selection2.remove();
83550         uploader.processResolvedConflicts(changeset);
83551       });
83552       selection2.call(_conflictsUi);
83553     }
83554     function showErrors(errors) {
83555       keybindingOn();
83556       var selection2 = uiConfirm(context.container());
83557       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
83558       addErrors(selection2, errors);
83559       selection2.okButton();
83560     }
83561     function addErrors(selection2, data) {
83562       var message = selection2.select(".modal-section.message-text");
83563       var items = message.selectAll(".error-container").data(data);
83564       var enter = items.enter().append("div").attr("class", "error-container");
83565       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
83566         return d2.msg || _t("save.unknown_error_details");
83567       }).on("click", function(d3_event) {
83568         d3_event.preventDefault();
83569         var error = select_default2(this);
83570         var detail = select_default2(this.nextElementSibling);
83571         var exp2 = error.classed("expanded");
83572         detail.style("display", exp2 ? "none" : "block");
83573         error.classed("expanded", !exp2);
83574       });
83575       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
83576       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
83577         return d2.details || [];
83578       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
83579         return d2;
83580       });
83581       items.exit().remove();
83582     }
83583     function showSuccess(changeset) {
83584       commit.reset();
83585       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
83586         context.ui().sidebar.hide();
83587       });
83588       context.enter(modeBrowse(context).sidebar(ui));
83589     }
83590     function keybindingOn() {
83591       select_default2(document).call(keybinding.on("\u238B", cancel, true));
83592     }
83593     function keybindingOff() {
83594       select_default2(document).call(keybinding.unbind);
83595     }
83596     function prepareForSuccess() {
83597       _success = uiSuccess(context);
83598       _location = null;
83599       if (!services.geocoder) return;
83600       services.geocoder.reverse(context.map().center(), function(err, result) {
83601         if (err || !result || !result.address) return;
83602         var addr = result.address;
83603         var place = addr && (addr.town || addr.city || addr.county) || "";
83604         var region = addr && (addr.state || addr.country) || "";
83605         var separator = place && region ? _t("success.thank_you_where.separator") : "";
83606         _location = _t(
83607           "success.thank_you_where.format",
83608           { place, separator, region }
83609         );
83610       });
83611     }
83612     mode.selectedIDs = function() {
83613       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
83614     };
83615     mode.enter = function() {
83616       context.ui().sidebar.expand();
83617       function done() {
83618         context.ui().sidebar.show(commit);
83619       }
83620       keybindingOn();
83621       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
83622       var osm = context.connection();
83623       if (!osm) {
83624         cancel();
83625         return;
83626       }
83627       if (osm.authenticated()) {
83628         done();
83629       } else {
83630         osm.authenticate(function(err) {
83631           if (err) {
83632             cancel();
83633           } else {
83634             done();
83635           }
83636         });
83637       }
83638     };
83639     mode.exit = function() {
83640       keybindingOff();
83641       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
83642       context.ui().sidebar.hide();
83643     };
83644     return mode;
83645   }
83646   var init_save2 = __esm({
83647     "modules/modes/save.js"() {
83648       "use strict";
83649       init_src5();
83650       init_localizer();
83651       init_browse();
83652       init_services();
83653       init_conflicts();
83654       init_confirm();
83655       init_commit();
83656       init_success();
83657       init_util();
83658     }
83659   });
83660
83661   // modules/modes/index.js
83662   var modes_exports2 = {};
83663   __export(modes_exports2, {
83664     modeAddArea: () => modeAddArea,
83665     modeAddLine: () => modeAddLine,
83666     modeAddNote: () => modeAddNote,
83667     modeAddPoint: () => modeAddPoint,
83668     modeBrowse: () => modeBrowse,
83669     modeDragNode: () => modeDragNode,
83670     modeDragNote: () => modeDragNote,
83671     modeDrawArea: () => modeDrawArea,
83672     modeDrawLine: () => modeDrawLine,
83673     modeMove: () => modeMove,
83674     modeRotate: () => modeRotate,
83675     modeSave: () => modeSave,
83676     modeSelect: () => modeSelect,
83677     modeSelectData: () => modeSelectData,
83678     modeSelectError: () => modeSelectError,
83679     modeSelectNote: () => modeSelectNote
83680   });
83681   var init_modes2 = __esm({
83682     "modules/modes/index.js"() {
83683       "use strict";
83684       init_add_area();
83685       init_add_line();
83686       init_add_point();
83687       init_add_note();
83688       init_browse();
83689       init_drag_node();
83690       init_drag_note();
83691       init_draw_area();
83692       init_draw_line();
83693       init_move3();
83694       init_rotate2();
83695       init_save2();
83696       init_select5();
83697       init_select_data();
83698       init_select_error();
83699       init_select_note();
83700     }
83701   });
83702
83703   // modules/core/context.js
83704   var context_exports = {};
83705   __export(context_exports, {
83706     coreContext: () => coreContext
83707   });
83708   function coreContext() {
83709     const dispatch14 = dispatch_default("enter", "exit", "change");
83710     const context = {};
83711     let _deferred2 = /* @__PURE__ */ new Set();
83712     context.version = package_default.version;
83713     context.privacyVersion = "20201202";
83714     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
83715     context.changeset = null;
83716     let _defaultChangesetComment = context.initialHashParams.comment;
83717     let _defaultChangesetSource = context.initialHashParams.source;
83718     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
83719     context.defaultChangesetComment = function(val) {
83720       if (!arguments.length) return _defaultChangesetComment;
83721       _defaultChangesetComment = val;
83722       return context;
83723     };
83724     context.defaultChangesetSource = function(val) {
83725       if (!arguments.length) return _defaultChangesetSource;
83726       _defaultChangesetSource = val;
83727       return context;
83728     };
83729     context.defaultChangesetHashtags = function(val) {
83730       if (!arguments.length) return _defaultChangesetHashtags;
83731       _defaultChangesetHashtags = val;
83732       return context;
83733     };
83734     let _setsDocumentTitle = true;
83735     context.setsDocumentTitle = function(val) {
83736       if (!arguments.length) return _setsDocumentTitle;
83737       _setsDocumentTitle = val;
83738       return context;
83739     };
83740     let _documentTitleBase = document.title;
83741     context.documentTitleBase = function(val) {
83742       if (!arguments.length) return _documentTitleBase;
83743       _documentTitleBase = val;
83744       return context;
83745     };
83746     let _ui;
83747     context.ui = () => _ui;
83748     context.lastPointerType = () => _ui.lastPointerType();
83749     let _keybinding = utilKeybinding("context");
83750     context.keybinding = () => _keybinding;
83751     select_default2(document).call(_keybinding);
83752     let _connection = services.osm;
83753     let _history;
83754     let _validator;
83755     let _uploader;
83756     context.connection = () => _connection;
83757     context.history = () => _history;
83758     context.validator = () => _validator;
83759     context.uploader = () => _uploader;
83760     context.preauth = (options) => {
83761       if (_connection) {
83762         _connection.switch(options);
83763       }
83764       return context;
83765     };
83766     context.locale = function(locale3) {
83767       if (!arguments.length) return _mainLocalizer.localeCode();
83768       _mainLocalizer.preferredLocaleCodes(locale3);
83769       return context;
83770     };
83771     function afterLoad(cid, callback) {
83772       return (err, result) => {
83773         if (err) {
83774           if (typeof callback === "function") {
83775             callback(err);
83776           }
83777           return;
83778         } else if (_connection && _connection.getConnectionId() !== cid) {
83779           if (typeof callback === "function") {
83780             callback({ message: "Connection Switched", status: -1 });
83781           }
83782           return;
83783         } else {
83784           _history.merge(result.data, result.extent);
83785           if (typeof callback === "function") {
83786             callback(err, result);
83787           }
83788           return;
83789         }
83790       };
83791     }
83792     context.loadTiles = (projection2, callback) => {
83793       const handle = window.requestIdleCallback(() => {
83794         _deferred2.delete(handle);
83795         if (_connection && context.editableDataEnabled()) {
83796           const cid = _connection.getConnectionId();
83797           _connection.loadTiles(projection2, afterLoad(cid, callback));
83798         }
83799       });
83800       _deferred2.add(handle);
83801     };
83802     context.loadTileAtLoc = (loc, callback) => {
83803       const handle = window.requestIdleCallback(() => {
83804         _deferred2.delete(handle);
83805         if (_connection && context.editableDataEnabled()) {
83806           const cid = _connection.getConnectionId();
83807           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
83808         }
83809       });
83810       _deferred2.add(handle);
83811     };
83812     context.loadEntity = (entityID, callback) => {
83813       if (_connection) {
83814         const cid = _connection.getConnectionId();
83815         _connection.loadEntity(entityID, afterLoad(cid, callback));
83816         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
83817       }
83818     };
83819     context.loadNote = (entityID, callback) => {
83820       if (_connection) {
83821         const cid = _connection.getConnectionId();
83822         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
83823       }
83824     };
83825     context.zoomToEntity = (entityID, zoomTo) => {
83826       context.zoomToEntities([entityID], zoomTo);
83827     };
83828     context.zoomToEntities = (entityIDs, zoomTo) => {
83829       let loadedEntities = [];
83830       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
83831       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
83832         if (err) return;
83833         const entity = result.data.find((e3) => e3.id === entityID);
83834         if (!entity) return;
83835         loadedEntities.push(entity);
83836         if (zoomTo !== false) {
83837           throttledZoomTo();
83838         }
83839       }));
83840       _map.on("drawn.zoomToEntity", () => {
83841         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
83842         _map.on("drawn.zoomToEntity", null);
83843         context.on("enter.zoomToEntity", null);
83844         context.enter(modeSelect(context, entityIDs));
83845       });
83846       context.on("enter.zoomToEntity", () => {
83847         if (_mode.id !== "browse") {
83848           _map.on("drawn.zoomToEntity", null);
83849           context.on("enter.zoomToEntity", null);
83850         }
83851       });
83852     };
83853     context.moveToNote = (noteId, moveTo) => {
83854       context.loadNote(noteId, (err, result) => {
83855         if (err) return;
83856         const entity = result.data.find((e3) => e3.id === noteId);
83857         if (!entity) return;
83858         const note = services.osm.getNote(noteId);
83859         if (moveTo !== false) {
83860           context.map().center(note.loc);
83861         }
83862         const noteLayer = context.layers().layer("notes");
83863         noteLayer.enabled(true);
83864         context.enter(modeSelectNote(context, noteId));
83865       });
83866     };
83867     let _minEditableZoom = 16;
83868     context.minEditableZoom = function(val) {
83869       if (!arguments.length) return _minEditableZoom;
83870       _minEditableZoom = val;
83871       if (_connection) {
83872         _connection.tileZoom(val);
83873       }
83874       return context;
83875     };
83876     context.maxCharsForTagKey = () => 255;
83877     context.maxCharsForTagValue = () => 255;
83878     context.maxCharsForRelationRole = () => 255;
83879     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
83880     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
83881     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
83882     let _inIntro = false;
83883     context.inIntro = function(val) {
83884       if (!arguments.length) return _inIntro;
83885       _inIntro = val;
83886       return context;
83887     };
83888     context.save = () => {
83889       if (_inIntro || context.container().select(".modal").size()) return;
83890       let canSave;
83891       if (_mode && _mode.id === "save") {
83892         canSave = false;
83893         if (services.osm && services.osm.isChangesetInflight()) {
83894           _history.clearSaved();
83895           return;
83896         }
83897       } else {
83898         canSave = context.selectedIDs().every((id2) => {
83899           const entity = context.hasEntity(id2);
83900           return entity && !entity.isDegenerate();
83901         });
83902       }
83903       if (canSave) {
83904         _history.save();
83905       }
83906       if (_history.hasChanges()) {
83907         return _t("save.unsaved_changes");
83908       }
83909     };
83910     context.debouncedSave = debounce_default(context.save, 350);
83911     function withDebouncedSave(fn) {
83912       return function() {
83913         const result = fn.apply(_history, arguments);
83914         context.debouncedSave();
83915         return result;
83916       };
83917     }
83918     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
83919     context.entity = (id2) => _history.graph().entity(id2);
83920     let _mode;
83921     context.mode = () => _mode;
83922     context.enter = (newMode) => {
83923       if (_mode) {
83924         _mode.exit();
83925         dispatch14.call("exit", this, _mode);
83926       }
83927       _mode = newMode;
83928       _mode.enter();
83929       dispatch14.call("enter", this, _mode);
83930     };
83931     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
83932     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
83933     let _selectedNoteID;
83934     context.selectedNoteID = function(noteID) {
83935       if (!arguments.length) return _selectedNoteID;
83936       _selectedNoteID = noteID;
83937       return context;
83938     };
83939     let _selectedErrorID;
83940     context.selectedErrorID = function(errorID) {
83941       if (!arguments.length) return _selectedErrorID;
83942       _selectedErrorID = errorID;
83943       return context;
83944     };
83945     context.install = (behavior) => context.surface().call(behavior);
83946     context.uninstall = (behavior) => context.surface().call(behavior.off);
83947     let _copyGraph;
83948     context.copyGraph = () => _copyGraph;
83949     let _copyIDs = [];
83950     context.copyIDs = function(val) {
83951       if (!arguments.length) return _copyIDs;
83952       _copyIDs = val;
83953       _copyGraph = _history.graph();
83954       return context;
83955     };
83956     let _copyLonLat;
83957     context.copyLonLat = function(val) {
83958       if (!arguments.length) return _copyLonLat;
83959       _copyLonLat = val;
83960       return context;
83961     };
83962     let _background;
83963     context.background = () => _background;
83964     let _features;
83965     context.features = () => _features;
83966     context.hasHiddenConnections = (id2) => {
83967       const graph = _history.graph();
83968       const entity = graph.entity(id2);
83969       return _features.hasHiddenConnections(entity, graph);
83970     };
83971     let _photos;
83972     context.photos = () => _photos;
83973     let _map;
83974     context.map = () => _map;
83975     context.layers = () => _map.layers();
83976     context.surface = () => _map.surface;
83977     context.editableDataEnabled = () => _map.editableDataEnabled();
83978     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
83979     context.editable = () => {
83980       const mode = context.mode();
83981       if (!mode || mode.id === "save") return false;
83982       return _map.editableDataEnabled();
83983     };
83984     let _debugFlags = {
83985       tile: false,
83986       // tile boundaries
83987       collision: false,
83988       // label collision bounding boxes
83989       imagery: false,
83990       // imagery bounding polygons
83991       target: false,
83992       // touch targets
83993       downloaded: false
83994       // downloaded data from osm
83995     };
83996     context.debugFlags = () => _debugFlags;
83997     context.getDebug = (flag) => flag && _debugFlags[flag];
83998     context.setDebug = function(flag, val) {
83999       if (arguments.length === 1) val = true;
84000       _debugFlags[flag] = val;
84001       dispatch14.call("change");
84002       return context;
84003     };
84004     let _container = select_default2(null);
84005     context.container = function(val) {
84006       if (!arguments.length) return _container;
84007       _container = val;
84008       _container.classed("ideditor", true);
84009       return context;
84010     };
84011     context.containerNode = function(val) {
84012       if (!arguments.length) return context.container().node();
84013       context.container(select_default2(val));
84014       return context;
84015     };
84016     let _embed;
84017     context.embed = function(val) {
84018       if (!arguments.length) return _embed;
84019       _embed = val;
84020       return context;
84021     };
84022     let _assetPath = "";
84023     context.assetPath = function(val) {
84024       if (!arguments.length) return _assetPath;
84025       _assetPath = val;
84026       _mainFileFetcher.assetPath(val);
84027       return context;
84028     };
84029     let _assetMap = {};
84030     context.assetMap = function(val) {
84031       if (!arguments.length) return _assetMap;
84032       _assetMap = val;
84033       _mainFileFetcher.assetMap(val);
84034       return context;
84035     };
84036     context.asset = (val) => {
84037       if (/^http(s)?:\/\//i.test(val)) return val;
84038       const filename = _assetPath + val;
84039       return _assetMap[filename] || filename;
84040     };
84041     context.imagePath = (val) => context.asset(`img/${val}`);
84042     context.reset = context.flush = () => {
84043       context.debouncedSave.cancel();
84044       Array.from(_deferred2).forEach((handle) => {
84045         window.cancelIdleCallback(handle);
84046         _deferred2.delete(handle);
84047       });
84048       Object.values(services).forEach((service) => {
84049         if (service && typeof service.reset === "function") {
84050           service.reset(context);
84051         }
84052       });
84053       context.changeset = null;
84054       _validator.reset();
84055       _features.reset();
84056       _history.reset();
84057       _uploader.reset();
84058       context.container().select(".inspector-wrap *").remove();
84059       return context;
84060     };
84061     context.projection = geoRawMercator();
84062     context.curtainProjection = geoRawMercator();
84063     context.init = () => {
84064       instantiateInternal();
84065       initializeDependents();
84066       return context;
84067       function instantiateInternal() {
84068         _history = coreHistory(context);
84069         context.graph = _history.graph;
84070         context.pauseChangeDispatch = _history.pauseChangeDispatch;
84071         context.resumeChangeDispatch = _history.resumeChangeDispatch;
84072         context.perform = withDebouncedSave(_history.perform);
84073         context.replace = withDebouncedSave(_history.replace);
84074         context.pop = withDebouncedSave(_history.pop);
84075         context.overwrite = withDebouncedSave(_history.overwrite);
84076         context.undo = withDebouncedSave(_history.undo);
84077         context.redo = withDebouncedSave(_history.redo);
84078         _validator = coreValidator(context);
84079         _uploader = coreUploader(context);
84080         _background = rendererBackground(context);
84081         _features = rendererFeatures(context);
84082         _map = rendererMap(context);
84083         _photos = rendererPhotos(context);
84084         _ui = uiInit(context);
84085       }
84086       function initializeDependents() {
84087         if (context.initialHashParams.presets) {
84088           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
84089         }
84090         if (context.initialHashParams.locale) {
84091           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
84092         }
84093         _mainLocalizer.ensureLoaded();
84094         _mainPresetIndex.ensureLoaded();
84095         _background.ensureLoaded();
84096         Object.values(services).forEach((service) => {
84097           if (service && typeof service.init === "function") {
84098             service.init();
84099           }
84100         });
84101         _map.init();
84102         _validator.init();
84103         _features.init();
84104         if (services.maprules && context.initialHashParams.maprules) {
84105           json_default(context.initialHashParams.maprules).then((mapcss) => {
84106             services.maprules.init();
84107             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
84108           }).catch(() => {
84109           });
84110         }
84111         if (!context.container().empty()) {
84112           _ui.ensureLoaded().then(() => {
84113             _background.init();
84114             _photos.init();
84115           });
84116         }
84117       }
84118     };
84119     return utilRebind(context, dispatch14, "on");
84120   }
84121   var init_context2 = __esm({
84122     "modules/core/context.js"() {
84123       "use strict";
84124       init_debounce();
84125       init_throttle();
84126       init_src4();
84127       init_src18();
84128       init_src5();
84129       init_package();
84130       init_localizer();
84131       init_file_fetcher();
84132       init_localizer();
84133       init_history();
84134       init_validator();
84135       init_uploader();
84136       init_raw_mercator();
84137       init_modes2();
84138       init_presets();
84139       init_renderer();
84140       init_services();
84141       init_init2();
84142       init_util();
84143     }
84144   });
84145
84146   // modules/core/index.js
84147   var core_exports = {};
84148   __export(core_exports, {
84149     LocationManager: () => LocationManager,
84150     coreContext: () => coreContext,
84151     coreDifference: () => coreDifference,
84152     coreFileFetcher: () => coreFileFetcher,
84153     coreGraph: () => coreGraph,
84154     coreHistory: () => coreHistory,
84155     coreLocalizer: () => coreLocalizer,
84156     coreTree: () => coreTree,
84157     coreUploader: () => coreUploader,
84158     coreValidator: () => coreValidator,
84159     fileFetcher: () => _mainFileFetcher,
84160     localizer: () => _mainLocalizer,
84161     locationManager: () => _sharedLocationManager,
84162     prefs: () => corePreferences,
84163     t: () => _t
84164   });
84165   var init_core = __esm({
84166     "modules/core/index.js"() {
84167       "use strict";
84168       init_context2();
84169       init_file_fetcher();
84170       init_difference();
84171       init_graph();
84172       init_history();
84173       init_localizer();
84174       init_LocationManager();
84175       init_preferences();
84176       init_tree();
84177       init_uploader();
84178       init_validator();
84179     }
84180   });
84181
84182   // modules/behavior/operation.js
84183   var operation_exports = {};
84184   __export(operation_exports, {
84185     behaviorOperation: () => behaviorOperation
84186   });
84187   function behaviorOperation(context) {
84188     var _operation;
84189     function keypress(d3_event) {
84190       var _a4;
84191       if (!context.map().withinEditableZoom()) return;
84192       if (((_a4 = _operation.availableForKeypress) == null ? void 0 : _a4.call(_operation)) === false) return;
84193       d3_event.preventDefault();
84194       if (!_operation.available()) {
84195         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_t.append("operations._unavailable", {
84196           operation: _t(`operations.${_operation.id}.title`) || _operation.id
84197         }))();
84198       } else if (_operation.disabled()) {
84199         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
84200       } else {
84201         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
84202         if (_operation.point) _operation.point(null);
84203         _operation(d3_event);
84204       }
84205     }
84206     function behavior() {
84207       if (_operation && _operation.available()) {
84208         behavior.on();
84209       }
84210       return behavior;
84211     }
84212     behavior.on = function() {
84213       context.keybinding().on(_operation.keys, keypress);
84214     };
84215     behavior.off = function() {
84216       context.keybinding().off(_operation.keys);
84217     };
84218     behavior.which = function(_3) {
84219       if (!arguments.length) return _operation;
84220       _operation = _3;
84221       return behavior;
84222     };
84223     return behavior;
84224   }
84225   var init_operation = __esm({
84226     "modules/behavior/operation.js"() {
84227       "use strict";
84228       init_core();
84229     }
84230   });
84231
84232   // modules/operations/circularize.js
84233   var circularize_exports2 = {};
84234   __export(circularize_exports2, {
84235     operationCircularize: () => operationCircularize
84236   });
84237   function operationCircularize(context, selectedIDs) {
84238     var _extent;
84239     var _actions = selectedIDs.map(getAction).filter(Boolean);
84240     var _amount = _actions.length === 1 ? "single" : "multiple";
84241     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
84242       return n3.loc;
84243     });
84244     function getAction(entityID) {
84245       var entity = context.entity(entityID);
84246       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
84247       if (!_extent) {
84248         _extent = entity.extent(context.graph());
84249       } else {
84250         _extent = _extent.extend(entity.extent(context.graph()));
84251       }
84252       return actionCircularize(entityID, context.projection);
84253     }
84254     var operation2 = function() {
84255       if (!_actions.length) return;
84256       var combinedAction = function(graph, t2) {
84257         _actions.forEach(function(action) {
84258           if (!action.disabled(graph)) {
84259             graph = action(graph, t2);
84260           }
84261         });
84262         return graph;
84263       };
84264       combinedAction.transitionable = true;
84265       context.perform(combinedAction, operation2.annotation());
84266       window.setTimeout(function() {
84267         context.validator().validate();
84268       }, 300);
84269     };
84270     operation2.available = function() {
84271       return _actions.length && selectedIDs.length === _actions.length;
84272     };
84273     operation2.disabled = function() {
84274       if (!_actions.length) return "";
84275       var actionDisableds = _actions.map(function(action) {
84276         return action.disabled(context.graph());
84277       }).filter(Boolean);
84278       if (actionDisableds.length === _actions.length) {
84279         if (new Set(actionDisableds).size > 1) {
84280           return "multiple_blockers";
84281         }
84282         return actionDisableds[0];
84283       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
84284         return "too_large";
84285       } else if (someMissing()) {
84286         return "not_downloaded";
84287       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84288         return "connected_to_hidden";
84289       }
84290       return false;
84291       function someMissing() {
84292         if (context.inIntro()) return false;
84293         var osm = context.connection();
84294         if (osm) {
84295           var missing = _coords.filter(function(loc) {
84296             return !osm.isDataLoaded(loc);
84297           });
84298           if (missing.length) {
84299             missing.forEach(function(loc) {
84300               context.loadTileAtLoc(loc);
84301             });
84302             return true;
84303           }
84304         }
84305         return false;
84306       }
84307     };
84308     operation2.tooltip = function() {
84309       var disable = operation2.disabled();
84310       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
84311     };
84312     operation2.annotation = function() {
84313       return _t("operations.circularize.annotation.feature", { n: _actions.length });
84314     };
84315     operation2.id = "circularize";
84316     operation2.keys = [_t("operations.circularize.key")];
84317     operation2.title = _t.append("operations.circularize.title");
84318     operation2.behavior = behaviorOperation(context).which(operation2);
84319     return operation2;
84320   }
84321   var init_circularize2 = __esm({
84322     "modules/operations/circularize.js"() {
84323       "use strict";
84324       init_localizer();
84325       init_circularize();
84326       init_operation();
84327       init_util();
84328     }
84329   });
84330
84331   // modules/operations/rotate.js
84332   var rotate_exports3 = {};
84333   __export(rotate_exports3, {
84334     operationRotate: () => operationRotate
84335   });
84336   function operationRotate(context, selectedIDs) {
84337     var multi = selectedIDs.length === 1 ? "single" : "multiple";
84338     var nodes = utilGetAllNodes(selectedIDs, context.graph());
84339     var coords = nodes.map(function(n3) {
84340       return n3.loc;
84341     });
84342     var extent = utilTotalExtent(selectedIDs, context.graph());
84343     var operation2 = function() {
84344       context.enter(modeRotate(context, selectedIDs));
84345     };
84346     operation2.available = function() {
84347       return nodes.length >= 2;
84348     };
84349     operation2.disabled = function() {
84350       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84351         return "too_large";
84352       } else if (someMissing()) {
84353         return "not_downloaded";
84354       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84355         return "connected_to_hidden";
84356       } else if (selectedIDs.some(incompleteRelation)) {
84357         return "incomplete_relation";
84358       }
84359       return false;
84360       function someMissing() {
84361         if (context.inIntro()) return false;
84362         var osm = context.connection();
84363         if (osm) {
84364           var missing = coords.filter(function(loc) {
84365             return !osm.isDataLoaded(loc);
84366           });
84367           if (missing.length) {
84368             missing.forEach(function(loc) {
84369               context.loadTileAtLoc(loc);
84370             });
84371             return true;
84372           }
84373         }
84374         return false;
84375       }
84376       function incompleteRelation(id2) {
84377         var entity = context.entity(id2);
84378         return entity.type === "relation" && !entity.isComplete(context.graph());
84379       }
84380     };
84381     operation2.tooltip = function() {
84382       var disable = operation2.disabled();
84383       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
84384     };
84385     operation2.annotation = function() {
84386       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
84387     };
84388     operation2.id = "rotate";
84389     operation2.keys = [_t("operations.rotate.key")];
84390     operation2.title = _t.append("operations.rotate.title");
84391     operation2.behavior = behaviorOperation(context).which(operation2);
84392     operation2.mouseOnly = true;
84393     return operation2;
84394   }
84395   var init_rotate3 = __esm({
84396     "modules/operations/rotate.js"() {
84397       "use strict";
84398       init_localizer();
84399       init_operation();
84400       init_rotate2();
84401       init_util2();
84402     }
84403   });
84404
84405   // modules/modes/move.js
84406   var move_exports3 = {};
84407   __export(move_exports3, {
84408     modeMove: () => modeMove
84409   });
84410   function modeMove(context, entityIDs, baseGraph) {
84411     var _tolerancePx = 4;
84412     var mode = {
84413       id: "move",
84414       button: "browse"
84415     };
84416     var keybinding = utilKeybinding("move");
84417     var behaviors = [
84418       behaviorEdit(context),
84419       operationCircularize(context, entityIDs).behavior,
84420       operationDelete(context, entityIDs).behavior,
84421       operationOrthogonalize(context, entityIDs).behavior,
84422       operationReflectLong(context, entityIDs).behavior,
84423       operationReflectShort(context, entityIDs).behavior,
84424       operationRotate(context, entityIDs).behavior
84425     ];
84426     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
84427     var _prevGraph;
84428     var _cache5;
84429     var _prevMouse;
84430     var _nudgeInterval;
84431     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
84432     function doMove(nudge) {
84433       nudge = nudge || [0, 0];
84434       let fn;
84435       if (_prevGraph !== context.graph()) {
84436         _cache5 = {};
84437         _prevMouse = context.map().mouse();
84438         fn = context.perform;
84439       } else {
84440         fn = context.overwrite;
84441       }
84442       const currMouse = context.map().mouse();
84443       const delta = geoVecSubtract(geoVecSubtract(currMouse, _prevMouse), nudge);
84444       _prevMouse = currMouse;
84445       fn(actionMove(entityIDs, delta, context.projection, _cache5));
84446       _prevGraph = context.graph();
84447     }
84448     function startNudge(nudge) {
84449       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
84450       _nudgeInterval = window.setInterval(function() {
84451         context.map().pan(nudge);
84452         doMove(nudge);
84453       }, 50);
84454     }
84455     function stopNudge() {
84456       if (_nudgeInterval) {
84457         window.clearInterval(_nudgeInterval);
84458         _nudgeInterval = null;
84459       }
84460     }
84461     function move() {
84462       doMove();
84463       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
84464       if (nudge) {
84465         startNudge(nudge);
84466       } else {
84467         stopNudge();
84468       }
84469     }
84470     function finish(d3_event) {
84471       d3_event.stopPropagation();
84472       context.replace(actionNoop(), annotation);
84473       context.enter(modeSelect(context, entityIDs));
84474       stopNudge();
84475     }
84476     function cancel() {
84477       if (baseGraph) {
84478         while (context.graph() !== baseGraph) context.pop();
84479         context.enter(modeBrowse(context));
84480       } else {
84481         if (_prevGraph) context.pop();
84482         context.enter(modeSelect(context, entityIDs));
84483       }
84484       stopNudge();
84485     }
84486     function undone() {
84487       context.enter(modeBrowse(context));
84488     }
84489     mode.enter = function() {
84490       _prevMouse = context.map().mouse();
84491       _prevGraph = null;
84492       _cache5 = {};
84493       context.features().forceVisible(entityIDs);
84494       behaviors.forEach(context.install);
84495       var downEvent;
84496       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
84497         downEvent = d3_event;
84498       });
84499       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
84500         if (!downEvent) return;
84501         var mapNode = context.container().select(".main-map").node();
84502         var pointGetter = utilFastMouse(mapNode);
84503         var p1 = pointGetter(downEvent);
84504         var p2 = pointGetter(d3_event);
84505         var dist = geoVecLength(p1, p2);
84506         if (dist <= _tolerancePx) finish(d3_event);
84507         downEvent = null;
84508       }, true);
84509       context.history().on("undone.modeMove", undone);
84510       keybinding.on("\u238B", cancel).on("\u21A9", finish);
84511       select_default2(document).call(keybinding);
84512     };
84513     mode.exit = function() {
84514       stopNudge();
84515       behaviors.forEach(function(behavior) {
84516         context.uninstall(behavior);
84517       });
84518       context.surface().on(_pointerPrefix + "down.modeMove", null);
84519       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
84520       context.history().on("undone.modeMove", null);
84521       select_default2(document).call(keybinding.unbind);
84522       context.features().forceVisible([]);
84523     };
84524     mode.selectedIDs = function() {
84525       if (!arguments.length) return entityIDs;
84526       return mode;
84527     };
84528     return mode;
84529   }
84530   var init_move3 = __esm({
84531     "modules/modes/move.js"() {
84532       "use strict";
84533       init_src5();
84534       init_localizer();
84535       init_move();
84536       init_noop2();
84537       init_edit();
84538       init_vector();
84539       init_geom();
84540       init_browse();
84541       init_select5();
84542       init_util();
84543       init_util2();
84544       init_circularize2();
84545       init_delete();
84546       init_orthogonalize2();
84547       init_reflect2();
84548       init_rotate3();
84549     }
84550   });
84551
84552   // modules/behavior/paste.js
84553   var paste_exports = {};
84554   __export(paste_exports, {
84555     behaviorPaste: () => behaviorPaste
84556   });
84557   function behaviorPaste(context) {
84558     function doPaste(d3_event) {
84559       if (!context.map().withinEditableZoom()) return;
84560       const isOsmLayerEnabled = context.layers().layer("osm").enabled();
84561       if (!isOsmLayerEnabled) return;
84562       d3_event.preventDefault();
84563       var baseGraph = context.graph();
84564       var mouse = context.map().mouse();
84565       var projection2 = context.projection;
84566       var viewport = geoExtent(projection2.clipExtent()).polygon();
84567       if (!geoPointInPolygon(mouse, viewport)) return;
84568       var oldIDs = context.copyIDs();
84569       if (!oldIDs.length) return;
84570       var extent = geoExtent();
84571       var oldGraph = context.copyGraph();
84572       var newIDs = [];
84573       var action = actionCopyEntities(oldIDs, oldGraph);
84574       context.perform(action);
84575       var copies = action.copies();
84576       var originals = /* @__PURE__ */ new Set();
84577       Object.values(copies).forEach(function(entity) {
84578         originals.add(entity.id);
84579       });
84580       for (var id2 in copies) {
84581         var oldEntity = oldGraph.entity(id2);
84582         var newEntity = copies[id2];
84583         extent._extend(oldEntity.extent(oldGraph));
84584         var parents = context.graph().parentWays(newEntity);
84585         var parentCopied = parents.some(function(parent2) {
84586           return originals.has(parent2.id);
84587         });
84588         if (!parentCopied) {
84589           newIDs.push(newEntity.id);
84590         }
84591       }
84592       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
84593       var delta = geoVecSubtract(mouse, copyPoint);
84594       context.perform(actionMove(newIDs, delta, projection2));
84595       context.enter(modeMove(context, newIDs, baseGraph));
84596     }
84597     function behavior() {
84598       context.keybinding().on(uiCmd("\u2318V"), doPaste);
84599       return behavior;
84600     }
84601     behavior.off = function() {
84602       context.keybinding().off(uiCmd("\u2318V"));
84603     };
84604     return behavior;
84605   }
84606   var init_paste = __esm({
84607     "modules/behavior/paste.js"() {
84608       "use strict";
84609       init_copy_entities();
84610       init_move();
84611       init_geo2();
84612       init_move3();
84613       init_cmd();
84614     }
84615   });
84616
84617   // modules/operations/continue.js
84618   var continue_exports = {};
84619   __export(continue_exports, {
84620     operationContinue: () => operationContinue
84621   });
84622   function operationContinue(context, selectedIDs) {
84623     var _entities = selectedIDs.map(function(id2) {
84624       return context.graph().entity(id2);
84625     });
84626     var _geometries = Object.assign(
84627       { line: [], vertex: [] },
84628       utilArrayGroupBy(_entities, function(entity) {
84629         return entity.geometry(context.graph());
84630       })
84631     );
84632     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
84633     function candidateWays() {
84634       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent2) {
84635         const geom = parent2.geometry(context.graph());
84636         return (geom === "line" || geom === "area") && !parent2.isClosed() && parent2.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent2);
84637       }) : [];
84638     }
84639     var _candidates = candidateWays();
84640     var operation2 = function() {
84641       var candidate = _candidates[0];
84642       const tagsToRemove = /* @__PURE__ */ new Set();
84643       if (_vertex.tags.fixme === "continue") tagsToRemove.add("fixme");
84644       if (_vertex.tags.noexit === "yes") tagsToRemove.add("noexit");
84645       if (tagsToRemove.size) {
84646         context.perform((graph) => {
84647           const newTags = { ..._vertex.tags };
84648           for (const key of tagsToRemove) {
84649             delete newTags[key];
84650           }
84651           return actionChangeTags(_vertex.id, newTags)(graph);
84652         }, operation2.annotation());
84653       }
84654       context.enter(
84655         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
84656       );
84657     };
84658     operation2.relatedEntityIds = function() {
84659       return _candidates.length ? [_candidates[0].id] : [];
84660     };
84661     operation2.available = function() {
84662       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
84663     };
84664     operation2.disabled = function() {
84665       if (_candidates.length === 0) {
84666         return "not_eligible";
84667       } else if (_candidates.length > 1) {
84668         return "multiple";
84669       }
84670       return false;
84671     };
84672     operation2.tooltip = function() {
84673       var disable = operation2.disabled();
84674       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
84675     };
84676     operation2.annotation = function() {
84677       return _t("operations.continue.annotation.line");
84678     };
84679     operation2.id = "continue";
84680     operation2.keys = [_t("operations.continue.key")];
84681     operation2.title = _t.append("operations.continue.title");
84682     operation2.behavior = behaviorOperation(context).which(operation2);
84683     return operation2;
84684   }
84685   var init_continue = __esm({
84686     "modules/operations/continue.js"() {
84687       "use strict";
84688       init_localizer();
84689       init_draw_line();
84690       init_operation();
84691       init_util();
84692       init_actions();
84693     }
84694   });
84695
84696   // modules/operations/copy.js
84697   var copy_exports = {};
84698   __export(copy_exports, {
84699     operationCopy: () => operationCopy
84700   });
84701   function operationCopy(context, selectedIDs) {
84702     function getFilteredIdsToCopy() {
84703       return selectedIDs.filter(function(selectedID) {
84704         var entity = context.graph().hasEntity(selectedID);
84705         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
84706       });
84707     }
84708     var operation2 = function() {
84709       var graph = context.graph();
84710       var selected = groupEntities(getFilteredIdsToCopy(), graph);
84711       var canCopy = [];
84712       var skip = {};
84713       var entity;
84714       var i3;
84715       for (i3 = 0; i3 < selected.relation.length; i3++) {
84716         entity = selected.relation[i3];
84717         if (!skip[entity.id] && entity.isComplete(graph)) {
84718           canCopy.push(entity.id);
84719           skip = getDescendants(entity.id, graph, skip);
84720         }
84721       }
84722       for (i3 = 0; i3 < selected.way.length; i3++) {
84723         entity = selected.way[i3];
84724         if (!skip[entity.id]) {
84725           canCopy.push(entity.id);
84726           skip = getDescendants(entity.id, graph, skip);
84727         }
84728       }
84729       for (i3 = 0; i3 < selected.node.length; i3++) {
84730         entity = selected.node[i3];
84731         if (!skip[entity.id]) {
84732           canCopy.push(entity.id);
84733         }
84734       }
84735       context.copyIDs(canCopy);
84736       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
84737         context.copyLonLat(context.projection.invert(_point));
84738       } else {
84739         context.copyLonLat(null);
84740       }
84741     };
84742     function groupEntities(ids, graph) {
84743       var entities = ids.map(function(id2) {
84744         return graph.entity(id2);
84745       });
84746       return Object.assign(
84747         { relation: [], way: [], node: [] },
84748         utilArrayGroupBy(entities, "type")
84749       );
84750     }
84751     function getDescendants(id2, graph, descendants) {
84752       var entity = graph.entity(id2);
84753       var children2;
84754       descendants = descendants || {};
84755       if (entity.type === "relation") {
84756         children2 = entity.members.map(function(m3) {
84757           return m3.id;
84758         });
84759       } else if (entity.type === "way") {
84760         children2 = entity.nodes;
84761       } else {
84762         children2 = [];
84763       }
84764       for (var i3 = 0; i3 < children2.length; i3++) {
84765         if (!descendants[children2[i3]]) {
84766           descendants[children2[i3]] = true;
84767           descendants = getDescendants(children2[i3], graph, descendants);
84768         }
84769       }
84770       return descendants;
84771     }
84772     operation2.available = function() {
84773       return getFilteredIdsToCopy().length > 0;
84774     };
84775     operation2.disabled = function() {
84776       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
84777       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84778         return "too_large";
84779       }
84780       return false;
84781     };
84782     operation2.availableForKeypress = function() {
84783       var _a4;
84784       const selection2 = (_a4 = window.getSelection) == null ? void 0 : _a4.call(window);
84785       return !(selection2 == null ? void 0 : selection2.toString());
84786     };
84787     operation2.tooltip = function() {
84788       var disable = operation2.disabled();
84789       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
84790     };
84791     operation2.annotation = function() {
84792       return _t("operations.copy.annotation", { n: selectedIDs.length });
84793     };
84794     var _point;
84795     operation2.point = function(val) {
84796       _point = val;
84797       return operation2;
84798     };
84799     operation2.id = "copy";
84800     operation2.keys = [uiCmd("\u2318C")];
84801     operation2.title = _t.append("operations.copy.title");
84802     operation2.behavior = behaviorOperation(context).which(operation2);
84803     return operation2;
84804   }
84805   var init_copy = __esm({
84806     "modules/operations/copy.js"() {
84807       "use strict";
84808       init_localizer();
84809       init_operation();
84810       init_cmd();
84811       init_util();
84812     }
84813   });
84814
84815   // modules/operations/disconnect.js
84816   var disconnect_exports2 = {};
84817   __export(disconnect_exports2, {
84818     operationDisconnect: () => operationDisconnect
84819   });
84820   function operationDisconnect(context, selectedIDs) {
84821     var _vertexIDs = [];
84822     var _wayIDs = [];
84823     var _otherIDs = [];
84824     var _actions = [];
84825     selectedIDs.forEach(function(id2) {
84826       var entity = context.entity(id2);
84827       if (entity.type === "way") {
84828         _wayIDs.push(id2);
84829       } else if (entity.geometry(context.graph()) === "vertex") {
84830         _vertexIDs.push(id2);
84831       } else {
84832         _otherIDs.push(id2);
84833       }
84834     });
84835     var _coords, _descriptionID = "", _annotationID = "features";
84836     var _disconnectingVertexIds = [];
84837     var _disconnectingWayIds = [];
84838     if (_vertexIDs.length > 0) {
84839       _disconnectingVertexIds = _vertexIDs;
84840       _vertexIDs.forEach(function(vertexID) {
84841         var action = actionDisconnect(vertexID);
84842         if (_wayIDs.length > 0) {
84843           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
84844             var way = context.entity(wayID);
84845             return way.nodes.indexOf(vertexID) !== -1;
84846           });
84847           action.limitWays(waysIDsForVertex);
84848         }
84849         _actions.push(action);
84850         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
84851       });
84852       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
84853         return _wayIDs.indexOf(id2) === -1;
84854       });
84855       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
84856       if (_wayIDs.length === 1) {
84857         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
84858       } else {
84859         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
84860       }
84861     } else if (_wayIDs.length > 0) {
84862       var ways = _wayIDs.map(function(id2) {
84863         return context.entity(id2);
84864       });
84865       var nodes = utilGetAllNodes(_wayIDs, context.graph());
84866       _coords = nodes.map(function(n3) {
84867         return n3.loc;
84868       });
84869       var sharedActions = [];
84870       var sharedNodes = [];
84871       var unsharedActions = [];
84872       var unsharedNodes = [];
84873       nodes.forEach(function(node) {
84874         var action = actionDisconnect(node.id).limitWays(_wayIDs);
84875         if (action.disabled(context.graph()) !== "not_connected") {
84876           var count = 0;
84877           for (var i3 in ways) {
84878             var way = ways[i3];
84879             if (way.nodes.indexOf(node.id) !== -1) {
84880               count += 1;
84881             }
84882             if (count > 1) break;
84883           }
84884           if (count > 1) {
84885             sharedActions.push(action);
84886             sharedNodes.push(node);
84887           } else {
84888             unsharedActions.push(action);
84889             unsharedNodes.push(node);
84890           }
84891         }
84892       });
84893       _descriptionID += "no_points.";
84894       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
84895       if (sharedActions.length) {
84896         _actions = sharedActions;
84897         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
84898         _descriptionID += "conjoined";
84899         _annotationID = "from_each_other";
84900       } else {
84901         _actions = unsharedActions;
84902         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
84903         if (_wayIDs.length === 1) {
84904           _descriptionID += context.graph().geometry(_wayIDs[0]);
84905         } else {
84906           _descriptionID += "separate";
84907         }
84908       }
84909     }
84910     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
84911     var operation2 = function() {
84912       context.perform(function(graph) {
84913         return _actions.reduce(function(graph2, action) {
84914           return action(graph2);
84915         }, graph);
84916       }, operation2.annotation());
84917       context.validator().validate();
84918     };
84919     operation2.relatedEntityIds = function() {
84920       if (_vertexIDs.length) {
84921         return _disconnectingWayIds;
84922       }
84923       return _disconnectingVertexIds;
84924     };
84925     operation2.available = function() {
84926       if (_actions.length === 0) return false;
84927       if (_otherIDs.length !== 0) return false;
84928       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
84929         return _vertexIDs.some(function(vertexID) {
84930           var way = context.entity(wayID);
84931           return way.nodes.indexOf(vertexID) !== -1;
84932         });
84933       })) return false;
84934       return true;
84935     };
84936     operation2.disabled = function() {
84937       var reason;
84938       for (var actionIndex in _actions) {
84939         reason = _actions[actionIndex].disabled(context.graph());
84940         if (reason) return reason;
84941       }
84942       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
84943         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
84944       } else if (_coords && someMissing()) {
84945         return "not_downloaded";
84946       } else if (selectedIDs.some(context.hasHiddenConnections)) {
84947         return "connected_to_hidden";
84948       }
84949       return false;
84950       function someMissing() {
84951         if (context.inIntro()) return false;
84952         var osm = context.connection();
84953         if (osm) {
84954           var missing = _coords.filter(function(loc) {
84955             return !osm.isDataLoaded(loc);
84956           });
84957           if (missing.length) {
84958             missing.forEach(function(loc) {
84959               context.loadTileAtLoc(loc);
84960             });
84961             return true;
84962           }
84963         }
84964         return false;
84965       }
84966     };
84967     operation2.tooltip = function() {
84968       var disable = operation2.disabled();
84969       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
84970     };
84971     operation2.annotation = function() {
84972       return _t("operations.disconnect.annotation." + _annotationID);
84973     };
84974     operation2.id = "disconnect";
84975     operation2.keys = [_t("operations.disconnect.key")];
84976     operation2.title = _t.append("operations.disconnect.title");
84977     operation2.behavior = behaviorOperation(context).which(operation2);
84978     return operation2;
84979   }
84980   var init_disconnect2 = __esm({
84981     "modules/operations/disconnect.js"() {
84982       "use strict";
84983       init_localizer();
84984       init_disconnect();
84985       init_operation();
84986       init_array3();
84987       init_util2();
84988     }
84989   });
84990
84991   // modules/operations/downgrade.js
84992   var downgrade_exports = {};
84993   __export(downgrade_exports, {
84994     operationDowngrade: () => operationDowngrade
84995   });
84996   function operationDowngrade(context, selectedIDs) {
84997     var _affectedFeatureCount = 0;
84998     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
84999     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
85000     function downgradeTypeForEntityIDs(entityIds) {
85001       var downgradeType;
85002       _affectedFeatureCount = 0;
85003       for (var i3 in entityIds) {
85004         var entityID = entityIds[i3];
85005         var type2 = downgradeTypeForEntityID(entityID);
85006         if (type2) {
85007           _affectedFeatureCount += 1;
85008           if (downgradeType && type2 !== downgradeType) {
85009             if (downgradeType !== "generic" && type2 !== "generic") {
85010               downgradeType = "building_address";
85011             } else {
85012               downgradeType = "generic";
85013             }
85014           } else {
85015             downgradeType = type2;
85016           }
85017         }
85018       }
85019       return downgradeType;
85020     }
85021     function downgradeTypeForEntityID(entityID) {
85022       var graph = context.graph();
85023       var entity = graph.entity(entityID);
85024       var preset = _mainPresetIndex.match(entity, graph);
85025       if (!preset || preset.isFallback()) return null;
85026       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
85027         return key.match(/^addr:.{1,}/);
85028       })) {
85029         return "address";
85030       }
85031       var geometry = entity.geometry(graph);
85032       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
85033         return "building";
85034       }
85035       if (geometry === "vertex" && Object.keys(entity.tags).length) {
85036         return "generic";
85037       }
85038       return null;
85039     }
85040     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
85041     var addressKeysToKeep = ["source"];
85042     var operation2 = function() {
85043       context.perform(function(graph) {
85044         for (var i3 in selectedIDs) {
85045           var entityID = selectedIDs[i3];
85046           var type2 = downgradeTypeForEntityID(entityID);
85047           if (!type2) continue;
85048           var tags = Object.assign({}, graph.entity(entityID).tags);
85049           for (var key in tags) {
85050             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
85051             if (type2 === "building") {
85052               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
85053             }
85054             if (type2 !== "generic") {
85055               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
85056             }
85057             delete tags[key];
85058           }
85059           graph = actionChangeTags(entityID, tags)(graph);
85060         }
85061         return graph;
85062       }, operation2.annotation());
85063       context.validator().validate();
85064       context.enter(modeSelect(context, selectedIDs));
85065     };
85066     operation2.available = function() {
85067       return _downgradeType;
85068     };
85069     operation2.disabled = function() {
85070       if (selectedIDs.some(hasWikidataTag)) {
85071         return "has_wikidata_tag";
85072       }
85073       return false;
85074       function hasWikidataTag(id2) {
85075         var entity = context.entity(id2);
85076         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
85077       }
85078     };
85079     operation2.tooltip = function() {
85080       var disable = operation2.disabled();
85081       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
85082     };
85083     operation2.annotation = function() {
85084       var suffix;
85085       if (_downgradeType === "building_address") {
85086         suffix = "generic";
85087       } else {
85088         suffix = _downgradeType;
85089       }
85090       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
85091     };
85092     operation2.id = "downgrade";
85093     operation2.keys = [uiCmd("\u232B")];
85094     operation2.title = _t.append("operations.downgrade.title");
85095     operation2.behavior = behaviorOperation(context).which(operation2);
85096     return operation2;
85097   }
85098   var init_downgrade = __esm({
85099     "modules/operations/downgrade.js"() {
85100       "use strict";
85101       init_change_tags();
85102       init_operation();
85103       init_select5();
85104       init_localizer();
85105       init_cmd();
85106       init_presets();
85107     }
85108   });
85109
85110   // modules/operations/extract.js
85111   var extract_exports2 = {};
85112   __export(extract_exports2, {
85113     operationExtract: () => operationExtract
85114   });
85115   function operationExtract(context, selectedIDs) {
85116     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
85117     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
85118       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
85119     }).filter(Boolean));
85120     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
85121     var _extent;
85122     var _actions = selectedIDs.map(function(entityID) {
85123       var graph = context.graph();
85124       var entity = graph.hasEntity(entityID);
85125       if (!entity || !entity.hasInterestingTags()) return null;
85126       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
85127       if (entity.type !== "node") {
85128         var preset = _mainPresetIndex.match(entity, graph);
85129         if (preset.geometry.indexOf("point") === -1) return null;
85130       }
85131       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
85132       return actionExtract(entityID, context.projection);
85133     }).filter(Boolean);
85134     var operation2 = function(d3_event) {
85135       const shiftKeyPressed = (d3_event == null ? void 0 : d3_event.shiftKey) || false;
85136       var combinedAction = function(graph) {
85137         _actions.forEach(function(action) {
85138           graph = action(graph, shiftKeyPressed);
85139         });
85140         return graph;
85141       };
85142       context.perform(combinedAction, operation2.annotation());
85143       var extractedNodeIDs = _actions.map(function(action) {
85144         return action.getExtractedNodeID();
85145       });
85146       context.enter(modeSelect(context, extractedNodeIDs));
85147     };
85148     operation2.available = function() {
85149       return _actions.length && selectedIDs.length === _actions.length;
85150     };
85151     operation2.disabled = function() {
85152       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
85153         return "too_large";
85154       } else if (selectedIDs.some(function(entityID) {
85155         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
85156       })) {
85157         return "connected_to_hidden";
85158       }
85159       return false;
85160     };
85161     operation2.tooltip = function() {
85162       var disableReason = operation2.disabled();
85163       if (disableReason) {
85164         return _t.append("operations.extract." + disableReason + "." + _amount);
85165       } else {
85166         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
85167       }
85168     };
85169     operation2.annotation = function() {
85170       return _t("operations.extract.annotation", { n: selectedIDs.length });
85171     };
85172     operation2.id = "extract";
85173     operation2.keys = [_t("operations.extract.key")];
85174     operation2.title = _t.append("operations.extract.title");
85175     operation2.behavior = behaviorOperation(context).which(operation2);
85176     return operation2;
85177   }
85178   var init_extract2 = __esm({
85179     "modules/operations/extract.js"() {
85180       "use strict";
85181       init_extract();
85182       init_operation();
85183       init_select5();
85184       init_localizer();
85185       init_presets();
85186       init_array3();
85187     }
85188   });
85189
85190   // modules/operations/merge.js
85191   var merge_exports2 = {};
85192   __export(merge_exports2, {
85193     operationMerge: () => operationMerge
85194   });
85195   function operationMerge(context, selectedIDs) {
85196     var _action = getAction();
85197     function getAction() {
85198       var join = actionJoin(selectedIDs);
85199       if (!join.disabled(context.graph())) return join;
85200       var merge3 = actionMerge(selectedIDs);
85201       if (!merge3.disabled(context.graph())) return merge3;
85202       var mergePolygon = actionMergePolygon(selectedIDs);
85203       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
85204       var mergeNodes = actionMergeNodes(selectedIDs);
85205       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
85206       if (join.disabled(context.graph()) !== "not_eligible") return join;
85207       if (merge3.disabled(context.graph()) !== "not_eligible") return merge3;
85208       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
85209       return mergeNodes;
85210     }
85211     var operation2 = function() {
85212       if (operation2.disabled()) return;
85213       context.perform(_action, operation2.annotation());
85214       context.validator().validate();
85215       var resultIDs = selectedIDs.filter(context.hasEntity);
85216       if (resultIDs.length > 1) {
85217         var interestingIDs = resultIDs.filter(function(id2) {
85218           return context.entity(id2).hasInterestingTags();
85219         });
85220         if (interestingIDs.length) resultIDs = interestingIDs;
85221       }
85222       context.enter(modeSelect(context, resultIDs));
85223     };
85224     operation2.available = function() {
85225       return selectedIDs.length >= 2;
85226     };
85227     operation2.disabled = function() {
85228       var actionDisabled = _action.disabled(context.graph());
85229       if (actionDisabled) return actionDisabled;
85230       var osm = context.connection();
85231       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
85232         return "too_many_vertices";
85233       }
85234       return false;
85235     };
85236     operation2.tooltip = function() {
85237       var disabled = operation2.disabled();
85238       if (disabled) {
85239         if (disabled === "conflicting_relations") {
85240           return _t.append("operations.merge.conflicting_relations");
85241         }
85242         if (disabled === "restriction" || disabled === "connectivity") {
85243           return _t.append(
85244             "operations.merge.damage_relation",
85245             { relation: _mainPresetIndex.item("type/" + disabled).name() }
85246           );
85247         }
85248         return _t.append("operations.merge." + disabled);
85249       }
85250       return _t.append("operations.merge.description");
85251     };
85252     operation2.annotation = function() {
85253       return _t("operations.merge.annotation", { n: selectedIDs.length });
85254     };
85255     operation2.id = "merge";
85256     operation2.keys = [_t("operations.merge.key")];
85257     operation2.title = _t.append("operations.merge.title");
85258     operation2.behavior = behaviorOperation(context).which(operation2);
85259     return operation2;
85260   }
85261   var init_merge6 = __esm({
85262     "modules/operations/merge.js"() {
85263       "use strict";
85264       init_localizer();
85265       init_join2();
85266       init_merge5();
85267       init_merge_nodes();
85268       init_merge_polygon();
85269       init_operation();
85270       init_select5();
85271       init_presets();
85272     }
85273   });
85274
85275   // modules/operations/paste.js
85276   var paste_exports2 = {};
85277   __export(paste_exports2, {
85278     operationPaste: () => operationPaste
85279   });
85280   function operationPaste(context) {
85281     var _pastePoint;
85282     var operation2 = function() {
85283       if (!_pastePoint) return;
85284       var oldIDs = context.copyIDs();
85285       if (!oldIDs.length) return;
85286       var projection2 = context.projection;
85287       var extent = geoExtent();
85288       var oldGraph = context.copyGraph();
85289       var newIDs = [];
85290       var action = actionCopyEntities(oldIDs, oldGraph);
85291       context.perform(action);
85292       var copies = action.copies();
85293       var originals = /* @__PURE__ */ new Set();
85294       Object.values(copies).forEach(function(entity) {
85295         originals.add(entity.id);
85296       });
85297       for (var id2 in copies) {
85298         var oldEntity = oldGraph.entity(id2);
85299         var newEntity = copies[id2];
85300         extent._extend(oldEntity.extent(oldGraph));
85301         var parents = context.graph().parentWays(newEntity);
85302         var parentCopied = parents.some(function(parent2) {
85303           return originals.has(parent2.id);
85304         });
85305         if (!parentCopied) {
85306           newIDs.push(newEntity.id);
85307         }
85308       }
85309       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
85310       var delta = geoVecSubtract(_pastePoint, copyPoint);
85311       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
85312       context.enter(modeSelect(context, newIDs));
85313     };
85314     operation2.point = function(val) {
85315       _pastePoint = val;
85316       return operation2;
85317     };
85318     operation2.available = function() {
85319       return context.mode().id === "browse";
85320     };
85321     operation2.disabled = function() {
85322       return !context.copyIDs().length;
85323     };
85324     operation2.tooltip = function() {
85325       var oldGraph = context.copyGraph();
85326       var ids = context.copyIDs();
85327       if (!ids.length) {
85328         return _t.append("operations.paste.nothing_copied");
85329       }
85330       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
85331     };
85332     operation2.annotation = function() {
85333       var ids = context.copyIDs();
85334       return _t("operations.paste.annotation", { n: ids.length });
85335     };
85336     operation2.id = "paste";
85337     operation2.keys = [uiCmd("\u2318V")];
85338     operation2.title = _t.append("operations.paste.title");
85339     return operation2;
85340   }
85341   var init_paste2 = __esm({
85342     "modules/operations/paste.js"() {
85343       "use strict";
85344       init_copy_entities();
85345       init_move();
85346       init_select5();
85347       init_geo2();
85348       init_localizer();
85349       init_cmd();
85350       init_utilDisplayLabel();
85351     }
85352   });
85353
85354   // modules/operations/reverse.js
85355   var reverse_exports2 = {};
85356   __export(reverse_exports2, {
85357     operationReverse: () => operationReverse
85358   });
85359   function operationReverse(context, selectedIDs) {
85360     var operation2 = function() {
85361       context.perform(function combinedReverseAction(graph) {
85362         actions().forEach(function(action) {
85363           graph = action(graph);
85364         });
85365         return graph;
85366       }, operation2.annotation());
85367       context.validator().validate();
85368     };
85369     function actions(situation) {
85370       return selectedIDs.map(function(entityID) {
85371         var entity = context.hasEntity(entityID);
85372         if (!entity) return null;
85373         if (situation === "toolbar") {
85374           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
85375         }
85376         var geometry = entity.geometry(context.graph());
85377         if (entity.type !== "node" && geometry !== "line") return null;
85378         var action = actionReverse(entityID);
85379         if (action.disabled(context.graph())) return null;
85380         return action;
85381       }).filter(Boolean);
85382     }
85383     function reverseTypeID() {
85384       var acts = actions();
85385       var nodeActionCount = acts.filter(function(act) {
85386         var entity = context.hasEntity(act.entityID());
85387         return entity && entity.type === "node";
85388       }).length;
85389       if (nodeActionCount === 0) return "line";
85390       if (nodeActionCount === acts.length) return "point";
85391       return "feature";
85392     }
85393     operation2.available = function(situation) {
85394       return actions(situation).length > 0;
85395     };
85396     operation2.disabled = function() {
85397       return false;
85398     };
85399     operation2.tooltip = function() {
85400       return _t.append("operations.reverse.description." + reverseTypeID());
85401     };
85402     operation2.annotation = function() {
85403       var acts = actions();
85404       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
85405     };
85406     operation2.id = "reverse";
85407     operation2.keys = [_t("operations.reverse.key")];
85408     operation2.title = _t.append("operations.reverse.title");
85409     operation2.behavior = behaviorOperation(context).which(operation2);
85410     return operation2;
85411   }
85412   var init_reverse2 = __esm({
85413     "modules/operations/reverse.js"() {
85414       "use strict";
85415       init_localizer();
85416       init_reverse();
85417       init_operation();
85418     }
85419   });
85420
85421   // modules/operations/straighten.js
85422   var straighten_exports = {};
85423   __export(straighten_exports, {
85424     operationStraighten: () => operationStraighten
85425   });
85426   function operationStraighten(context, selectedIDs) {
85427     var _wayIDs = selectedIDs.filter(function(id2) {
85428       return id2.charAt(0) === "w";
85429     });
85430     var _nodeIDs = selectedIDs.filter(function(id2) {
85431       return id2.charAt(0) === "n";
85432     });
85433     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
85434     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
85435     var _coords = _nodes.map(function(n3) {
85436       return n3.loc;
85437     });
85438     var _extent = utilTotalExtent(selectedIDs, context.graph());
85439     var _action = chooseAction();
85440     var _geometry;
85441     function chooseAction() {
85442       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
85443         _geometry = "point";
85444         return actionStraightenNodes(_nodeIDs, context.projection);
85445       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
85446         var startNodeIDs = [];
85447         var endNodeIDs = [];
85448         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85449           var entity = context.entity(selectedIDs[i3]);
85450           if (entity.type === "node") {
85451             continue;
85452           } else if (entity.type !== "way" || entity.isClosed()) {
85453             return null;
85454           }
85455           startNodeIDs.push(entity.first());
85456           endNodeIDs.push(entity.last());
85457         }
85458         startNodeIDs = startNodeIDs.filter(function(n3) {
85459           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
85460         });
85461         endNodeIDs = endNodeIDs.filter(function(n3) {
85462           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
85463         });
85464         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
85465         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
85466           return node.id;
85467         });
85468         if (wayNodeIDs.length <= 2) return null;
85469         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
85470         if (_nodeIDs.length) {
85471           _extent = utilTotalExtent(_nodeIDs, context.graph());
85472         }
85473         _geometry = "line";
85474         return actionStraightenWay(selectedIDs, context.projection);
85475       }
85476       return null;
85477     }
85478     function operation2() {
85479       if (!_action) return;
85480       context.perform(_action, operation2.annotation());
85481       window.setTimeout(function() {
85482         context.validator().validate();
85483       }, 300);
85484     }
85485     operation2.available = function() {
85486       return Boolean(_action);
85487     };
85488     operation2.disabled = function() {
85489       var reason = _action.disabled(context.graph());
85490       if (reason) {
85491         return reason;
85492       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
85493         return "too_large";
85494       } else if (someMissing()) {
85495         return "not_downloaded";
85496       } else if (selectedIDs.some(context.hasHiddenConnections)) {
85497         return "connected_to_hidden";
85498       }
85499       return false;
85500       function someMissing() {
85501         if (context.inIntro()) return false;
85502         var osm = context.connection();
85503         if (osm) {
85504           var missing = _coords.filter(function(loc) {
85505             return !osm.isDataLoaded(loc);
85506           });
85507           if (missing.length) {
85508             missing.forEach(function(loc) {
85509               context.loadTileAtLoc(loc);
85510             });
85511             return true;
85512           }
85513         }
85514         return false;
85515       }
85516     };
85517     operation2.tooltip = function() {
85518       var disable = operation2.disabled();
85519       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
85520     };
85521     operation2.annotation = function() {
85522       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
85523     };
85524     operation2.id = "straighten";
85525     operation2.keys = [_t("operations.straighten.key")];
85526     operation2.title = _t.append("operations.straighten.title");
85527     operation2.behavior = behaviorOperation(context).which(operation2);
85528     return operation2;
85529   }
85530   var init_straighten = __esm({
85531     "modules/operations/straighten.js"() {
85532       "use strict";
85533       init_localizer();
85534       init_straighten_nodes();
85535       init_straighten_way();
85536       init_operation();
85537       init_util();
85538     }
85539   });
85540
85541   // modules/operations/index.js
85542   var operations_exports = {};
85543   __export(operations_exports, {
85544     operationCircularize: () => operationCircularize,
85545     operationContinue: () => operationContinue,
85546     operationCopy: () => operationCopy,
85547     operationDelete: () => operationDelete,
85548     operationDisconnect: () => operationDisconnect,
85549     operationDowngrade: () => operationDowngrade,
85550     operationExtract: () => operationExtract,
85551     operationMerge: () => operationMerge,
85552     operationMove: () => operationMove,
85553     operationOrthogonalize: () => operationOrthogonalize,
85554     operationPaste: () => operationPaste,
85555     operationReflectLong: () => operationReflectLong,
85556     operationReflectShort: () => operationReflectShort,
85557     operationReverse: () => operationReverse,
85558     operationRotate: () => operationRotate,
85559     operationSplit: () => operationSplit,
85560     operationStraighten: () => operationStraighten
85561   });
85562   var init_operations = __esm({
85563     "modules/operations/index.js"() {
85564       "use strict";
85565       init_circularize2();
85566       init_continue();
85567       init_copy();
85568       init_delete();
85569       init_disconnect2();
85570       init_downgrade();
85571       init_extract2();
85572       init_merge6();
85573       init_move2();
85574       init_orthogonalize2();
85575       init_paste2();
85576       init_reflect2();
85577       init_reverse2();
85578       init_rotate3();
85579       init_split2();
85580       init_straighten();
85581     }
85582   });
85583
85584   // modules/modes/select.js
85585   var select_exports2 = {};
85586   __export(select_exports2, {
85587     modeSelect: () => modeSelect
85588   });
85589   function modeSelect(context, selectedIDs) {
85590     var mode = {
85591       id: "select",
85592       button: "browse"
85593     };
85594     var keybinding = utilKeybinding("select");
85595     var _breatheBehavior = behaviorBreathe(context);
85596     var _modeDragNode = modeDragNode(context);
85597     var _selectBehavior;
85598     var _behaviors = [];
85599     var _operations = [];
85600     var _newFeature = false;
85601     var _follow = false;
85602     var _focusedParentWayId;
85603     var _focusedVertexIds;
85604     function singular() {
85605       if (selectedIDs && selectedIDs.length === 1) {
85606         return context.hasEntity(selectedIDs[0]);
85607       }
85608     }
85609     function selectedEntities() {
85610       return selectedIDs.map(function(id2) {
85611         return context.hasEntity(id2);
85612       }).filter(Boolean);
85613     }
85614     function checkSelectedIDs() {
85615       var ids = [];
85616       if (Array.isArray(selectedIDs)) {
85617         ids = selectedIDs.filter(function(id2) {
85618           return context.hasEntity(id2);
85619         });
85620       }
85621       if (!ids.length) {
85622         context.enter(modeBrowse(context));
85623         return false;
85624       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
85625         context.enter(modeSelect(context, ids));
85626         return false;
85627       }
85628       selectedIDs = ids;
85629       return true;
85630     }
85631     function parentWaysIdsOfSelection(onlyCommonParents) {
85632       var graph = context.graph();
85633       var parents = [];
85634       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85635         var entity = context.hasEntity(selectedIDs[i3]);
85636         if (!entity || entity.geometry(graph) !== "vertex") {
85637           return [];
85638         }
85639         var currParents = graph.parentWays(entity).map(function(w3) {
85640           return w3.id;
85641         });
85642         if (!parents.length) {
85643           parents = currParents;
85644           continue;
85645         }
85646         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
85647         if (!parents.length) {
85648           return [];
85649         }
85650       }
85651       return parents;
85652     }
85653     function childNodeIdsOfSelection(onlyCommon) {
85654       var graph = context.graph();
85655       var childs = [];
85656       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85657         var entity = context.hasEntity(selectedIDs[i3]);
85658         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
85659           return [];
85660         }
85661         var currChilds = graph.childNodes(entity).map(function(node) {
85662           return node.id;
85663         });
85664         if (!childs.length) {
85665           childs = currChilds;
85666           continue;
85667         }
85668         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
85669         if (!childs.length) {
85670           return [];
85671         }
85672       }
85673       return childs;
85674     }
85675     function checkFocusedParent() {
85676       if (_focusedParentWayId) {
85677         var parents = parentWaysIdsOfSelection(true);
85678         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
85679       }
85680     }
85681     function parentWayIdForVertexNavigation() {
85682       var parentIds = parentWaysIdsOfSelection(true);
85683       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
85684         return _focusedParentWayId;
85685       }
85686       return parentIds.length ? parentIds[0] : null;
85687     }
85688     mode.selectedIDs = function(val) {
85689       if (!arguments.length) return selectedIDs;
85690       selectedIDs = val;
85691       return mode;
85692     };
85693     mode.zoomToSelected = function() {
85694       context.map().zoomToEase(selectedEntities());
85695     };
85696     mode.newFeature = function(val) {
85697       if (!arguments.length) return _newFeature;
85698       _newFeature = val;
85699       return mode;
85700     };
85701     mode.selectBehavior = function(val) {
85702       if (!arguments.length) return _selectBehavior;
85703       _selectBehavior = val;
85704       return mode;
85705     };
85706     mode.follow = function(val) {
85707       if (!arguments.length) return _follow;
85708       _follow = val;
85709       return mode;
85710     };
85711     function loadOperations() {
85712       _operations.forEach(function(operation2) {
85713         if (operation2.behavior) {
85714           context.uninstall(operation2.behavior);
85715         }
85716       });
85717       _operations = Object.values(operations_exports).map((o2) => o2(context, selectedIDs)).filter((o2) => o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy").concat([
85718         // group copy/downgrade/delete operation together at the end of the list
85719         operationCopy(context, selectedIDs),
85720         operationDowngrade(context, selectedIDs),
85721         operationDelete(context, selectedIDs)
85722       ]);
85723       _operations.filter((operation2) => operation2.available()).forEach((operation2) => {
85724         if (operation2.behavior) {
85725           context.install(operation2.behavior);
85726         }
85727       });
85728       _operations.filter((operation2) => !operation2.available()).forEach((operation2) => {
85729         if (operation2.behavior) {
85730           operation2.behavior.on();
85731         }
85732       });
85733       context.ui().closeEditMenu();
85734     }
85735     mode.operations = function() {
85736       return _operations.filter((operation2) => operation2.available());
85737     };
85738     mode.enter = function() {
85739       if (!checkSelectedIDs()) return;
85740       context.features().forceVisible(selectedIDs);
85741       _modeDragNode.restoreSelectedIDs(selectedIDs);
85742       loadOperations();
85743       if (!_behaviors.length) {
85744         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
85745         _behaviors = [
85746           behaviorPaste(context),
85747           _breatheBehavior,
85748           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
85749           _selectBehavior,
85750           behaviorLasso(context),
85751           _modeDragNode.behavior,
85752           modeDragNote(context).behavior
85753         ];
85754       }
85755       _behaviors.forEach(context.install);
85756       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);
85757       select_default2(document).call(keybinding);
85758       context.ui().sidebar.select(selectedIDs, _newFeature);
85759       context.history().on("change.select", function() {
85760         loadOperations();
85761         selectElements();
85762       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
85763       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
85764         selectElements();
85765         _breatheBehavior.restartIfNeeded(context.surface());
85766       });
85767       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
85768       selectElements();
85769       if (_follow) {
85770         var extent = geoExtent();
85771         var graph = context.graph();
85772         selectedIDs.forEach(function(id2) {
85773           var entity = context.entity(id2);
85774           extent._extend(entity.extent(graph));
85775         });
85776         var loc = extent.center();
85777         context.map().centerEase(loc);
85778         _follow = false;
85779       }
85780       function nudgeSelection(delta) {
85781         return function() {
85782           if (!context.map().withinEditableZoom()) return;
85783           var moveOp = operationMove(context, selectedIDs);
85784           if (moveOp.disabled()) {
85785             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
85786           } else {
85787             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
85788             context.validator().validate();
85789           }
85790         };
85791       }
85792       function scaleSelection(factor) {
85793         return function() {
85794           if (!context.map().withinEditableZoom()) return;
85795           let nodes = utilGetAllNodes(selectedIDs, context.graph());
85796           let isUp = factor > 1;
85797           if (nodes.length <= 1) return;
85798           let extent2 = utilTotalExtent(selectedIDs, context.graph());
85799           function scalingDisabled() {
85800             if (tooSmall()) {
85801               return "too_small";
85802             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
85803               return "too_large";
85804             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
85805               return "not_downloaded";
85806             } else if (selectedIDs.some(context.hasHiddenConnections)) {
85807               return "connected_to_hidden";
85808             }
85809             return false;
85810             function tooSmall() {
85811               if (isUp) return false;
85812               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
85813               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
85814               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
85815             }
85816             function someMissing() {
85817               if (context.inIntro()) return false;
85818               let osm = context.connection();
85819               if (osm) {
85820                 let missing = nodes.filter(function(n3) {
85821                   return !osm.isDataLoaded(n3.loc);
85822                 });
85823                 if (missing.length) {
85824                   missing.forEach(function(loc2) {
85825                     context.loadTileAtLoc(loc2);
85826                   });
85827                   return true;
85828                 }
85829               }
85830               return false;
85831             }
85832             function incompleteRelation(id2) {
85833               let entity = context.entity(id2);
85834               return entity.type === "relation" && !entity.isComplete(context.graph());
85835             }
85836           }
85837           const disabled = scalingDisabled();
85838           if (disabled) {
85839             let multi = selectedIDs.length === 1 ? "single" : "multiple";
85840             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
85841           } else {
85842             const pivot = context.projection(extent2.center());
85843             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
85844             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
85845             context.validator().validate();
85846           }
85847         };
85848       }
85849       function didDoubleUp(d3_event, loc2) {
85850         if (!context.map().withinEditableZoom()) return;
85851         var target = select_default2(d3_event.target);
85852         var datum2 = target.datum();
85853         var entity = datum2 && datum2.properties && datum2.properties.entity;
85854         if (!entity) return;
85855         if (entity instanceof osmWay && target.classed("target")) {
85856           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
85857           var prev = entity.nodes[choice.index - 1];
85858           var next = entity.nodes[choice.index];
85859           context.perform(
85860             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
85861             _t("operations.add.annotation.vertex")
85862           );
85863           context.validator().validate();
85864         } else if (entity.type === "midpoint") {
85865           context.perform(
85866             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
85867             _t("operations.add.annotation.vertex")
85868           );
85869           context.validator().validate();
85870         }
85871       }
85872       function selectElements() {
85873         if (!checkSelectedIDs()) return;
85874         var surface = context.surface();
85875         surface.selectAll(".selected-member").classed("selected-member", false);
85876         surface.selectAll(".selected").classed("selected", false);
85877         surface.selectAll(".related").classed("related", false);
85878         checkFocusedParent();
85879         if (_focusedParentWayId) {
85880           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85881         }
85882         if (context.map().withinEditableZoom()) {
85883           surface.selectAll(utilDeepMemberSelector(
85884             selectedIDs,
85885             context.graph(),
85886             true
85887             /* skipMultipolgonMembers */
85888           )).classed("selected-member", true);
85889           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
85890         }
85891       }
85892       function esc() {
85893         if (context.container().select(".combobox").size()) return;
85894         context.enter(modeBrowse(context));
85895       }
85896       function firstVertex(d3_event) {
85897         d3_event.preventDefault();
85898         var entity = singular();
85899         var parentId = parentWayIdForVertexNavigation();
85900         var way;
85901         if (entity && entity.type === "way") {
85902           way = entity;
85903         } else if (parentId) {
85904           way = context.entity(parentId);
85905         }
85906         _focusedParentWayId = way && way.id;
85907         if (way) {
85908           context.enter(
85909             mode.selectedIDs([way.first()]).follow(true)
85910           );
85911         }
85912       }
85913       function lastVertex(d3_event) {
85914         d3_event.preventDefault();
85915         var entity = singular();
85916         var parentId = parentWayIdForVertexNavigation();
85917         var way;
85918         if (entity && entity.type === "way") {
85919           way = entity;
85920         } else if (parentId) {
85921           way = context.entity(parentId);
85922         }
85923         _focusedParentWayId = way && way.id;
85924         if (way) {
85925           context.enter(
85926             mode.selectedIDs([way.last()]).follow(true)
85927           );
85928         }
85929       }
85930       function previousVertex(d3_event) {
85931         d3_event.preventDefault();
85932         var parentId = parentWayIdForVertexNavigation();
85933         _focusedParentWayId = parentId;
85934         if (!parentId) return;
85935         var way = context.entity(parentId);
85936         var length2 = way.nodes.length;
85937         var curr = way.nodes.indexOf(selectedIDs[0]);
85938         var index = -1;
85939         if (curr > 0) {
85940           index = curr - 1;
85941         } else if (way.isClosed()) {
85942           index = length2 - 2;
85943         }
85944         if (index !== -1) {
85945           context.enter(
85946             mode.selectedIDs([way.nodes[index]]).follow(true)
85947           );
85948         }
85949       }
85950       function nextVertex(d3_event) {
85951         d3_event.preventDefault();
85952         var parentId = parentWayIdForVertexNavigation();
85953         _focusedParentWayId = parentId;
85954         if (!parentId) return;
85955         var way = context.entity(parentId);
85956         var length2 = way.nodes.length;
85957         var curr = way.nodes.indexOf(selectedIDs[0]);
85958         var index = -1;
85959         if (curr < length2 - 1) {
85960           index = curr + 1;
85961         } else if (way.isClosed()) {
85962           index = 0;
85963         }
85964         if (index !== -1) {
85965           context.enter(
85966             mode.selectedIDs([way.nodes[index]]).follow(true)
85967           );
85968         }
85969       }
85970       function focusNextParent(d3_event) {
85971         d3_event.preventDefault();
85972         var parents = parentWaysIdsOfSelection(true);
85973         if (!parents || parents.length < 2) return;
85974         var index = parents.indexOf(_focusedParentWayId);
85975         if (index < 0 || index > parents.length - 2) {
85976           _focusedParentWayId = parents[0];
85977         } else {
85978           _focusedParentWayId = parents[index + 1];
85979         }
85980         var surface = context.surface();
85981         surface.selectAll(".related").classed("related", false);
85982         if (_focusedParentWayId) {
85983           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85984         }
85985       }
85986       function selectParent(d3_event) {
85987         d3_event.preventDefault();
85988         var currentSelectedIds = mode.selectedIDs();
85989         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
85990         if (!parentIds.length) return;
85991         context.enter(
85992           mode.selectedIDs(parentIds)
85993         );
85994         _focusedVertexIds = currentSelectedIds;
85995       }
85996       function selectChild(d3_event) {
85997         d3_event.preventDefault();
85998         var currentSelectedIds = mode.selectedIDs();
85999         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
86000         if (!childIds || !childIds.length) return;
86001         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
86002         context.enter(
86003           mode.selectedIDs(childIds)
86004         );
86005       }
86006     };
86007     mode.exit = function() {
86008       _newFeature = false;
86009       _focusedVertexIds = null;
86010       _operations.forEach((operation2) => {
86011         if (operation2.behavior) {
86012           context.uninstall(operation2.behavior);
86013         }
86014       });
86015       _operations = [];
86016       _behaviors.forEach(context.uninstall);
86017       select_default2(document).call(keybinding.unbind);
86018       context.ui().closeEditMenu();
86019       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
86020       var surface = context.surface();
86021       surface.selectAll(".selected-member").classed("selected-member", false);
86022       surface.selectAll(".selected").classed("selected", false);
86023       surface.selectAll(".highlighted").classed("highlighted", false);
86024       surface.selectAll(".related").classed("related", false);
86025       context.map().on("drawn.select", null);
86026       context.ui().sidebar.hide();
86027       context.features().forceVisible([]);
86028       var entity = singular();
86029       if (_newFeature && entity && entity.type === "relation" && // no tags
86030       Object.keys(entity.tags).length === 0 && // no parent relations
86031       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
86032       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
86033         var deleteAction = actionDeleteRelation(
86034           entity.id,
86035           true
86036           /* don't delete untagged members */
86037         );
86038         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
86039         context.validator().validate();
86040       }
86041     };
86042     return mode;
86043   }
86044   var init_select5 = __esm({
86045     "modules/modes/select.js"() {
86046       "use strict";
86047       init_src5();
86048       init_localizer();
86049       init_add_midpoint();
86050       init_delete_relation();
86051       init_move();
86052       init_scale();
86053       init_breathe();
86054       init_hover();
86055       init_lasso2();
86056       init_paste();
86057       init_select4();
86058       init_move2();
86059       init_geo2();
86060       init_browse();
86061       init_drag_node();
86062       init_drag_note();
86063       init_osm();
86064       init_operations();
86065       init_cmd();
86066       init_util();
86067     }
86068   });
86069
86070   // modules/behavior/lasso.js
86071   var lasso_exports2 = {};
86072   __export(lasso_exports2, {
86073     behaviorLasso: () => behaviorLasso
86074   });
86075   function behaviorLasso(context) {
86076     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
86077     var behavior = function(selection2) {
86078       var lasso;
86079       function pointerdown(d3_event) {
86080         var button = 0;
86081         if (d3_event.button === button && d3_event.shiftKey === true) {
86082           lasso = null;
86083           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
86084           d3_event.stopPropagation();
86085         }
86086       }
86087       function pointermove() {
86088         if (!lasso) {
86089           lasso = uiLasso(context);
86090           context.surface().call(lasso);
86091         }
86092         lasso.p(context.map().mouse());
86093       }
86094       function normalize2(a4, b3) {
86095         return [
86096           [Math.min(a4[0], b3[0]), Math.min(a4[1], b3[1])],
86097           [Math.max(a4[0], b3[0]), Math.max(a4[1], b3[1])]
86098         ];
86099       }
86100       function lassoed() {
86101         if (!lasso) return [];
86102         var graph = context.graph();
86103         var limitToNodes;
86104         if (context.map().editableDataEnabled(
86105           true
86106           /* skipZoomCheck */
86107         ) && context.map().isInWideSelection()) {
86108           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
86109         } else if (!context.map().editableDataEnabled()) {
86110           return [];
86111         }
86112         var bounds = lasso.extent().map(context.projection.invert);
86113         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
86114         var intersects2 = context.history().intersects(extent).filter(function(entity) {
86115           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
86116         });
86117         intersects2.sort(function(node1, node2) {
86118           var parents1 = graph.parentWays(node1);
86119           var parents2 = graph.parentWays(node2);
86120           if (parents1.length && parents2.length) {
86121             var sharedParents = utilArrayIntersection(parents1, parents2);
86122             if (sharedParents.length) {
86123               var sharedParentNodes = sharedParents[0].nodes;
86124               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
86125             } else {
86126               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
86127             }
86128           } else if (parents1.length || parents2.length) {
86129             return parents1.length - parents2.length;
86130           }
86131           return node1.loc[0] - node2.loc[0];
86132         });
86133         return intersects2.map(function(entity) {
86134           return entity.id;
86135         });
86136       }
86137       function pointerup() {
86138         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
86139         if (!lasso) return;
86140         var ids = lassoed();
86141         lasso.close();
86142         if (ids.length) {
86143           context.enter(modeSelect(context, ids));
86144         }
86145       }
86146       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
86147     };
86148     behavior.off = function(selection2) {
86149       selection2.on(_pointerPrefix + "down.lasso", null);
86150     };
86151     return behavior;
86152   }
86153   var init_lasso2 = __esm({
86154     "modules/behavior/lasso.js"() {
86155       "use strict";
86156       init_src5();
86157       init_geo2();
86158       init_select5();
86159       init_lasso();
86160       init_array3();
86161       init_util2();
86162     }
86163   });
86164
86165   // modules/modes/browse.js
86166   var browse_exports = {};
86167   __export(browse_exports, {
86168     modeBrowse: () => modeBrowse
86169   });
86170   function modeBrowse(context) {
86171     var mode = {
86172       button: "browse",
86173       id: "browse",
86174       title: _t.append("modes.browse.title"),
86175       description: _t.append("modes.browse.description")
86176     };
86177     var sidebar;
86178     var _selectBehavior;
86179     var _behaviors = [];
86180     mode.selectBehavior = function(val) {
86181       if (!arguments.length) return _selectBehavior;
86182       _selectBehavior = val;
86183       return mode;
86184     };
86185     mode.enter = function() {
86186       if (!_behaviors.length) {
86187         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
86188         _behaviors = [
86189           behaviorPaste(context),
86190           behaviorHover(context).on("hover", context.ui().sidebar.hover),
86191           _selectBehavior,
86192           behaviorLasso(context),
86193           modeDragNode(context).behavior,
86194           modeDragNote(context).behavior
86195         ];
86196       }
86197       _behaviors.forEach(context.install);
86198       if (document.activeElement && document.activeElement.blur) {
86199         document.activeElement.blur();
86200       }
86201       if (sidebar) {
86202         context.ui().sidebar.show(sidebar);
86203       } else {
86204         context.ui().sidebar.select(null);
86205       }
86206     };
86207     mode.exit = function() {
86208       context.ui().sidebar.hover.cancel();
86209       _behaviors.forEach(context.uninstall);
86210       if (sidebar) {
86211         context.ui().sidebar.hide();
86212       }
86213     };
86214     mode.sidebar = function(_3) {
86215       if (!arguments.length) return sidebar;
86216       sidebar = _3;
86217       return mode;
86218     };
86219     mode.operations = function() {
86220       return [operationPaste(context)];
86221     };
86222     return mode;
86223   }
86224   var init_browse = __esm({
86225     "modules/modes/browse.js"() {
86226       "use strict";
86227       init_localizer();
86228       init_hover();
86229       init_lasso2();
86230       init_paste();
86231       init_select4();
86232       init_drag_node();
86233       init_drag_note();
86234       init_paste2();
86235     }
86236   });
86237
86238   // modules/behavior/add_way.js
86239   var add_way_exports = {};
86240   __export(add_way_exports, {
86241     behaviorAddWay: () => behaviorAddWay
86242   });
86243   function behaviorAddWay(context) {
86244     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
86245     var draw = behaviorDraw(context);
86246     function behavior(surface) {
86247       draw.on("click", function() {
86248         dispatch14.apply("start", this, arguments);
86249       }).on("clickWay", function() {
86250         dispatch14.apply("startFromWay", this, arguments);
86251       }).on("clickNode", function() {
86252         dispatch14.apply("startFromNode", this, arguments);
86253       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
86254       context.map().dblclickZoomEnable(false);
86255       surface.call(draw);
86256     }
86257     behavior.off = function(surface) {
86258       surface.call(draw.off);
86259     };
86260     behavior.cancel = function() {
86261       window.setTimeout(function() {
86262         context.map().dblclickZoomEnable(true);
86263       }, 1e3);
86264       context.enter(modeBrowse(context));
86265     };
86266     return utilRebind(behavior, dispatch14, "on");
86267   }
86268   var init_add_way = __esm({
86269     "modules/behavior/add_way.js"() {
86270       "use strict";
86271       init_src4();
86272       init_draw();
86273       init_browse();
86274       init_rebind();
86275     }
86276   });
86277
86278   // modules/globals.d.ts
86279   var globals_d_exports = {};
86280   var init_globals_d = __esm({
86281     "modules/globals.d.ts"() {
86282       "use strict";
86283     }
86284   });
86285
86286   // modules/ui/panes/index.js
86287   var panes_exports = {};
86288   __export(panes_exports, {
86289     uiPaneBackground: () => uiPaneBackground,
86290     uiPaneHelp: () => uiPaneHelp,
86291     uiPaneIssues: () => uiPaneIssues,
86292     uiPaneMapData: () => uiPaneMapData,
86293     uiPanePreferences: () => uiPanePreferences
86294   });
86295   var init_panes = __esm({
86296     "modules/ui/panes/index.js"() {
86297       "use strict";
86298       init_background3();
86299       init_help();
86300       init_issues();
86301       init_map_data();
86302       init_preferences2();
86303     }
86304   });
86305
86306   // modules/ui/sections/index.js
86307   var sections_exports = {};
86308   __export(sections_exports, {
86309     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
86310     uiSectionBackgroundList: () => uiSectionBackgroundList,
86311     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
86312     uiSectionChanges: () => uiSectionChanges,
86313     uiSectionDataLayers: () => uiSectionDataLayers,
86314     uiSectionEntityIssues: () => uiSectionEntityIssues,
86315     uiSectionFeatureType: () => uiSectionFeatureType,
86316     uiSectionMapFeatures: () => uiSectionMapFeatures,
86317     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
86318     uiSectionOverlayList: () => uiSectionOverlayList,
86319     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
86320     uiSectionPresetFields: () => uiSectionPresetFields,
86321     uiSectionPrivacy: () => uiSectionPrivacy,
86322     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
86323     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
86324     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
86325     uiSectionSelectionList: () => uiSectionSelectionList,
86326     uiSectionValidationIssues: () => uiSectionValidationIssues,
86327     uiSectionValidationOptions: () => uiSectionValidationOptions,
86328     uiSectionValidationRules: () => uiSectionValidationRules,
86329     uiSectionValidationStatus: () => uiSectionValidationStatus
86330   });
86331   var init_sections = __esm({
86332     "modules/ui/sections/index.js"() {
86333       "use strict";
86334       init_background_display_options();
86335       init_background_list();
86336       init_background_offset();
86337       init_changes();
86338       init_data_layers();
86339       init_entity_issues();
86340       init_feature_type();
86341       init_map_features();
86342       init_map_style_options();
86343       init_overlay_list();
86344       init_photo_overlays();
86345       init_preset_fields();
86346       init_privacy();
86347       init_raw_member_editor();
86348       init_raw_membership_editor();
86349       init_raw_tag_editor();
86350       init_selection_list();
86351       init_validation_issues();
86352       init_validation_options();
86353       init_validation_rules();
86354       init_validation_status();
86355     }
86356   });
86357
86358   // modules/ui/settings/index.js
86359   var settings_exports = {};
86360   __export(settings_exports, {
86361     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
86362     uiSettingsCustomData: () => uiSettingsCustomData
86363   });
86364   var init_settings = __esm({
86365     "modules/ui/settings/index.js"() {
86366       "use strict";
86367       init_custom_background();
86368       init_custom_data();
86369     }
86370   });
86371
86372   // import("../**/*") in modules/core/file_fetcher.js
86373   var globImport;
86374   var init_ = __esm({
86375     'import("../**/*") in modules/core/file_fetcher.js'() {
86376       globImport = __glob({
86377         "../actions/add_entity.js": () => Promise.resolve().then(() => (init_add_entity(), add_entity_exports)),
86378         "../actions/add_member.js": () => Promise.resolve().then(() => (init_add_member(), add_member_exports)),
86379         "../actions/add_midpoint.js": () => Promise.resolve().then(() => (init_add_midpoint(), add_midpoint_exports)),
86380         "../actions/add_vertex.js": () => Promise.resolve().then(() => (init_add_vertex(), add_vertex_exports)),
86381         "../actions/change_member.js": () => Promise.resolve().then(() => (init_change_member(), change_member_exports)),
86382         "../actions/change_preset.js": () => Promise.resolve().then(() => (init_change_preset(), change_preset_exports)),
86383         "../actions/change_tags.js": () => Promise.resolve().then(() => (init_change_tags(), change_tags_exports)),
86384         "../actions/circularize.js": () => Promise.resolve().then(() => (init_circularize(), circularize_exports)),
86385         "../actions/connect.js": () => Promise.resolve().then(() => (init_connect(), connect_exports)),
86386         "../actions/copy_entities.js": () => Promise.resolve().then(() => (init_copy_entities(), copy_entities_exports)),
86387         "../actions/delete_member.js": () => Promise.resolve().then(() => (init_delete_member(), delete_member_exports)),
86388         "../actions/delete_members.js": () => Promise.resolve().then(() => (init_delete_members(), delete_members_exports)),
86389         "../actions/delete_multiple.js": () => Promise.resolve().then(() => (init_delete_multiple(), delete_multiple_exports)),
86390         "../actions/delete_node.js": () => Promise.resolve().then(() => (init_delete_node(), delete_node_exports)),
86391         "../actions/delete_relation.js": () => Promise.resolve().then(() => (init_delete_relation(), delete_relation_exports)),
86392         "../actions/delete_way.js": () => Promise.resolve().then(() => (init_delete_way(), delete_way_exports)),
86393         "../actions/discard_tags.js": () => Promise.resolve().then(() => (init_discard_tags(), discard_tags_exports)),
86394         "../actions/disconnect.js": () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)),
86395         "../actions/extract.js": () => Promise.resolve().then(() => (init_extract(), extract_exports)),
86396         "../actions/index.js": () => Promise.resolve().then(() => (init_actions(), actions_exports)),
86397         "../actions/join.js": () => Promise.resolve().then(() => (init_join2(), join_exports)),
86398         "../actions/merge.js": () => Promise.resolve().then(() => (init_merge5(), merge_exports)),
86399         "../actions/merge_nodes.js": () => Promise.resolve().then(() => (init_merge_nodes(), merge_nodes_exports)),
86400         "../actions/merge_polygon.js": () => Promise.resolve().then(() => (init_merge_polygon(), merge_polygon_exports)),
86401         "../actions/merge_remote_changes.js": () => Promise.resolve().then(() => (init_merge_remote_changes(), merge_remote_changes_exports)),
86402         "../actions/move.js": () => Promise.resolve().then(() => (init_move(), move_exports)),
86403         "../actions/move_member.js": () => Promise.resolve().then(() => (init_move_member(), move_member_exports)),
86404         "../actions/move_node.js": () => Promise.resolve().then(() => (init_move_node(), move_node_exports)),
86405         "../actions/noop.js": () => Promise.resolve().then(() => (init_noop2(), noop_exports)),
86406         "../actions/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize(), orthogonalize_exports)),
86407         "../actions/reflect.js": () => Promise.resolve().then(() => (init_reflect(), reflect_exports)),
86408         "../actions/restrict_turn.js": () => Promise.resolve().then(() => (init_restrict_turn(), restrict_turn_exports)),
86409         "../actions/reverse.js": () => Promise.resolve().then(() => (init_reverse(), reverse_exports)),
86410         "../actions/revert.js": () => Promise.resolve().then(() => (init_revert(), revert_exports)),
86411         "../actions/rotate.js": () => Promise.resolve().then(() => (init_rotate(), rotate_exports)),
86412         "../actions/scale.js": () => Promise.resolve().then(() => (init_scale(), scale_exports)),
86413         "../actions/split.js": () => Promise.resolve().then(() => (init_split(), split_exports)),
86414         "../actions/straighten_nodes.js": () => Promise.resolve().then(() => (init_straighten_nodes(), straighten_nodes_exports)),
86415         "../actions/straighten_way.js": () => Promise.resolve().then(() => (init_straighten_way(), straighten_way_exports)),
86416         "../actions/unrestrict_turn.js": () => Promise.resolve().then(() => (init_unrestrict_turn(), unrestrict_turn_exports)),
86417         "../actions/upgrade_tags.js": () => Promise.resolve().then(() => (init_upgrade_tags(), upgrade_tags_exports)),
86418         "../behavior/add_way.js": () => Promise.resolve().then(() => (init_add_way(), add_way_exports)),
86419         "../behavior/breathe.js": () => Promise.resolve().then(() => (init_breathe(), breathe_exports)),
86420         "../behavior/drag.js": () => Promise.resolve().then(() => (init_drag2(), drag_exports)),
86421         "../behavior/draw.js": () => Promise.resolve().then(() => (init_draw(), draw_exports)),
86422         "../behavior/draw_way.js": () => Promise.resolve().then(() => (init_draw_way(), draw_way_exports)),
86423         "../behavior/edit.js": () => Promise.resolve().then(() => (init_edit(), edit_exports)),
86424         "../behavior/hash.js": () => Promise.resolve().then(() => (init_hash(), hash_exports)),
86425         "../behavior/hover.js": () => Promise.resolve().then(() => (init_hover(), hover_exports)),
86426         "../behavior/index.js": () => Promise.resolve().then(() => (init_behavior(), behavior_exports)),
86427         "../behavior/lasso.js": () => Promise.resolve().then(() => (init_lasso2(), lasso_exports2)),
86428         "../behavior/operation.js": () => Promise.resolve().then(() => (init_operation(), operation_exports)),
86429         "../behavior/paste.js": () => Promise.resolve().then(() => (init_paste(), paste_exports)),
86430         "../behavior/select.js": () => Promise.resolve().then(() => (init_select4(), select_exports)),
86431         "../core/LocationManager.js": () => Promise.resolve().then(() => (init_LocationManager(), LocationManager_exports)),
86432         "../core/context.js": () => Promise.resolve().then(() => (init_context2(), context_exports)),
86433         "../core/difference.js": () => Promise.resolve().then(() => (init_difference(), difference_exports)),
86434         "../core/file_fetcher.js": () => Promise.resolve().then(() => (init_file_fetcher(), file_fetcher_exports)),
86435         "../core/graph.js": () => Promise.resolve().then(() => (init_graph(), graph_exports)),
86436         "../core/history.js": () => Promise.resolve().then(() => (init_history(), history_exports)),
86437         "../core/index.js": () => Promise.resolve().then(() => (init_core(), core_exports)),
86438         "../core/localizer.js": () => Promise.resolve().then(() => (init_localizer(), localizer_exports)),
86439         "../core/preferences.js": () => Promise.resolve().then(() => (init_preferences(), preferences_exports)),
86440         "../core/tree.js": () => Promise.resolve().then(() => (init_tree(), tree_exports)),
86441         "../core/uploader.js": () => Promise.resolve().then(() => (init_uploader(), uploader_exports)),
86442         "../core/validation/index.js": () => Promise.resolve().then(() => (init_validation(), validation_exports)),
86443         "../core/validation/models.js": () => Promise.resolve().then(() => (init_models(), models_exports)),
86444         "../core/validator.js": () => Promise.resolve().then(() => (init_validator(), validator_exports)),
86445         "../geo/extent.js": () => Promise.resolve().then(() => (init_extent(), extent_exports)),
86446         "../geo/geo.js": () => Promise.resolve().then(() => (init_geo(), geo_exports)),
86447         "../geo/geom.js": () => Promise.resolve().then(() => (init_geom(), geom_exports)),
86448         "../geo/index.js": () => Promise.resolve().then(() => (init_geo2(), geo_exports2)),
86449         "../geo/ortho.js": () => Promise.resolve().then(() => (init_ortho(), ortho_exports)),
86450         "../geo/raw_mercator.js": () => Promise.resolve().then(() => (init_raw_mercator(), raw_mercator_exports)),
86451         "../geo/vector.js": () => Promise.resolve().then(() => (init_vector(), vector_exports)),
86452         "../globals.d.ts": () => Promise.resolve().then(() => (init_globals_d(), globals_d_exports)),
86453         "../id.js": () => Promise.resolve().then(() => (init_id2(), id_exports)),
86454         "../index.js": () => Promise.resolve().then(() => (init_index(), index_exports)),
86455         "../modes/add_area.js": () => Promise.resolve().then(() => (init_add_area(), add_area_exports)),
86456         "../modes/add_line.js": () => Promise.resolve().then(() => (init_add_line(), add_line_exports)),
86457         "../modes/add_note.js": () => Promise.resolve().then(() => (init_add_note(), add_note_exports)),
86458         "../modes/add_point.js": () => Promise.resolve().then(() => (init_add_point(), add_point_exports)),
86459         "../modes/browse.js": () => Promise.resolve().then(() => (init_browse(), browse_exports)),
86460         "../modes/drag_node.js": () => Promise.resolve().then(() => (init_drag_node(), drag_node_exports)),
86461         "../modes/drag_note.js": () => Promise.resolve().then(() => (init_drag_note(), drag_note_exports)),
86462         "../modes/draw_area.js": () => Promise.resolve().then(() => (init_draw_area(), draw_area_exports)),
86463         "../modes/draw_line.js": () => Promise.resolve().then(() => (init_draw_line(), draw_line_exports)),
86464         "../modes/index.js": () => Promise.resolve().then(() => (init_modes2(), modes_exports2)),
86465         "../modes/move.js": () => Promise.resolve().then(() => (init_move3(), move_exports3)),
86466         "../modes/rotate.js": () => Promise.resolve().then(() => (init_rotate2(), rotate_exports2)),
86467         "../modes/save.js": () => Promise.resolve().then(() => (init_save2(), save_exports2)),
86468         "../modes/select.js": () => Promise.resolve().then(() => (init_select5(), select_exports2)),
86469         "../modes/select_data.js": () => Promise.resolve().then(() => (init_select_data(), select_data_exports)),
86470         "../modes/select_error.js": () => Promise.resolve().then(() => (init_select_error(), select_error_exports)),
86471         "../modes/select_note.js": () => Promise.resolve().then(() => (init_select_note(), select_note_exports)),
86472         "../operations/circularize.js": () => Promise.resolve().then(() => (init_circularize2(), circularize_exports2)),
86473         "../operations/continue.js": () => Promise.resolve().then(() => (init_continue(), continue_exports)),
86474         "../operations/copy.js": () => Promise.resolve().then(() => (init_copy(), copy_exports)),
86475         "../operations/delete.js": () => Promise.resolve().then(() => (init_delete(), delete_exports)),
86476         "../operations/disconnect.js": () => Promise.resolve().then(() => (init_disconnect2(), disconnect_exports2)),
86477         "../operations/downgrade.js": () => Promise.resolve().then(() => (init_downgrade(), downgrade_exports)),
86478         "../operations/extract.js": () => Promise.resolve().then(() => (init_extract2(), extract_exports2)),
86479         "../operations/index.js": () => Promise.resolve().then(() => (init_operations(), operations_exports)),
86480         "../operations/merge.js": () => Promise.resolve().then(() => (init_merge6(), merge_exports2)),
86481         "../operations/move.js": () => Promise.resolve().then(() => (init_move2(), move_exports2)),
86482         "../operations/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize2(), orthogonalize_exports2)),
86483         "../operations/paste.js": () => Promise.resolve().then(() => (init_paste2(), paste_exports2)),
86484         "../operations/reflect.js": () => Promise.resolve().then(() => (init_reflect2(), reflect_exports2)),
86485         "../operations/reverse.js": () => Promise.resolve().then(() => (init_reverse2(), reverse_exports2)),
86486         "../operations/rotate.js": () => Promise.resolve().then(() => (init_rotate3(), rotate_exports3)),
86487         "../operations/split.js": () => Promise.resolve().then(() => (init_split2(), split_exports2)),
86488         "../operations/straighten.js": () => Promise.resolve().then(() => (init_straighten(), straighten_exports)),
86489         "../osm/changeset.js": () => Promise.resolve().then(() => (init_changeset(), changeset_exports)),
86490         "../osm/deprecated.js": () => Promise.resolve().then(() => (init_deprecated(), deprecated_exports)),
86491         "../osm/entity.js": () => Promise.resolve().then(() => (init_entity(), entity_exports)),
86492         "../osm/index.js": () => Promise.resolve().then(() => (init_osm(), osm_exports)),
86493         "../osm/intersection.js": () => Promise.resolve().then(() => (init_intersection(), intersection_exports)),
86494         "../osm/lanes.js": () => Promise.resolve().then(() => (init_lanes(), lanes_exports)),
86495         "../osm/multipolygon.js": () => Promise.resolve().then(() => (init_multipolygon(), multipolygon_exports)),
86496         "../osm/node.js": () => Promise.resolve().then(() => (init_node2(), node_exports)),
86497         "../osm/note.js": () => Promise.resolve().then(() => (init_note(), note_exports)),
86498         "../osm/qa_item.js": () => Promise.resolve().then(() => (init_qa_item(), qa_item_exports)),
86499         "../osm/relation.js": () => Promise.resolve().then(() => (init_relation(), relation_exports)),
86500         "../osm/tags.js": () => Promise.resolve().then(() => (init_tags(), tags_exports)),
86501         "../osm/way.js": () => Promise.resolve().then(() => (init_way(), way_exports)),
86502         "../presets/category.js": () => Promise.resolve().then(() => (init_category(), category_exports)),
86503         "../presets/collection.js": () => Promise.resolve().then(() => (init_collection(), collection_exports)),
86504         "../presets/field.js": () => Promise.resolve().then(() => (init_field(), field_exports)),
86505         "../presets/index.js": () => Promise.resolve().then(() => (init_presets(), presets_exports)),
86506         "../presets/preset.js": () => Promise.resolve().then(() => (init_preset(), preset_exports)),
86507         "../renderer/background.js": () => Promise.resolve().then(() => (init_background2(), background_exports2)),
86508         "../renderer/background_source.js": () => Promise.resolve().then(() => (init_background_source(), background_source_exports)),
86509         "../renderer/features.js": () => Promise.resolve().then(() => (init_features(), features_exports)),
86510         "../renderer/index.js": () => Promise.resolve().then(() => (init_renderer(), renderer_exports)),
86511         "../renderer/map.js": () => Promise.resolve().then(() => (init_map(), map_exports)),
86512         "../renderer/photos.js": () => Promise.resolve().then(() => (init_photos(), photos_exports)),
86513         "../renderer/tile_layer.js": () => Promise.resolve().then(() => (init_tile_layer(), tile_layer_exports)),
86514         "../services/index.js": () => Promise.resolve().then(() => (init_services(), services_exports)),
86515         "../services/kartaview.js": () => Promise.resolve().then(() => (init_kartaview(), kartaview_exports)),
86516         "../services/keepRight.js": () => Promise.resolve().then(() => (init_keepRight(), keepRight_exports)),
86517         "../services/mapilio.js": () => Promise.resolve().then(() => (init_mapilio(), mapilio_exports)),
86518         "../services/mapillary.js": () => Promise.resolve().then(() => (init_mapillary(), mapillary_exports)),
86519         "../services/maprules.js": () => Promise.resolve().then(() => (init_maprules(), maprules_exports)),
86520         "../services/nominatim.js": () => Promise.resolve().then(() => (init_nominatim(), nominatim_exports)),
86521         "../services/nsi.js": () => Promise.resolve().then(() => (init_nsi(), nsi_exports)),
86522         "../services/osm.js": () => Promise.resolve().then(() => (init_osm2(), osm_exports2)),
86523         "../services/osm_wikibase.js": () => Promise.resolve().then(() => (init_osm_wikibase(), osm_wikibase_exports)),
86524         "../services/osmose.js": () => Promise.resolve().then(() => (init_osmose(), osmose_exports)),
86525         "../services/pannellum_photo.js": () => Promise.resolve().then(() => (init_pannellum_photo(), pannellum_photo_exports)),
86526         "../services/panoramax.js": () => Promise.resolve().then(() => (init_panoramax(), panoramax_exports)),
86527         "../services/plane_photo.js": () => Promise.resolve().then(() => (init_plane_photo(), plane_photo_exports)),
86528         "../services/streetside.js": () => Promise.resolve().then(() => (init_streetside(), streetside_exports)),
86529         "../services/taginfo.js": () => Promise.resolve().then(() => (init_taginfo(), taginfo_exports)),
86530         "../services/vector_tile.js": () => Promise.resolve().then(() => (init_vector_tile2(), vector_tile_exports)),
86531         "../services/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder(), vegbilder_exports)),
86532         "../services/wikidata.js": () => Promise.resolve().then(() => (init_wikidata(), wikidata_exports)),
86533         "../services/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia(), wikipedia_exports)),
86534         "../svg/areas.js": () => Promise.resolve().then(() => (init_areas(), areas_exports)),
86535         "../svg/data.js": () => Promise.resolve().then(() => (init_data2(), data_exports)),
86536         "../svg/debug.js": () => Promise.resolve().then(() => (init_debug(), debug_exports)),
86537         "../svg/defs.js": () => Promise.resolve().then(() => (init_defs(), defs_exports)),
86538         "../svg/geolocate.js": () => Promise.resolve().then(() => (init_geolocate(), geolocate_exports)),
86539         "../svg/helpers.js": () => Promise.resolve().then(() => (init_helpers(), helpers_exports)),
86540         "../svg/icon.js": () => Promise.resolve().then(() => (init_icon(), icon_exports)),
86541         "../svg/index.js": () => Promise.resolve().then(() => (init_svg(), svg_exports)),
86542         "../svg/kartaview_images.js": () => Promise.resolve().then(() => (init_kartaview_images(), kartaview_images_exports)),
86543         "../svg/keepRight.js": () => Promise.resolve().then(() => (init_keepRight2(), keepRight_exports2)),
86544         "../svg/labels.js": () => Promise.resolve().then(() => (init_labels(), labels_exports)),
86545         "../svg/layers.js": () => Promise.resolve().then(() => (init_layers(), layers_exports)),
86546         "../svg/lines.js": () => Promise.resolve().then(() => (init_lines(), lines_exports)),
86547         "../svg/local_photos.js": () => Promise.resolve().then(() => (init_local_photos(), local_photos_exports)),
86548         "../svg/mapilio_images.js": () => Promise.resolve().then(() => (init_mapilio_images(), mapilio_images_exports)),
86549         "../svg/mapillary_images.js": () => Promise.resolve().then(() => (init_mapillary_images(), mapillary_images_exports)),
86550         "../svg/mapillary_map_features.js": () => Promise.resolve().then(() => (init_mapillary_map_features(), mapillary_map_features_exports)),
86551         "../svg/mapillary_position.js": () => Promise.resolve().then(() => (init_mapillary_position(), mapillary_position_exports)),
86552         "../svg/mapillary_signs.js": () => Promise.resolve().then(() => (init_mapillary_signs(), mapillary_signs_exports)),
86553         "../svg/midpoints.js": () => Promise.resolve().then(() => (init_midpoints(), midpoints_exports)),
86554         "../svg/notes.js": () => Promise.resolve().then(() => (init_notes(), notes_exports)),
86555         "../svg/osm.js": () => Promise.resolve().then(() => (init_osm3(), osm_exports3)),
86556         "../svg/osmose.js": () => Promise.resolve().then(() => (init_osmose2(), osmose_exports2)),
86557         "../svg/panoramax_images.js": () => Promise.resolve().then(() => (init_panoramax_images(), panoramax_images_exports)),
86558         "../svg/points.js": () => Promise.resolve().then(() => (init_points(), points_exports)),
86559         "../svg/streetside.js": () => Promise.resolve().then(() => (init_streetside2(), streetside_exports2)),
86560         "../svg/tag_classes.js": () => Promise.resolve().then(() => (init_tag_classes(), tag_classes_exports)),
86561         "../svg/tag_pattern.js": () => Promise.resolve().then(() => (init_tag_pattern(), tag_pattern_exports)),
86562         "../svg/touch.js": () => Promise.resolve().then(() => (init_touch(), touch_exports)),
86563         "../svg/turns.js": () => Promise.resolve().then(() => (init_turns(), turns_exports)),
86564         "../svg/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder2(), vegbilder_exports2)),
86565         "../svg/vertices.js": () => Promise.resolve().then(() => (init_vertices(), vertices_exports)),
86566         "../ui/account.js": () => Promise.resolve().then(() => (init_account(), account_exports)),
86567         "../ui/attribution.js": () => Promise.resolve().then(() => (init_attribution(), attribution_exports)),
86568         "../ui/changeset_editor.js": () => Promise.resolve().then(() => (init_changeset_editor(), changeset_editor_exports)),
86569         "../ui/cmd.js": () => Promise.resolve().then(() => (init_cmd(), cmd_exports)),
86570         "../ui/combobox.js": () => Promise.resolve().then(() => (init_combobox(), combobox_exports)),
86571         "../ui/commit.js": () => Promise.resolve().then(() => (init_commit(), commit_exports)),
86572         "../ui/commit_warnings.js": () => Promise.resolve().then(() => (init_commit_warnings(), commit_warnings_exports)),
86573         "../ui/confirm.js": () => Promise.resolve().then(() => (init_confirm(), confirm_exports)),
86574         "../ui/conflicts.js": () => Promise.resolve().then(() => (init_conflicts(), conflicts_exports)),
86575         "../ui/contributors.js": () => Promise.resolve().then(() => (init_contributors(), contributors_exports)),
86576         "../ui/curtain.js": () => Promise.resolve().then(() => (init_curtain(), curtain_exports)),
86577         "../ui/data_editor.js": () => Promise.resolve().then(() => (init_data_editor(), data_editor_exports)),
86578         "../ui/data_header.js": () => Promise.resolve().then(() => (init_data_header(), data_header_exports)),
86579         "../ui/disclosure.js": () => Promise.resolve().then(() => (init_disclosure(), disclosure_exports)),
86580         "../ui/edit_menu.js": () => Promise.resolve().then(() => (init_edit_menu(), edit_menu_exports)),
86581         "../ui/entity_editor.js": () => Promise.resolve().then(() => (init_entity_editor(), entity_editor_exports)),
86582         "../ui/feature_info.js": () => Promise.resolve().then(() => (init_feature_info(), feature_info_exports)),
86583         "../ui/feature_list.js": () => Promise.resolve().then(() => (init_feature_list(), feature_list_exports)),
86584         "../ui/field.js": () => Promise.resolve().then(() => (init_field2(), field_exports2)),
86585         "../ui/field_help.js": () => Promise.resolve().then(() => (init_field_help(), field_help_exports)),
86586         "../ui/fields/access.js": () => Promise.resolve().then(() => (init_access(), access_exports)),
86587         "../ui/fields/address.js": () => Promise.resolve().then(() => (init_address(), address_exports)),
86588         "../ui/fields/check.js": () => Promise.resolve().then(() => (init_check(), check_exports)),
86589         "../ui/fields/combo.js": () => Promise.resolve().then(() => (init_combo(), combo_exports)),
86590         "../ui/fields/directional_combo.js": () => Promise.resolve().then(() => (init_directional_combo(), directional_combo_exports)),
86591         "../ui/fields/index.js": () => Promise.resolve().then(() => (init_fields(), fields_exports)),
86592         "../ui/fields/input.js": () => Promise.resolve().then(() => (init_input(), input_exports)),
86593         "../ui/fields/lanes.js": () => Promise.resolve().then(() => (init_lanes2(), lanes_exports2)),
86594         "../ui/fields/localized.js": () => Promise.resolve().then(() => (init_localized(), localized_exports)),
86595         "../ui/fields/radio.js": () => Promise.resolve().then(() => (init_radio(), radio_exports)),
86596         "../ui/fields/restrictions.js": () => Promise.resolve().then(() => (init_restrictions(), restrictions_exports)),
86597         "../ui/fields/roadheight.js": () => Promise.resolve().then(() => (init_roadheight(), roadheight_exports)),
86598         "../ui/fields/roadspeed.js": () => Promise.resolve().then(() => (init_roadspeed(), roadspeed_exports)),
86599         "../ui/fields/textarea.js": () => Promise.resolve().then(() => (init_textarea(), textarea_exports)),
86600         "../ui/fields/wikidata.js": () => Promise.resolve().then(() => (init_wikidata2(), wikidata_exports2)),
86601         "../ui/fields/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia2(), wikipedia_exports2)),
86602         "../ui/flash.js": () => Promise.resolve().then(() => (init_flash(), flash_exports)),
86603         "../ui/form_fields.js": () => Promise.resolve().then(() => (init_form_fields(), form_fields_exports)),
86604         "../ui/full_screen.js": () => Promise.resolve().then(() => (init_full_screen(), full_screen_exports)),
86605         "../ui/geolocate.js": () => Promise.resolve().then(() => (init_geolocate2(), geolocate_exports2)),
86606         "../ui/index.js": () => Promise.resolve().then(() => (init_ui(), ui_exports)),
86607         "../ui/info.js": () => Promise.resolve().then(() => (init_info(), info_exports)),
86608         "../ui/init.js": () => Promise.resolve().then(() => (init_init2(), init_exports)),
86609         "../ui/inspector.js": () => Promise.resolve().then(() => (init_inspector(), inspector_exports)),
86610         "../ui/intro/area.js": () => Promise.resolve().then(() => (init_area4(), area_exports)),
86611         "../ui/intro/building.js": () => Promise.resolve().then(() => (init_building(), building_exports)),
86612         "../ui/intro/helper.js": () => Promise.resolve().then(() => (init_helper(), helper_exports)),
86613         "../ui/intro/index.js": () => Promise.resolve().then(() => (init_intro2(), intro_exports2)),
86614         "../ui/intro/intro.js": () => Promise.resolve().then(() => (init_intro(), intro_exports)),
86615         "../ui/intro/line.js": () => Promise.resolve().then(() => (init_line2(), line_exports)),
86616         "../ui/intro/navigation.js": () => Promise.resolve().then(() => (init_navigation(), navigation_exports)),
86617         "../ui/intro/point.js": () => Promise.resolve().then(() => (init_point(), point_exports)),
86618         "../ui/intro/start_editing.js": () => Promise.resolve().then(() => (init_start_editing(), start_editing_exports)),
86619         "../ui/intro/welcome.js": () => Promise.resolve().then(() => (init_welcome(), welcome_exports)),
86620         "../ui/issues_info.js": () => Promise.resolve().then(() => (init_issues_info(), issues_info_exports)),
86621         "../ui/keepRight_details.js": () => Promise.resolve().then(() => (init_keepRight_details(), keepRight_details_exports)),
86622         "../ui/keepRight_editor.js": () => Promise.resolve().then(() => (init_keepRight_editor(), keepRight_editor_exports)),
86623         "../ui/keepRight_header.js": () => Promise.resolve().then(() => (init_keepRight_header(), keepRight_header_exports)),
86624         "../ui/lasso.js": () => Promise.resolve().then(() => (init_lasso(), lasso_exports)),
86625         "../ui/length_indicator.js": () => Promise.resolve().then(() => (init_length_indicator(), length_indicator_exports)),
86626         "../ui/loading.js": () => Promise.resolve().then(() => (init_loading(), loading_exports)),
86627         "../ui/map_in_map.js": () => Promise.resolve().then(() => (init_map_in_map(), map_in_map_exports)),
86628         "../ui/modal.js": () => Promise.resolve().then(() => (init_modal(), modal_exports)),
86629         "../ui/note_comments.js": () => Promise.resolve().then(() => (init_note_comments(), note_comments_exports)),
86630         "../ui/note_editor.js": () => Promise.resolve().then(() => (init_note_editor(), note_editor_exports)),
86631         "../ui/note_header.js": () => Promise.resolve().then(() => (init_note_header(), note_header_exports)),
86632         "../ui/note_report.js": () => Promise.resolve().then(() => (init_note_report(), note_report_exports)),
86633         "../ui/notice.js": () => Promise.resolve().then(() => (init_notice(), notice_exports)),
86634         "../ui/osmose_details.js": () => Promise.resolve().then(() => (init_osmose_details(), osmose_details_exports)),
86635         "../ui/osmose_editor.js": () => Promise.resolve().then(() => (init_osmose_editor(), osmose_editor_exports)),
86636         "../ui/osmose_header.js": () => Promise.resolve().then(() => (init_osmose_header(), osmose_header_exports)),
86637         "../ui/pane.js": () => Promise.resolve().then(() => (init_pane(), pane_exports)),
86638         "../ui/panels/background.js": () => Promise.resolve().then(() => (init_background(), background_exports)),
86639         "../ui/panels/history.js": () => Promise.resolve().then(() => (init_history2(), history_exports2)),
86640         "../ui/panels/index.js": () => Promise.resolve().then(() => (init_panels(), panels_exports)),
86641         "../ui/panels/location.js": () => Promise.resolve().then(() => (init_location(), location_exports)),
86642         "../ui/panels/measurement.js": () => Promise.resolve().then(() => (init_measurement(), measurement_exports)),
86643         "../ui/panes/background.js": () => Promise.resolve().then(() => (init_background3(), background_exports3)),
86644         "../ui/panes/help.js": () => Promise.resolve().then(() => (init_help(), help_exports)),
86645         "../ui/panes/index.js": () => Promise.resolve().then(() => (init_panes(), panes_exports)),
86646         "../ui/panes/issues.js": () => Promise.resolve().then(() => (init_issues(), issues_exports)),
86647         "../ui/panes/map_data.js": () => Promise.resolve().then(() => (init_map_data(), map_data_exports)),
86648         "../ui/panes/preferences.js": () => Promise.resolve().then(() => (init_preferences2(), preferences_exports2)),
86649         "../ui/photoviewer.js": () => Promise.resolve().then(() => (init_photoviewer(), photoviewer_exports)),
86650         "../ui/popover.js": () => Promise.resolve().then(() => (init_popover(), popover_exports)),
86651         "../ui/preset_icon.js": () => Promise.resolve().then(() => (init_preset_icon(), preset_icon_exports)),
86652         "../ui/preset_list.js": () => Promise.resolve().then(() => (init_preset_list(), preset_list_exports)),
86653         "../ui/restore.js": () => Promise.resolve().then(() => (init_restore(), restore_exports)),
86654         "../ui/scale.js": () => Promise.resolve().then(() => (init_scale2(), scale_exports2)),
86655         "../ui/section.js": () => Promise.resolve().then(() => (init_section(), section_exports)),
86656         "../ui/sections/background_display_options.js": () => Promise.resolve().then(() => (init_background_display_options(), background_display_options_exports)),
86657         "../ui/sections/background_list.js": () => Promise.resolve().then(() => (init_background_list(), background_list_exports)),
86658         "../ui/sections/background_offset.js": () => Promise.resolve().then(() => (init_background_offset(), background_offset_exports)),
86659         "../ui/sections/changes.js": () => Promise.resolve().then(() => (init_changes(), changes_exports)),
86660         "../ui/sections/data_layers.js": () => Promise.resolve().then(() => (init_data_layers(), data_layers_exports)),
86661         "../ui/sections/entity_issues.js": () => Promise.resolve().then(() => (init_entity_issues(), entity_issues_exports)),
86662         "../ui/sections/feature_type.js": () => Promise.resolve().then(() => (init_feature_type(), feature_type_exports)),
86663         "../ui/sections/index.js": () => Promise.resolve().then(() => (init_sections(), sections_exports)),
86664         "../ui/sections/map_features.js": () => Promise.resolve().then(() => (init_map_features(), map_features_exports)),
86665         "../ui/sections/map_style_options.js": () => Promise.resolve().then(() => (init_map_style_options(), map_style_options_exports)),
86666         "../ui/sections/overlay_list.js": () => Promise.resolve().then(() => (init_overlay_list(), overlay_list_exports)),
86667         "../ui/sections/photo_overlays.js": () => Promise.resolve().then(() => (init_photo_overlays(), photo_overlays_exports)),
86668         "../ui/sections/preset_fields.js": () => Promise.resolve().then(() => (init_preset_fields(), preset_fields_exports)),
86669         "../ui/sections/privacy.js": () => Promise.resolve().then(() => (init_privacy(), privacy_exports)),
86670         "../ui/sections/raw_member_editor.js": () => Promise.resolve().then(() => (init_raw_member_editor(), raw_member_editor_exports)),
86671         "../ui/sections/raw_membership_editor.js": () => Promise.resolve().then(() => (init_raw_membership_editor(), raw_membership_editor_exports)),
86672         "../ui/sections/raw_tag_editor.js": () => Promise.resolve().then(() => (init_raw_tag_editor(), raw_tag_editor_exports)),
86673         "../ui/sections/selection_list.js": () => Promise.resolve().then(() => (init_selection_list(), selection_list_exports)),
86674         "../ui/sections/validation_issues.js": () => Promise.resolve().then(() => (init_validation_issues(), validation_issues_exports)),
86675         "../ui/sections/validation_options.js": () => Promise.resolve().then(() => (init_validation_options(), validation_options_exports)),
86676         "../ui/sections/validation_rules.js": () => Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports)),
86677         "../ui/sections/validation_status.js": () => Promise.resolve().then(() => (init_validation_status(), validation_status_exports)),
86678         "../ui/settings/custom_background.js": () => Promise.resolve().then(() => (init_custom_background(), custom_background_exports)),
86679         "../ui/settings/custom_data.js": () => Promise.resolve().then(() => (init_custom_data(), custom_data_exports)),
86680         "../ui/settings/index.js": () => Promise.resolve().then(() => (init_settings(), settings_exports)),
86681         "../ui/settings/local_photos.js": () => Promise.resolve().then(() => (init_local_photos2(), local_photos_exports2)),
86682         "../ui/shortcuts.js": () => Promise.resolve().then(() => (init_shortcuts(), shortcuts_exports)),
86683         "../ui/sidebar.js": () => Promise.resolve().then(() => (init_sidebar(), sidebar_exports)),
86684         "../ui/source_switch.js": () => Promise.resolve().then(() => (init_source_switch(), source_switch_exports)),
86685         "../ui/spinner.js": () => Promise.resolve().then(() => (init_spinner(), spinner_exports)),
86686         "../ui/splash.js": () => Promise.resolve().then(() => (init_splash(), splash_exports)),
86687         "../ui/status.js": () => Promise.resolve().then(() => (init_status(), status_exports)),
86688         "../ui/success.js": () => Promise.resolve().then(() => (init_success(), success_exports)),
86689         "../ui/tag_reference.js": () => Promise.resolve().then(() => (init_tag_reference(), tag_reference_exports)),
86690         "../ui/toggle.js": () => Promise.resolve().then(() => (init_toggle(), toggle_exports)),
86691         "../ui/tools/index.js": () => Promise.resolve().then(() => (init_tools(), tools_exports)),
86692         "../ui/tools/modes.js": () => Promise.resolve().then(() => (init_modes(), modes_exports)),
86693         "../ui/tools/notes.js": () => Promise.resolve().then(() => (init_notes2(), notes_exports2)),
86694         "../ui/tools/save.js": () => Promise.resolve().then(() => (init_save(), save_exports)),
86695         "../ui/tools/sidebar_toggle.js": () => Promise.resolve().then(() => (init_sidebar_toggle(), sidebar_toggle_exports)),
86696         "../ui/tools/undo_redo.js": () => Promise.resolve().then(() => (init_undo_redo(), undo_redo_exports)),
86697         "../ui/tooltip.js": () => Promise.resolve().then(() => (init_tooltip(), tooltip_exports)),
86698         "../ui/top_toolbar.js": () => Promise.resolve().then(() => (init_top_toolbar(), top_toolbar_exports)),
86699         "../ui/version.js": () => Promise.resolve().then(() => (init_version(), version_exports)),
86700         "../ui/view_on_keepRight.js": () => Promise.resolve().then(() => (init_view_on_keepRight(), view_on_keepRight_exports)),
86701         "../ui/view_on_osm.js": () => Promise.resolve().then(() => (init_view_on_osm(), view_on_osm_exports)),
86702         "../ui/view_on_osmose.js": () => Promise.resolve().then(() => (init_view_on_osmose(), view_on_osmose_exports)),
86703         "../ui/zoom.js": () => Promise.resolve().then(() => (init_zoom3(), zoom_exports)),
86704         "../ui/zoom_to_selection.js": () => Promise.resolve().then(() => (init_zoom_to_selection(), zoom_to_selection_exports)),
86705         "../util/IntervalTasksQueue.js": () => Promise.resolve().then(() => (init_IntervalTasksQueue(), IntervalTasksQueue_exports)),
86706         "../util/aes.js": () => Promise.resolve().then(() => (init_aes(), aes_exports)),
86707         "../util/array.js": () => Promise.resolve().then(() => (init_array3(), array_exports)),
86708         "../util/bind_once.js": () => Promise.resolve().then(() => (init_bind_once(), bind_once_exports)),
86709         "../util/clean_tags.js": () => Promise.resolve().then(() => (init_clean_tags(), clean_tags_exports)),
86710         "../util/detect.js": () => Promise.resolve().then(() => (init_detect(), detect_exports)),
86711         "../util/dimensions.js": () => Promise.resolve().then(() => (init_dimensions(), dimensions_exports)),
86712         "../util/double_up.js": () => Promise.resolve().then(() => (init_double_up(), double_up_exports)),
86713         "../util/get_set_value.js": () => Promise.resolve().then(() => (init_get_set_value(), get_set_value_exports)),
86714         "../util/index.js": () => Promise.resolve().then(() => (init_util(), util_exports)),
86715         "../util/jxon.js": () => Promise.resolve().then(() => (init_jxon(), jxon_exports)),
86716         "../util/keybinding.js": () => Promise.resolve().then(() => (init_keybinding(), keybinding_exports)),
86717         "../util/object.js": () => Promise.resolve().then(() => (init_object2(), object_exports)),
86718         "../util/rebind.js": () => Promise.resolve().then(() => (init_rebind(), rebind_exports)),
86719         "../util/session_mutex.js": () => Promise.resolve().then(() => (init_session_mutex(), session_mutex_exports)),
86720         "../util/svg_paths_rtl_fix.js": () => Promise.resolve().then(() => (init_svg_paths_rtl_fix(), svg_paths_rtl_fix_exports)),
86721         "../util/tiler.js": () => Promise.resolve().then(() => (init_tiler(), tiler_exports)),
86722         "../util/trigger_event.js": () => Promise.resolve().then(() => (init_trigger_event(), trigger_event_exports)),
86723         "../util/units.js": () => Promise.resolve().then(() => (init_units(), units_exports)),
86724         "../util/util.js": () => Promise.resolve().then(() => (init_util2(), util_exports2)),
86725         "../util/utilDisplayLabel.js": () => Promise.resolve().then(() => (init_utilDisplayLabel(), utilDisplayLabel_exports)),
86726         "../util/zoom_pan.js": () => Promise.resolve().then(() => (init_zoom_pan(), zoom_pan_exports)),
86727         "../validations/almost_junction.js": () => Promise.resolve().then(() => (init_almost_junction(), almost_junction_exports)),
86728         "../validations/close_nodes.js": () => Promise.resolve().then(() => (init_close_nodes(), close_nodes_exports)),
86729         "../validations/crossing_ways.js": () => Promise.resolve().then(() => (init_crossing_ways(), crossing_ways_exports)),
86730         "../validations/disconnected_way.js": () => Promise.resolve().then(() => (init_disconnected_way(), disconnected_way_exports)),
86731         "../validations/help_request.js": () => Promise.resolve().then(() => (init_help_request(), help_request_exports)),
86732         "../validations/impossible_oneway.js": () => Promise.resolve().then(() => (init_impossible_oneway(), impossible_oneway_exports)),
86733         "../validations/incompatible_source.js": () => Promise.resolve().then(() => (init_incompatible_source(), incompatible_source_exports)),
86734         "../validations/index.js": () => Promise.resolve().then(() => (init_validations(), validations_exports)),
86735         "../validations/invalid_format.js": () => Promise.resolve().then(() => (init_invalid_format(), invalid_format_exports)),
86736         "../validations/maprules.js": () => Promise.resolve().then(() => (init_maprules2(), maprules_exports2)),
86737         "../validations/mismatched_geometry.js": () => Promise.resolve().then(() => (init_mismatched_geometry(), mismatched_geometry_exports)),
86738         "../validations/missing_role.js": () => Promise.resolve().then(() => (init_missing_role(), missing_role_exports)),
86739         "../validations/missing_tag.js": () => Promise.resolve().then(() => (init_missing_tag(), missing_tag_exports)),
86740         "../validations/mutually_exclusive_tags.js": () => Promise.resolve().then(() => (init_mutually_exclusive_tags(), mutually_exclusive_tags_exports)),
86741         "../validations/osm_api_limits.js": () => Promise.resolve().then(() => (init_osm_api_limits(), osm_api_limits_exports)),
86742         "../validations/outdated_tags.js": () => Promise.resolve().then(() => (init_outdated_tags(), outdated_tags_exports)),
86743         "../validations/private_data.js": () => Promise.resolve().then(() => (init_private_data(), private_data_exports)),
86744         "../validations/suspicious_name.js": () => Promise.resolve().then(() => (init_suspicious_name(), suspicious_name_exports)),
86745         "../validations/unsquare_way.js": () => Promise.resolve().then(() => (init_unsquare_way(), unsquare_way_exports))
86746       });
86747     }
86748   });
86749
86750   // modules/core/file_fetcher.js
86751   var file_fetcher_exports = {};
86752   __export(file_fetcher_exports, {
86753     coreFileFetcher: () => coreFileFetcher,
86754     fileFetcher: () => _mainFileFetcher
86755   });
86756   function coreFileFetcher() {
86757     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
86758     const v3 = (0, import_vparse2.default)(ociVersion);
86759     const ociVersionMinor = `${v3.major}.${v3.minor}`;
86760     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
86761     let _this = {};
86762     let _inflight4 = {};
86763     let _fileMap = {
86764       "address_formats": "data/address_formats.min.json",
86765       "imagery": "data/imagery.min.json",
86766       "intro_graph": "data/intro_graph.min.json",
86767       "keepRight": "data/keepRight.min.json",
86768       "languages": "data/languages.min.json",
86769       "locales": "locales/index.min.json",
86770       "phone_formats": "data/phone_formats.min.json",
86771       "qa_data": "data/qa_data.min.json",
86772       "shortcuts": "data/shortcuts.min.json",
86773       "territory_languages": "data/territory_languages.min.json",
86774       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
86775       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
86776       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
86777       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
86778       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
86779       "discarded": presetsCdnUrl + "dist/discarded.min.json",
86780       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
86781       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
86782       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
86783       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
86784       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.2") + "data/wikipedia.min.json"
86785     };
86786     let _cachedData = {};
86787     _this.cache = () => _cachedData;
86788     _this.get = (which) => {
86789       if (_cachedData[which]) {
86790         return Promise.resolve(_cachedData[which]);
86791       }
86792       const file = _fileMap[which];
86793       const url = file && _this.asset(file);
86794       if (!url) {
86795         return Promise.reject(`Unknown data file for "${which}"`);
86796       }
86797       if (url.includes("{presets_version}")) {
86798         return _this.get("presets_package").then((result) => {
86799           const presetsVersion2 = result.version;
86800           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
86801         });
86802       } else {
86803         return getUrl(url, which);
86804       }
86805     };
86806     function getUrl(url, which) {
86807       let prom = _inflight4[url];
86808       if (!prom) {
86809         _inflight4[url] = prom = (window.VITEST ? globImport(`../${url}`) : fetch(url)).then((response) => {
86810           if (window.VITEST) return response.default;
86811           if (!response.ok || !response.json) {
86812             throw new Error(response.status + " " + response.statusText);
86813           }
86814           if (response.status === 204 || response.status === 205) return;
86815           return response.json();
86816         }).then((result) => {
86817           delete _inflight4[url];
86818           if (!result) {
86819             throw new Error(`No data loaded for "${which}"`);
86820           }
86821           _cachedData[which] = result;
86822           return result;
86823         }).catch((err) => {
86824           delete _inflight4[url];
86825           throw err;
86826         });
86827       }
86828       return prom;
86829     }
86830     _this.fileMap = function(val) {
86831       if (!arguments.length) return _fileMap;
86832       _fileMap = val;
86833       return _this;
86834     };
86835     let _assetPath = "";
86836     _this.assetPath = function(val) {
86837       if (!arguments.length) return _assetPath;
86838       _assetPath = val;
86839       return _this;
86840     };
86841     let _assetMap = {};
86842     _this.assetMap = function(val) {
86843       if (!arguments.length) return _assetMap;
86844       _assetMap = val;
86845       return _this;
86846     };
86847     _this.asset = (val) => {
86848       if (/^http(s)?:\/\//i.test(val)) return val;
86849       const filename = _assetPath + val;
86850       return _assetMap[filename] || filename;
86851     };
86852     return _this;
86853   }
86854   var import_vparse2, _mainFileFetcher;
86855   var init_file_fetcher = __esm({
86856     "modules/core/file_fetcher.js"() {
86857       "use strict";
86858       import_vparse2 = __toESM(require_vparse());
86859       init_id();
86860       init_package();
86861       init_();
86862       _mainFileFetcher = coreFileFetcher();
86863     }
86864   });
86865
86866   // modules/core/localizer.js
86867   var localizer_exports = {};
86868   __export(localizer_exports, {
86869     coreLocalizer: () => coreLocalizer,
86870     localizer: () => _mainLocalizer,
86871     t: () => _t
86872   });
86873   function coreLocalizer() {
86874     let localizer = {};
86875     let _dataLanguages = {};
86876     let _dataLocales = {};
86877     let _localeStrings = {};
86878     let _localeCode = "en-US";
86879     let _localeCodes = ["en-US", "en"];
86880     let _languageCode = "en";
86881     let _textDirection = "ltr";
86882     let _usesMetric = false;
86883     let _languageNames = {};
86884     let _scriptNames = {};
86885     localizer.localeCode = () => _localeCode;
86886     localizer.localeCodes = () => _localeCodes;
86887     localizer.languageCode = () => _languageCode;
86888     localizer.textDirection = () => _textDirection;
86889     localizer.usesMetric = () => _usesMetric;
86890     localizer.languageNames = () => _languageNames;
86891     localizer.scriptNames = () => _scriptNames;
86892     let _preferredLocaleCodes = [];
86893     localizer.preferredLocaleCodes = function(codes) {
86894       if (!arguments.length) return _preferredLocaleCodes;
86895       if (typeof codes === "string") {
86896         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
86897       } else {
86898         _preferredLocaleCodes = codes;
86899       }
86900       return localizer;
86901     };
86902     var _loadPromise;
86903     localizer.ensureLoaded = () => {
86904       if (_loadPromise) return _loadPromise;
86905       let filesToFetch = [
86906         "languages",
86907         // load the list of languages
86908         "locales"
86909         // load the list of supported locales
86910       ];
86911       const localeDirs = {
86912         general: "locales",
86913         tagging: presetsCdnUrl + "dist/translations"
86914       };
86915       let fileMap = _mainFileFetcher.fileMap();
86916       for (let scopeId in localeDirs) {
86917         const key = `locales_index_${scopeId}`;
86918         if (!fileMap[key]) {
86919           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
86920         }
86921         filesToFetch.push(key);
86922       }
86923       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
86924         _dataLanguages = results[0];
86925         _dataLocales = results[1];
86926         let indexes = results.slice(2);
86927         _localeCodes = localizer.localesToUseFrom(_dataLocales);
86928         _localeCode = _localeCodes[0];
86929         let loadStringsPromises = [];
86930         indexes.forEach((index, i3) => {
86931           const fullCoverageIndex = _localeCodes.findIndex(function(locale3) {
86932             return index[locale3] && index[locale3].pct === 1;
86933           });
86934           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
86935             let scopeId = Object.keys(localeDirs)[i3];
86936             let directory = Object.values(localeDirs)[i3];
86937             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
86938           });
86939         });
86940         return Promise.all(loadStringsPromises);
86941       }).then(() => {
86942         updateForCurrentLocale();
86943       }).catch((err) => console.error(err));
86944     };
86945     localizer.localesToUseFrom = (supportedLocales) => {
86946       const requestedLocales = [
86947         ..._preferredLocaleCodes || [],
86948         ...utilDetect().browserLocales,
86949         // List of locales preferred by the browser in priority order.
86950         "en"
86951         // fallback to English since it's the only guaranteed complete language
86952       ];
86953       let toUse = [];
86954       for (const locale3 of requestedLocales) {
86955         if (supportedLocales[locale3]) toUse.push(locale3);
86956         if ("Intl" in window && "Locale" in window.Intl) {
86957           const localeObj = new Intl.Locale(locale3);
86958           const withoutScript = `${localeObj.language}-${localeObj.region}`;
86959           const base = localeObj.language;
86960           if (supportedLocales[withoutScript]) toUse.push(withoutScript);
86961           if (supportedLocales[base]) toUse.push(base);
86962         } else if (locale3.includes("-")) {
86963           let langPart = locale3.split("-")[0];
86964           if (supportedLocales[langPart]) toUse.push(langPart);
86965         }
86966       }
86967       return utilArrayUniq(toUse);
86968     };
86969     function updateForCurrentLocale() {
86970       if (!_localeCode) return;
86971       _languageCode = _localeCode.split("-")[0];
86972       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
86973       const hash2 = utilStringQs(window.location.hash);
86974       if (hash2.rtl === "true") {
86975         _textDirection = "rtl";
86976       } else if (hash2.rtl === "false") {
86977         _textDirection = "ltr";
86978       } else {
86979         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
86980       }
86981       let locale3 = _localeCode;
86982       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86983       _languageNames = _localeStrings.general[locale3].languageNames || _localeStrings.general[_languageCode].languageNames;
86984       _scriptNames = _localeStrings.general[locale3].scriptNames || _localeStrings.general[_languageCode].scriptNames;
86985       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
86986     }
86987     localizer.loadLocale = (locale3, scopeId, directory) => {
86988       if (locale3.toLowerCase() === "en-us") locale3 = "en";
86989       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale3]) {
86990         return Promise.resolve(locale3);
86991       }
86992       let fileMap = _mainFileFetcher.fileMap();
86993       const key = `locale_${scopeId}_${locale3}`;
86994       if (!fileMap[key]) {
86995         fileMap[key] = `${directory}/${locale3}.min.json`;
86996       }
86997       return _mainFileFetcher.get(key).then((d2) => {
86998         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
86999         _localeStrings[scopeId][locale3] = d2[locale3];
87000         return locale3;
87001       });
87002     };
87003     localizer.pluralRule = function(number3) {
87004       return pluralRule(number3, _localeCode);
87005     };
87006     function pluralRule(number3, localeCode) {
87007       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
87008       if (rules) {
87009         return rules.select(number3);
87010       }
87011       if (number3 === 1) return "one";
87012       return "other";
87013     }
87014     localizer.tInfo = function(origStringId, replacements, locale3) {
87015       let stringId = origStringId.trim();
87016       let scopeId = "general";
87017       if (stringId[0] === "_") {
87018         let split = stringId.split(".");
87019         scopeId = split[0].slice(1);
87020         stringId = split.slice(1).join(".");
87021       }
87022       locale3 = locale3 || _localeCode;
87023       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
87024       let stringsKey = locale3;
87025       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
87026       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
87027       while (result !== void 0 && path.length) {
87028         result = result[path.pop()];
87029       }
87030       if (result !== void 0) {
87031         if (replacements) {
87032           if (typeof result === "object" && Object.keys(result).length) {
87033             const number3 = Object.values(replacements).find(function(value) {
87034               return typeof value === "number";
87035             });
87036             if (number3 !== void 0) {
87037               const rule = pluralRule(number3, locale3);
87038               if (result[rule]) {
87039                 result = result[rule];
87040               } else {
87041                 result = Object.values(result)[0];
87042               }
87043             }
87044           }
87045           if (typeof result === "string") {
87046             for (let key in replacements) {
87047               let value = replacements[key];
87048               if (typeof value === "number") {
87049                 if (value.toLocaleString) {
87050                   value = value.toLocaleString(locale3, {
87051                     style: "decimal",
87052                     useGrouping: true,
87053                     minimumFractionDigits: 0
87054                   });
87055                 } else {
87056                   value = value.toString();
87057                 }
87058               }
87059               const token = `{${key}}`;
87060               const regex = new RegExp(token, "g");
87061               result = result.replace(regex, value);
87062             }
87063           }
87064         }
87065         if (typeof result === "string") {
87066           return {
87067             text: result,
87068             locale: locale3
87069           };
87070         }
87071       }
87072       let index = _localeCodes.indexOf(locale3);
87073       if (index >= 0 && index < _localeCodes.length - 1) {
87074         let fallback = _localeCodes[index + 1];
87075         return localizer.tInfo(origStringId, replacements, fallback);
87076       }
87077       if (replacements && "default" in replacements) {
87078         return {
87079           text: replacements.default,
87080           locale: null
87081         };
87082       }
87083       const missing = `Missing ${locale3} translation: ${origStringId}`;
87084       if (typeof console !== "undefined") console.error(missing);
87085       return {
87086         text: missing,
87087         locale: "en"
87088       };
87089     };
87090     localizer.hasTextForStringId = function(stringId) {
87091       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
87092     };
87093     localizer.t = function(stringId, replacements, locale3) {
87094       return localizer.tInfo(stringId, replacements, locale3).text;
87095     };
87096     localizer.t.html = function(stringId, replacements, locale3) {
87097       replacements = Object.assign({}, replacements);
87098       for (var k3 in replacements) {
87099         if (typeof replacements[k3] === "string") {
87100           replacements[k3] = escape_default(replacements[k3]);
87101         }
87102         if (typeof replacements[k3] === "object" && typeof replacements[k3].html === "string") {
87103           replacements[k3] = replacements[k3].html;
87104         }
87105       }
87106       const info = localizer.tInfo(stringId, replacements, locale3);
87107       if (info.text) {
87108         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
87109       } else {
87110         return "";
87111       }
87112     };
87113     localizer.t.append = function(stringId, replacements, locale3) {
87114       const ret = function(selection2) {
87115         const info = localizer.tInfo(stringId, replacements, locale3);
87116         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87117       };
87118       ret.stringId = stringId;
87119       return ret;
87120     };
87121     localizer.t.addOrUpdate = function(stringId, replacements, locale3) {
87122       const ret = function(selection2) {
87123         const info = localizer.tInfo(stringId, replacements, locale3);
87124         const span = selection2.selectAll("span.localized-text").data([info]);
87125         const enter = span.enter().append("span").classed("localized-text", true);
87126         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
87127       };
87128       ret.stringId = stringId;
87129       return ret;
87130     };
87131     localizer.languageName = (code, options) => {
87132       if (_languageNames && _languageNames[code]) {
87133         return _languageNames[code];
87134       }
87135       if (options && options.localOnly) return null;
87136       const langInfo = _dataLanguages[code];
87137       if (langInfo) {
87138         if (langInfo.nativeName) {
87139           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
87140         } else if (langInfo.base && langInfo.script) {
87141           const base = langInfo.base;
87142           if (_languageNames && _languageNames[base]) {
87143             const scriptCode = langInfo.script;
87144             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
87145             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
87146           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
87147             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
87148           }
87149         }
87150       }
87151       return code;
87152     };
87153     localizer.floatFormatter = (locale3) => {
87154       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
87155         return (number3, fractionDigits) => {
87156           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
87157         };
87158       } else {
87159         return (number3, fractionDigits) => number3.toLocaleString(locale3, {
87160           minimumFractionDigits: fractionDigits,
87161           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
87162         });
87163       }
87164     };
87165     localizer.floatParser = (locale3) => {
87166       const polyfill = (string) => +string.trim();
87167       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
87168       const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87169       if (!("formatToParts" in format2)) return polyfill;
87170       const parts = format2.formatToParts(-12345.6);
87171       const numerals = Array.from({ length: 10 }).map((_3, i3) => format2.format(i3));
87172       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
87173       const literalPart = parts.find((d2) => d2.type === "literal");
87174       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87175       const groupPart = parts.find((d2) => d2.type === "group");
87176       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87177       const decimalPart = parts.find((d2) => d2.type === "decimal");
87178       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87179       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
87180       const getIndex = (d2) => index.get(d2);
87181       return (string) => {
87182         string = string.trim();
87183         if (literal) string = string.replace(literal, "");
87184         if (group) string = string.replace(group, "");
87185         if (decimal) string = string.replace(decimal, ".");
87186         string = string.replace(numeral, getIndex);
87187         return string ? +string : NaN;
87188       };
87189     };
87190     localizer.decimalPlaceCounter = (locale3) => {
87191       var literal, group, decimal;
87192       if ("Intl" in window && "NumberFormat" in Intl) {
87193         const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
87194         if ("formatToParts" in format2) {
87195           const parts = format2.formatToParts(-12345.6);
87196           const literalPart = parts.find((d2) => d2.type === "literal");
87197           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
87198           const groupPart = parts.find((d2) => d2.type === "group");
87199           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
87200           const decimalPart = parts.find((d2) => d2.type === "decimal");
87201           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
87202         }
87203       }
87204       return (string) => {
87205         string = string.trim();
87206         if (literal) string = string.replace(literal, "");
87207         if (group) string = string.replace(group, "");
87208         const parts = string.split(decimal || ".");
87209         return parts && parts[1] && parts[1].length || 0;
87210       };
87211     };
87212     return localizer;
87213   }
87214   var _mainLocalizer, _t;
87215   var init_localizer = __esm({
87216     "modules/core/localizer.js"() {
87217       "use strict";
87218       init_lodash();
87219       init_file_fetcher();
87220       init_detect();
87221       init_util();
87222       init_array3();
87223       init_id();
87224       _mainLocalizer = coreLocalizer();
87225       _t = _mainLocalizer.t;
87226     }
87227   });
87228
87229   // modules/util/util.js
87230   var util_exports2 = {};
87231   __export(util_exports2, {
87232     utilAsyncMap: () => utilAsyncMap,
87233     utilCleanOsmString: () => utilCleanOsmString,
87234     utilCombinedTags: () => utilCombinedTags,
87235     utilCompareIDs: () => utilCompareIDs,
87236     utilDeepMemberSelector: () => utilDeepMemberSelector,
87237     utilDisplayName: () => utilDisplayName,
87238     utilDisplayNameForPath: () => utilDisplayNameForPath,
87239     utilDisplayType: () => utilDisplayType,
87240     utilEditDistance: () => utilEditDistance,
87241     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
87242     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
87243     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
87244     utilEntityRoot: () => utilEntityRoot,
87245     utilEntitySelector: () => utilEntitySelector,
87246     utilFastMouse: () => utilFastMouse,
87247     utilFunctor: () => utilFunctor,
87248     utilGetAllNodes: () => utilGetAllNodes,
87249     utilHashcode: () => utilHashcode,
87250     utilHighlightEntities: () => utilHighlightEntities,
87251     utilNoAuto: () => utilNoAuto,
87252     utilOldestID: () => utilOldestID,
87253     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
87254     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
87255     utilQsString: () => utilQsString,
87256     utilSafeClassName: () => utilSafeClassName,
87257     utilSetTransform: () => utilSetTransform,
87258     utilStringQs: () => utilStringQs,
87259     utilTagDiff: () => utilTagDiff,
87260     utilTagText: () => utilTagText,
87261     utilTotalExtent: () => utilTotalExtent,
87262     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
87263     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
87264     utilUniqueDomId: () => utilUniqueDomId,
87265     utilWrap: () => utilWrap
87266   });
87267   function utilTagText(entity) {
87268     var obj = entity && entity.tags || {};
87269     return Object.keys(obj).map(function(k3) {
87270       return k3 + "=" + obj[k3];
87271     }).join(", ");
87272   }
87273   function utilTotalExtent(array2, graph) {
87274     var extent = geoExtent();
87275     var val, entity;
87276     for (var i3 = 0; i3 < array2.length; i3++) {
87277       val = array2[i3];
87278       entity = typeof val === "string" ? graph.hasEntity(val) : val;
87279       if (entity) {
87280         extent._extend(entity.extent(graph));
87281       }
87282     }
87283     return extent;
87284   }
87285   function utilTagDiff(oldTags, newTags) {
87286     var tagDiff = [];
87287     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
87288     keys2.forEach(function(k3) {
87289       var oldVal = oldTags[k3];
87290       var newVal = newTags[k3];
87291       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
87292         tagDiff.push({
87293           type: "-",
87294           key: k3,
87295           oldVal,
87296           newVal,
87297           display: "- " + k3 + "=" + oldVal
87298         });
87299       }
87300       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
87301         tagDiff.push({
87302           type: "+",
87303           key: k3,
87304           oldVal,
87305           newVal,
87306           display: "+ " + k3 + "=" + newVal
87307         });
87308       }
87309     });
87310     return tagDiff;
87311   }
87312   function utilEntitySelector(ids) {
87313     return ids.length ? "." + ids.join(",.") : "nothing";
87314   }
87315   function utilEntityOrMemberSelector(ids, graph) {
87316     var seen = new Set(ids);
87317     ids.forEach(collectShallowDescendants);
87318     return utilEntitySelector(Array.from(seen));
87319     function collectShallowDescendants(id2) {
87320       var entity = graph.hasEntity(id2);
87321       if (!entity || entity.type !== "relation") return;
87322       entity.members.map(function(member) {
87323         return member.id;
87324       }).forEach(function(id3) {
87325         seen.add(id3);
87326       });
87327     }
87328   }
87329   function utilEntityOrDeepMemberSelector(ids, graph) {
87330     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
87331   }
87332   function utilEntityAndDeepMemberIDs(ids, graph) {
87333     var seen = /* @__PURE__ */ new Set();
87334     ids.forEach(collectDeepDescendants);
87335     return Array.from(seen);
87336     function collectDeepDescendants(id2) {
87337       if (seen.has(id2)) return;
87338       seen.add(id2);
87339       var entity = graph.hasEntity(id2);
87340       if (!entity || entity.type !== "relation") return;
87341       entity.members.map(function(member) {
87342         return member.id;
87343       }).forEach(collectDeepDescendants);
87344     }
87345   }
87346   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
87347     var idsSet = new Set(ids);
87348     var seen = /* @__PURE__ */ new Set();
87349     var returners = /* @__PURE__ */ new Set();
87350     ids.forEach(collectDeepDescendants);
87351     return utilEntitySelector(Array.from(returners));
87352     function collectDeepDescendants(id2) {
87353       if (seen.has(id2)) return;
87354       seen.add(id2);
87355       if (!idsSet.has(id2)) {
87356         returners.add(id2);
87357       }
87358       var entity = graph.hasEntity(id2);
87359       if (!entity || entity.type !== "relation") return;
87360       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
87361       entity.members.map(function(member) {
87362         return member.id;
87363       }).forEach(collectDeepDescendants);
87364     }
87365   }
87366   function utilHighlightEntities(ids, highlighted, context) {
87367     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
87368   }
87369   function utilGetAllNodes(ids, graph) {
87370     var seen = /* @__PURE__ */ new Set();
87371     var nodes = /* @__PURE__ */ new Set();
87372     ids.forEach(collectNodes);
87373     return Array.from(nodes);
87374     function collectNodes(id2) {
87375       if (seen.has(id2)) return;
87376       seen.add(id2);
87377       var entity = graph.hasEntity(id2);
87378       if (!entity) return;
87379       if (entity.type === "node") {
87380         nodes.add(entity);
87381       } else if (entity.type === "way") {
87382         entity.nodes.forEach(collectNodes);
87383       } else {
87384         entity.members.map(function(member) {
87385           return member.id;
87386         }).forEach(collectNodes);
87387       }
87388     }
87389   }
87390   function utilDisplayName(entity, hideNetwork) {
87391     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
87392     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
87393     var tags = {
87394       addr: entity.tags["addr:housenumber"] || entity.tags["addr:housename"],
87395       direction: entity.tags.direction,
87396       from: entity.tags.from,
87397       name,
87398       network: hideNetwork ? void 0 : entity.tags.cycle_network || entity.tags.network,
87399       ref: entity.tags.ref,
87400       to: entity.tags.to,
87401       via: entity.tags.via
87402     };
87403     if (entity.tags.route && entity.tags.name && entity.tags.name.match(/[→⇒↔⇔]|[-=]>/)) {
87404       return entity.tags.name;
87405     }
87406     if (!entity.tags.route && name) {
87407       return name;
87408     }
87409     if (tags.addr) {
87410       return tags.addr;
87411     }
87412     var keyComponents = [];
87413     if (tags.network) {
87414       keyComponents.push("network");
87415     }
87416     if (tags.ref) {
87417       keyComponents.push("ref");
87418     }
87419     if (tags.name) {
87420       keyComponents.push("name");
87421     }
87422     if (entity.tags.route) {
87423       if (tags.direction) {
87424         keyComponents.push("direction");
87425       } else if (tags.from && tags.to) {
87426         keyComponents.push("from");
87427         keyComponents.push("to");
87428         if (tags.via) {
87429           keyComponents.push("via");
87430         }
87431       }
87432     }
87433     if (keyComponents.length) {
87434       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
87435     }
87436     return name;
87437   }
87438   function utilDisplayNameForPath(entity) {
87439     var name = utilDisplayName(entity);
87440     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
87441     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
87442     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
87443       name = fixRTLTextForSvg(name);
87444     }
87445     return name;
87446   }
87447   function utilDisplayType(id2) {
87448     return {
87449       n: _t("inspector.node"),
87450       w: _t("inspector.way"),
87451       r: _t("inspector.relation")
87452     }[id2.charAt(0)];
87453   }
87454   function utilEntityRoot(entityType) {
87455     return {
87456       node: "n",
87457       way: "w",
87458       relation: "r"
87459     }[entityType];
87460   }
87461   function utilCombinedTags(entityIDs, graph) {
87462     var tags = {};
87463     var tagCounts = {};
87464     var allKeys = /* @__PURE__ */ new Set();
87465     var allTags = [];
87466     var entities = entityIDs.map(function(entityID) {
87467       return graph.hasEntity(entityID);
87468     }).filter(Boolean);
87469     entities.forEach(function(entity) {
87470       var keys2 = Object.keys(entity.tags).filter(Boolean);
87471       keys2.forEach(function(key2) {
87472         allKeys.add(key2);
87473       });
87474     });
87475     entities.forEach(function(entity) {
87476       allTags.push(entity.tags);
87477       allKeys.forEach(function(key2) {
87478         var value = entity.tags[key2];
87479         if (!tags.hasOwnProperty(key2)) {
87480           tags[key2] = value;
87481         } else {
87482           if (!Array.isArray(tags[key2])) {
87483             if (tags[key2] !== value) {
87484               tags[key2] = [tags[key2], value];
87485             }
87486           } else {
87487             if (tags[key2].indexOf(value) === -1) {
87488               tags[key2].push(value);
87489             }
87490           }
87491         }
87492         var tagHash = key2 + "=" + value;
87493         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
87494         tagCounts[tagHash] += 1;
87495       });
87496     });
87497     for (var key in tags) {
87498       if (!Array.isArray(tags[key])) continue;
87499       tags[key] = tags[key].sort(function(val12, val2) {
87500         var key2 = key2;
87501         var count2 = tagCounts[key2 + "=" + val2];
87502         var count1 = tagCounts[key2 + "=" + val12];
87503         if (count2 !== count1) {
87504           return count2 - count1;
87505         }
87506         if (val2 && val12) {
87507           return val12.localeCompare(val2);
87508         }
87509         return val12 ? 1 : -1;
87510       });
87511     }
87512     tags = Object.defineProperty(tags, Symbol.for("allTags"), { enumerable: false, value: allTags });
87513     return tags;
87514   }
87515   function utilStringQs(str) {
87516     str = str.replace(/^[#?]{0,2}/, "");
87517     return Object.fromEntries(new URLSearchParams(str));
87518   }
87519   function utilQsString(obj, softEncode) {
87520     let str = new URLSearchParams(obj).toString();
87521     if (softEncode) {
87522       str = str.replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
87523     }
87524     return str;
87525   }
87526   function utilPrefixDOMProperty(property) {
87527     var prefixes2 = ["webkit", "ms", "moz", "o"];
87528     var i3 = -1;
87529     var n3 = prefixes2.length;
87530     var s2 = document.body;
87531     if (property in s2) return property;
87532     property = property.slice(0, 1).toUpperCase() + property.slice(1);
87533     while (++i3 < n3) {
87534       if (prefixes2[i3] + property in s2) {
87535         return prefixes2[i3] + property;
87536       }
87537     }
87538     return false;
87539   }
87540   function utilPrefixCSSProperty(property) {
87541     var prefixes2 = ["webkit", "ms", "Moz", "O"];
87542     var i3 = -1;
87543     var n3 = prefixes2.length;
87544     var s2 = document.body.style;
87545     if (property.toLowerCase() in s2) {
87546       return property.toLowerCase();
87547     }
87548     while (++i3 < n3) {
87549       if (prefixes2[i3] + property in s2) {
87550         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
87551       }
87552     }
87553     return false;
87554   }
87555   function utilSetTransform(el, x2, y2, scale) {
87556     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
87557     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
87558     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
87559   }
87560   function utilEditDistance(a4, b3) {
87561     a4 = (0, import_diacritics3.remove)(a4.toLowerCase());
87562     b3 = (0, import_diacritics3.remove)(b3.toLowerCase());
87563     if (a4.length === 0) return b3.length;
87564     if (b3.length === 0) return a4.length;
87565     var matrix = [];
87566     var i3, j3;
87567     for (i3 = 0; i3 <= b3.length; i3++) {
87568       matrix[i3] = [i3];
87569     }
87570     for (j3 = 0; j3 <= a4.length; j3++) {
87571       matrix[0][j3] = j3;
87572     }
87573     for (i3 = 1; i3 <= b3.length; i3++) {
87574       for (j3 = 1; j3 <= a4.length; j3++) {
87575         if (b3.charAt(i3 - 1) === a4.charAt(j3 - 1)) {
87576           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
87577         } else {
87578           matrix[i3][j3] = Math.min(
87579             matrix[i3 - 1][j3 - 1] + 1,
87580             // substitution
87581             Math.min(
87582               matrix[i3][j3 - 1] + 1,
87583               // insertion
87584               matrix[i3 - 1][j3] + 1
87585             )
87586           );
87587         }
87588       }
87589     }
87590     return matrix[b3.length][a4.length];
87591   }
87592   function utilFastMouse(container) {
87593     var rect = container.getBoundingClientRect();
87594     var rectLeft = rect.left;
87595     var rectTop = rect.top;
87596     var clientLeft = +container.clientLeft;
87597     var clientTop = +container.clientTop;
87598     return function(e3) {
87599       return [
87600         e3.clientX - rectLeft - clientLeft,
87601         e3.clientY - rectTop - clientTop
87602       ];
87603     };
87604   }
87605   function utilAsyncMap(inputs, func, callback) {
87606     var remaining = inputs.length;
87607     var results = [];
87608     var errors = [];
87609     inputs.forEach(function(d2, i3) {
87610       func(d2, function done(err, data) {
87611         errors[i3] = err;
87612         results[i3] = data;
87613         remaining--;
87614         if (!remaining) callback(errors, results);
87615       });
87616     });
87617   }
87618   function utilWrap(index, length2) {
87619     if (index < 0) {
87620       index += Math.ceil(-index / length2) * length2;
87621     }
87622     return index % length2;
87623   }
87624   function utilFunctor(value) {
87625     if (typeof value === "function") return value;
87626     return function() {
87627       return value;
87628     };
87629   }
87630   function utilNoAuto(selection2) {
87631     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
87632     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("data-1p-ignore", "true").attr("data-bwignore", "true").attr("data-form-type", "other").attr("data-lpignore", "true").attr("spellcheck", isText ? "true" : "false");
87633   }
87634   function utilHashcode(str) {
87635     var hash2 = 0;
87636     if (str.length === 0) {
87637       return hash2;
87638     }
87639     for (var i3 = 0; i3 < str.length; i3++) {
87640       var char = str.charCodeAt(i3);
87641       hash2 = (hash2 << 5) - hash2 + char;
87642       hash2 = hash2 & hash2;
87643     }
87644     return hash2;
87645   }
87646   function utilSafeClassName(str) {
87647     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
87648   }
87649   function utilUniqueDomId(val) {
87650     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
87651   }
87652   function utilUnicodeCharsCount(str) {
87653     return Array.from(str).length;
87654   }
87655   function utilUnicodeCharsTruncated(str, limit) {
87656     return Array.from(str).slice(0, limit).join("");
87657   }
87658   function toNumericID(id2) {
87659     var match = id2.match(/^[cnwr](-?\d+)$/);
87660     if (match) {
87661       return parseInt(match[1], 10);
87662     }
87663     return NaN;
87664   }
87665   function compareNumericIDs(left, right) {
87666     if (isNaN(left) && isNaN(right)) return -1;
87667     if (isNaN(left)) return 1;
87668     if (isNaN(right)) return -1;
87669     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
87670     if (Math.sign(left) < 0) return Math.sign(right - left);
87671     return Math.sign(left - right);
87672   }
87673   function utilCompareIDs(left, right) {
87674     return compareNumericIDs(toNumericID(left), toNumericID(right));
87675   }
87676   function utilOldestID(ids) {
87677     if (ids.length === 0) {
87678       return void 0;
87679     }
87680     var oldestIDIndex = 0;
87681     var oldestID = toNumericID(ids[0]);
87682     for (var i3 = 1; i3 < ids.length; i3++) {
87683       var num = toNumericID(ids[i3]);
87684       if (compareNumericIDs(oldestID, num) === 1) {
87685         oldestIDIndex = i3;
87686         oldestID = num;
87687       }
87688     }
87689     return ids[oldestIDIndex];
87690   }
87691   function utilCleanOsmString(val, maxChars) {
87692     if (val === void 0 || val === null) {
87693       val = "";
87694     } else {
87695       val = val.toString();
87696     }
87697     val = val.trim();
87698     if (val.normalize) val = val.normalize("NFC");
87699     return utilUnicodeCharsTruncated(val, maxChars);
87700   }
87701   var import_diacritics3, transformProperty;
87702   var init_util2 = __esm({
87703     "modules/util/util.js"() {
87704       "use strict";
87705       import_diacritics3 = __toESM(require_diacritics());
87706       init_svg_paths_rtl_fix();
87707       init_localizer();
87708       init_array3();
87709       init_detect();
87710       init_extent();
87711     }
87712   });
87713
87714   // modules/osm/entity.js
87715   var entity_exports = {};
87716   __export(entity_exports, {
87717     osmEntity: () => osmEntity
87718   });
87719   function osmEntity(attrs) {
87720     if (this instanceof osmEntity) return;
87721     if (attrs && attrs.type) {
87722       return osmEntity[attrs.type].apply(this, arguments);
87723     } else if (attrs && attrs.id) {
87724       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
87725     }
87726     return new osmEntity().initialize(arguments);
87727   }
87728   var init_entity = __esm({
87729     "modules/osm/entity.js"() {
87730       "use strict";
87731       init_index();
87732       init_tags();
87733       init_array3();
87734       init_util2();
87735       osmEntity.id = function(type2) {
87736         return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
87737       };
87738       osmEntity.id.next = {
87739         changeset: -1,
87740         node: -1,
87741         way: -1,
87742         relation: -1
87743       };
87744       osmEntity.id.fromOSM = function(type2, id2) {
87745         return type2[0] + id2;
87746       };
87747       osmEntity.id.toOSM = function(id2) {
87748         var match = id2.match(/^[cnwr](-?\d+)$/);
87749         if (match) {
87750           return match[1];
87751         }
87752         return "";
87753       };
87754       osmEntity.id.type = function(id2) {
87755         return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
87756       };
87757       osmEntity.key = function(entity) {
87758         return entity.id + "v" + (entity.v || 0);
87759       };
87760       osmEntity.prototype = {
87761         /** @type {Tags} */
87762         tags: {},
87763         /** @type {String} */
87764         id: void 0,
87765         initialize: function(sources) {
87766           for (var i3 = 0; i3 < sources.length; ++i3) {
87767             var source = sources[i3];
87768             for (var prop in source) {
87769               if (Object.prototype.hasOwnProperty.call(source, prop)) {
87770                 if (source[prop] === void 0) {
87771                   delete this[prop];
87772                 } else {
87773                   this[prop] = source[prop];
87774                 }
87775               }
87776             }
87777           }
87778           if (!this.id && this.type) {
87779             this.id = osmEntity.id(this.type);
87780           }
87781           if (!this.hasOwnProperty("visible")) {
87782             this.visible = true;
87783           }
87784           if (debug) {
87785             Object.freeze(this);
87786             Object.freeze(this.tags);
87787             if (this.loc) Object.freeze(this.loc);
87788             if (this.nodes) Object.freeze(this.nodes);
87789             if (this.members) Object.freeze(this.members);
87790           }
87791           return this;
87792         },
87793         copy: function(resolver, copies) {
87794           if (copies[this.id]) return copies[this.id];
87795           var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
87796           copies[this.id] = copy2;
87797           return copy2;
87798         },
87799         osmId: function() {
87800           return osmEntity.id.toOSM(this.id);
87801         },
87802         isNew: function() {
87803           var osmId = osmEntity.id.toOSM(this.id);
87804           return osmId.length === 0 || osmId[0] === "-";
87805         },
87806         update: function(attrs) {
87807           return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
87808         },
87809         /**
87810          *
87811          * @param {Tags} tags tags to merge into this entity's tags
87812          * @param {Tags} setTags (optional) a set of tags to overwrite in this entity's tags
87813          * @returns {iD.OsmEntity}
87814          */
87815         mergeTags: function(tags, setTags = {}) {
87816           const merged = Object.assign({}, this.tags);
87817           let changed = false;
87818           for (const k3 in tags) {
87819             if (setTags.hasOwnProperty(k3)) continue;
87820             const t12 = this.tags[k3];
87821             const t2 = tags[k3];
87822             if (!t12) {
87823               changed = true;
87824               merged[k3] = t2;
87825             } else if (t12 !== t2) {
87826               changed = true;
87827               merged[k3] = utilUnicodeCharsTruncated(
87828                 utilArrayUnion(t12.split(/;\s*/), t2.split(/;\s*/)).join(";"),
87829                 255
87830                 // avoid exceeding character limit; see also context.maxCharsForTagValue()
87831               );
87832             }
87833           }
87834           for (const k3 in setTags) {
87835             if (this.tags[k3] !== setTags[k3]) {
87836               changed = true;
87837               merged[k3] = setTags[k3];
87838             }
87839           }
87840           return changed ? this.update({ tags: merged }) : this;
87841         },
87842         intersects: function(extent, resolver) {
87843           return this.extent(resolver).intersects(extent);
87844         },
87845         hasNonGeometryTags: function() {
87846           return Object.keys(this.tags).some(function(k3) {
87847             return k3 !== "area";
87848           });
87849         },
87850         hasParentRelations: function(resolver) {
87851           return resolver.parentRelations(this).length > 0;
87852         },
87853         hasInterestingTags: function() {
87854           return Object.keys(this.tags).some(osmIsInterestingTag);
87855         },
87856         isDegenerate: function() {
87857           return true;
87858         }
87859       };
87860     }
87861   });
87862
87863   // modules/osm/way.js
87864   var way_exports = {};
87865   __export(way_exports, {
87866     osmWay: () => osmWay
87867   });
87868   function osmWay() {
87869     if (!(this instanceof osmWay)) {
87870       return new osmWay().initialize(arguments);
87871     } else if (arguments.length) {
87872       this.initialize(arguments);
87873     }
87874   }
87875   function noRepeatNodes(node, i3, arr) {
87876     return i3 === 0 || node !== arr[i3 - 1];
87877   }
87878   var prototype3;
87879   var init_way = __esm({
87880     "modules/osm/way.js"() {
87881       "use strict";
87882       init_src2();
87883       init_geo2();
87884       init_entity();
87885       init_lanes();
87886       init_tags();
87887       init_util();
87888       osmEntity.way = osmWay;
87889       osmWay.prototype = Object.create(osmEntity.prototype);
87890       prototype3 = {
87891         type: "way",
87892         nodes: [],
87893         copy: function(resolver, copies) {
87894           if (copies[this.id]) return copies[this.id];
87895           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
87896           var nodes = this.nodes.map(function(id2) {
87897             return resolver.entity(id2).copy(resolver, copies).id;
87898           });
87899           copy2 = copy2.update({ nodes });
87900           copies[this.id] = copy2;
87901           return copy2;
87902         },
87903         extent: function(resolver) {
87904           return resolver.transient(this, "extent", function() {
87905             var extent = geoExtent();
87906             for (var i3 = 0; i3 < this.nodes.length; i3++) {
87907               var node = resolver.hasEntity(this.nodes[i3]);
87908               if (node) {
87909                 extent._extend(node.extent());
87910               }
87911             }
87912             return extent;
87913           });
87914         },
87915         first: function() {
87916           return this.nodes[0];
87917         },
87918         last: function() {
87919           return this.nodes[this.nodes.length - 1];
87920         },
87921         contains: function(node) {
87922           return this.nodes.indexOf(node) >= 0;
87923         },
87924         affix: function(node) {
87925           if (this.nodes[0] === node) return "prefix";
87926           if (this.nodes[this.nodes.length - 1] === node) return "suffix";
87927         },
87928         layer: function() {
87929           if (isFinite(this.tags.layer)) {
87930             return Math.max(-10, Math.min(+this.tags.layer, 10));
87931           }
87932           if (this.tags.covered === "yes") return -1;
87933           if (this.tags.location === "overground") return 1;
87934           if (this.tags.location === "underground") return -1;
87935           if (this.tags.location === "underwater") return -10;
87936           if (this.tags.power === "line") return 10;
87937           if (this.tags.power === "minor_line") return 10;
87938           if (this.tags.aerialway) return 10;
87939           if (this.tags.bridge) return 1;
87940           if (this.tags.cutting) return -1;
87941           if (this.tags.tunnel) return -1;
87942           if (this.tags.waterway) return -1;
87943           if (this.tags.man_made === "pipeline") return -10;
87944           if (this.tags.boundary) return -10;
87945           return 0;
87946         },
87947         // the approximate width of the line based on its tags except its `width` tag
87948         impliedLineWidthMeters: function() {
87949           var averageWidths = {
87950             highway: {
87951               // width is for single lane
87952               motorway: 5,
87953               motorway_link: 5,
87954               trunk: 4.5,
87955               trunk_link: 4.5,
87956               primary: 4,
87957               secondary: 4,
87958               tertiary: 4,
87959               primary_link: 4,
87960               secondary_link: 4,
87961               tertiary_link: 4,
87962               unclassified: 4,
87963               road: 4,
87964               living_street: 4,
87965               bus_guideway: 4,
87966               busway: 4,
87967               pedestrian: 4,
87968               residential: 3.5,
87969               service: 3.5,
87970               track: 3,
87971               cycleway: 2.5,
87972               bridleway: 2,
87973               corridor: 2,
87974               steps: 2,
87975               path: 1.5,
87976               footway: 1.5,
87977               ladder: 0.5
87978             },
87979             railway: {
87980               // width includes ties and rail bed, not just track gauge
87981               rail: 2.5,
87982               light_rail: 2.5,
87983               tram: 2.5,
87984               subway: 2.5,
87985               monorail: 2.5,
87986               funicular: 2.5,
87987               disused: 2.5,
87988               preserved: 2.5,
87989               miniature: 1.5,
87990               narrow_gauge: 1.5
87991             },
87992             waterway: {
87993               river: 50,
87994               canal: 25,
87995               stream: 5,
87996               tidal_channel: 5,
87997               fish_pass: 2.5,
87998               drain: 2.5,
87999               ditch: 1.5
88000             }
88001           };
88002           for (var key in averageWidths) {
88003             if (this.tags[key] && averageWidths[key][this.tags[key]]) {
88004               var width = averageWidths[key][this.tags[key]];
88005               if (key === "highway") {
88006                 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
88007                 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
88008                 return width * laneCount;
88009               }
88010               return width;
88011             }
88012           }
88013           return null;
88014         },
88015         /** @returns {boolean} for example, if `oneway=yes` */
88016         isOneWayForwards() {
88017           if (this.tags.oneway === "no") return false;
88018           return !!utilCheckTagDictionary(this.tags, osmOneWayForwardTags);
88019         },
88020         /** @returns {boolean} for example, if `oneway=-1` */
88021         isOneWayBackwards() {
88022           if (this.tags.oneway === "no") return false;
88023           return !!utilCheckTagDictionary(this.tags, osmOneWayBackwardTags);
88024         },
88025         /** @returns {boolean} for example, if `oneway=alternating` */
88026         isBiDirectional() {
88027           if (this.tags.oneway === "no") return false;
88028           return !!utilCheckTagDictionary(this.tags, osmOneWayBiDirectionalTags);
88029         },
88030         /** @returns {boolean} */
88031         isOneWay() {
88032           if (this.tags.oneway === "no") return false;
88033           return !!utilCheckTagDictionary(this.tags, osmOneWayTags);
88034         },
88035         // Some identifier for tag that implies that this way is "sided",
88036         // i.e. the right side is the 'inside' (e.g. the right side of a
88037         // natural=cliff is lower).
88038         sidednessIdentifier: function() {
88039           for (const realKey in this.tags) {
88040             const value = this.tags[realKey];
88041             const key = osmRemoveLifecyclePrefix(realKey);
88042             if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
88043               if (osmRightSideIsInsideTags[key][value] === true) {
88044                 return key;
88045               } else {
88046                 return osmRightSideIsInsideTags[key][value];
88047               }
88048             }
88049           }
88050           return null;
88051         },
88052         isSided: function() {
88053           if (this.tags.two_sided === "yes") {
88054             return false;
88055           }
88056           return this.sidednessIdentifier() !== null;
88057         },
88058         lanes: function() {
88059           return osmLanes(this);
88060         },
88061         isClosed: function() {
88062           return this.nodes.length > 1 && this.first() === this.last();
88063         },
88064         isConvex: function(resolver) {
88065           if (!this.isClosed() || this.isDegenerate()) return null;
88066           var nodes = utilArrayUniq(resolver.childNodes(this));
88067           var coords = nodes.map(function(n3) {
88068             return n3.loc;
88069           });
88070           var curr = 0;
88071           var prev = 0;
88072           for (var i3 = 0; i3 < coords.length; i3++) {
88073             var o2 = coords[(i3 + 1) % coords.length];
88074             var a4 = coords[i3];
88075             var b3 = coords[(i3 + 2) % coords.length];
88076             var res = geoVecCross(a4, b3, o2);
88077             curr = res > 0 ? 1 : res < 0 ? -1 : 0;
88078             if (curr === 0) {
88079               continue;
88080             } else if (prev && curr !== prev) {
88081               return false;
88082             }
88083             prev = curr;
88084           }
88085           return true;
88086         },
88087         // returns an object with the tag that implies this is an area, if any
88088         tagSuggestingArea: function() {
88089           return osmTagSuggestingArea(this.tags);
88090         },
88091         isArea: function() {
88092           if (this.tags.area === "yes") return true;
88093           if (!this.isClosed() || this.tags.area === "no") return false;
88094           return this.tagSuggestingArea() !== null;
88095         },
88096         isDegenerate: function() {
88097           return new Set(this.nodes).size < (this.isClosed() ? 3 : 2);
88098         },
88099         areAdjacent: function(n1, n22) {
88100           for (var i3 = 0; i3 < this.nodes.length; i3++) {
88101             if (this.nodes[i3] === n1) {
88102               if (this.nodes[i3 - 1] === n22) return true;
88103               if (this.nodes[i3 + 1] === n22) return true;
88104             }
88105           }
88106           return false;
88107         },
88108         geometry: function(graph) {
88109           return graph.transient(this, "geometry", function() {
88110             return this.isArea() ? "area" : "line";
88111           });
88112         },
88113         // returns an array of objects representing the segments between the nodes in this way
88114         segments: function(graph) {
88115           function segmentExtent(graph2) {
88116             var n1 = graph2.hasEntity(this.nodes[0]);
88117             var n22 = graph2.hasEntity(this.nodes[1]);
88118             return n1 && n22 && geoExtent([
88119               [
88120                 Math.min(n1.loc[0], n22.loc[0]),
88121                 Math.min(n1.loc[1], n22.loc[1])
88122               ],
88123               [
88124                 Math.max(n1.loc[0], n22.loc[0]),
88125                 Math.max(n1.loc[1], n22.loc[1])
88126               ]
88127             ]);
88128           }
88129           return graph.transient(this, "segments", function() {
88130             var segments = [];
88131             for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
88132               segments.push({
88133                 id: this.id + "-" + i3,
88134                 wayId: this.id,
88135                 index: i3,
88136                 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
88137                 extent: segmentExtent
88138               });
88139             }
88140             return segments;
88141           });
88142         },
88143         // If this way is not closed, append the beginning node to the end of the nodelist to close it.
88144         close: function() {
88145           if (this.isClosed() || !this.nodes.length) return this;
88146           var nodes = this.nodes.slice();
88147           nodes = nodes.filter(noRepeatNodes);
88148           nodes.push(nodes[0]);
88149           return this.update({ nodes });
88150         },
88151         // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
88152         unclose: function() {
88153           if (!this.isClosed()) return this;
88154           var nodes = this.nodes.slice();
88155           var connector = this.first();
88156           var i3 = nodes.length - 1;
88157           while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88158             nodes.splice(i3, 1);
88159             i3 = nodes.length - 1;
88160           }
88161           nodes = nodes.filter(noRepeatNodes);
88162           return this.update({ nodes });
88163         },
88164         // Adds a node (id) in front of the node which is currently at position index.
88165         // If index is undefined, the node will be added to the end of the way for linear ways,
88166         //   or just before the final connecting node for circular ways.
88167         // Consecutive duplicates are eliminated including existing ones.
88168         // Circularity is always preserved when adding a node.
88169         addNode: function(id2, index) {
88170           var nodes = this.nodes.slice();
88171           var isClosed = this.isClosed();
88172           var max3 = isClosed ? nodes.length - 1 : nodes.length;
88173           if (index === void 0) {
88174             index = max3;
88175           }
88176           if (index < 0 || index > max3) {
88177             throw new RangeError("index " + index + " out of range 0.." + max3);
88178           }
88179           if (isClosed) {
88180             var connector = this.first();
88181             var i3 = 1;
88182             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88183               nodes.splice(i3, 1);
88184               if (index > i3) index--;
88185             }
88186             i3 = nodes.length - 1;
88187             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88188               nodes.splice(i3, 1);
88189               if (index > i3) index--;
88190               i3 = nodes.length - 1;
88191             }
88192           }
88193           nodes.splice(index, 0, id2);
88194           nodes = nodes.filter(noRepeatNodes);
88195           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88196             nodes.push(nodes[0]);
88197           }
88198           return this.update({ nodes });
88199         },
88200         // Replaces the node which is currently at position index with the given node (id).
88201         // Consecutive duplicates are eliminated including existing ones.
88202         // Circularity is preserved when updating a node.
88203         updateNode: function(id2, index) {
88204           var nodes = this.nodes.slice();
88205           var isClosed = this.isClosed();
88206           var max3 = nodes.length - 1;
88207           if (index === void 0 || index < 0 || index > max3) {
88208             throw new RangeError("index " + index + " out of range 0.." + max3);
88209           }
88210           if (isClosed) {
88211             var connector = this.first();
88212             var i3 = 1;
88213             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
88214               nodes.splice(i3, 1);
88215               if (index > i3) index--;
88216             }
88217             i3 = nodes.length - 1;
88218             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
88219               nodes.splice(i3, 1);
88220               if (index === i3) index = 0;
88221               i3 = nodes.length - 1;
88222             }
88223           }
88224           nodes.splice(index, 1, id2);
88225           nodes = nodes.filter(noRepeatNodes);
88226           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88227             nodes.push(nodes[0]);
88228           }
88229           return this.update({ nodes });
88230         },
88231         // Replaces each occurrence of node id needle with replacement.
88232         // Consecutive duplicates are eliminated including existing ones.
88233         // Circularity is preserved.
88234         replaceNode: function(needleID, replacementID) {
88235           var nodes = this.nodes.slice();
88236           var isClosed = this.isClosed();
88237           for (var i3 = 0; i3 < nodes.length; i3++) {
88238             if (nodes[i3] === needleID) {
88239               nodes[i3] = replacementID;
88240             }
88241           }
88242           nodes = nodes.filter(noRepeatNodes);
88243           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88244             nodes.push(nodes[0]);
88245           }
88246           return this.update({ nodes });
88247         },
88248         // Removes each occurrence of node id.
88249         // Consecutive duplicates are eliminated including existing ones.
88250         // Circularity is preserved.
88251         removeNode: function(id2) {
88252           var nodes = this.nodes.slice();
88253           var isClosed = this.isClosed();
88254           nodes = nodes.filter(function(node) {
88255             return node !== id2;
88256           }).filter(noRepeatNodes);
88257           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
88258             nodes.push(nodes[0]);
88259           }
88260           return this.update({ nodes });
88261         },
88262         asJXON: function(changeset_id) {
88263           var r2 = {
88264             way: {
88265               "@id": this.osmId(),
88266               "@version": this.version || 0,
88267               nd: this.nodes.map(function(id2) {
88268                 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
88269               }, this),
88270               tag: Object.keys(this.tags).map(function(k3) {
88271                 return { keyAttributes: { k: k3, v: this.tags[k3] } };
88272               }, this)
88273             }
88274           };
88275           if (changeset_id) {
88276             r2.way["@changeset"] = changeset_id;
88277           }
88278           return r2;
88279         },
88280         asGeoJSON: function(resolver) {
88281           return resolver.transient(this, "GeoJSON", function() {
88282             var coordinates = resolver.childNodes(this).map(function(n3) {
88283               return n3.loc;
88284             });
88285             if (this.isArea() && this.isClosed()) {
88286               return {
88287                 type: "Polygon",
88288                 coordinates: [coordinates]
88289               };
88290             } else {
88291               return {
88292                 type: "LineString",
88293                 coordinates
88294               };
88295             }
88296           });
88297         },
88298         area: function(resolver) {
88299           return resolver.transient(this, "area", function() {
88300             var nodes = resolver.childNodes(this);
88301             var json = {
88302               type: "Polygon",
88303               coordinates: [nodes.map(function(n3) {
88304                 return n3.loc;
88305               })]
88306             };
88307             if (!this.isClosed() && nodes.length) {
88308               json.coordinates[0].push(nodes[0].loc);
88309             }
88310             var area = area_default(json);
88311             if (area > 2 * Math.PI) {
88312               json.coordinates[0] = json.coordinates[0].reverse();
88313               area = area_default(json);
88314             }
88315             return isNaN(area) ? 0 : area;
88316           });
88317         }
88318       };
88319       Object.assign(osmWay.prototype, prototype3);
88320     }
88321   });
88322
88323   // modules/osm/multipolygon.js
88324   var multipolygon_exports = {};
88325   __export(multipolygon_exports, {
88326     osmJoinWays: () => osmJoinWays
88327   });
88328   function osmJoinWays(toJoin, graph) {
88329     function resolve(member) {
88330       return graph.childNodes(graph.entity(member.id));
88331     }
88332     function reverse(item2) {
88333       var action = actionReverse(item2.id, { reverseOneway: true });
88334       sequences.actions.push(action);
88335       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
88336     }
88337     toJoin = toJoin.filter(function(member) {
88338       return member.type === "way" && graph.hasEntity(member.id);
88339     });
88340     var i3;
88341     var joinAsMembers = true;
88342     for (i3 = 0; i3 < toJoin.length; i3++) {
88343       if (toJoin[i3] instanceof osmWay) {
88344         joinAsMembers = false;
88345         break;
88346       }
88347     }
88348     var sequences = [];
88349     sequences.actions = [];
88350     while (toJoin.length) {
88351       var item = toJoin.shift();
88352       var currWays = [item];
88353       var currNodes = resolve(item).slice();
88354       while (toJoin.length) {
88355         var start2 = currNodes[0];
88356         var end = currNodes[currNodes.length - 1];
88357         var fn = null;
88358         var nodes = null;
88359         for (i3 = 0; i3 < toJoin.length; i3++) {
88360           item = toJoin[i3];
88361           nodes = resolve(item);
88362           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
88363             currWays[0] = reverse(currWays[0]);
88364             currNodes.reverse();
88365             start2 = currNodes[0];
88366             end = currNodes[currNodes.length - 1];
88367           }
88368           if (nodes[0] === end) {
88369             fn = currNodes.push;
88370             nodes = nodes.slice(1);
88371             break;
88372           } else if (nodes[nodes.length - 1] === end) {
88373             fn = currNodes.push;
88374             nodes = nodes.slice(0, -1).reverse();
88375             item = reverse(item);
88376             break;
88377           } else if (nodes[nodes.length - 1] === start2) {
88378             fn = currNodes.unshift;
88379             nodes = nodes.slice(0, -1);
88380             break;
88381           } else if (nodes[0] === start2) {
88382             fn = currNodes.unshift;
88383             nodes = nodes.slice(1).reverse();
88384             item = reverse(item);
88385             break;
88386           } else {
88387             fn = nodes = null;
88388           }
88389         }
88390         if (!nodes) {
88391           break;
88392         }
88393         fn.apply(currWays, [item]);
88394         fn.apply(currNodes, nodes);
88395         toJoin.splice(i3, 1);
88396       }
88397       currWays.nodes = currNodes;
88398       sequences.push(currWays);
88399     }
88400     return sequences;
88401   }
88402   var init_multipolygon = __esm({
88403     "modules/osm/multipolygon.js"() {
88404       "use strict";
88405       init_reverse();
88406       init_way();
88407     }
88408   });
88409
88410   // modules/actions/add_member.js
88411   var add_member_exports = {};
88412   __export(add_member_exports, {
88413     actionAddMember: () => actionAddMember
88414   });
88415   function actionAddMember(relationId, member, memberIndex) {
88416     return function action(graph) {
88417       var relation = graph.entity(relationId);
88418       var isPTv2 = /stop|platform/.test(member.role);
88419       if (member.type === "way" && !isPTv2) {
88420         graph = addWayMember(relation, graph);
88421       } else {
88422         if (isPTv2 && isNaN(memberIndex)) {
88423           memberIndex = 0;
88424         }
88425         graph = graph.replace(relation.addMember(member, memberIndex));
88426       }
88427       return graph;
88428     };
88429     function addWayMember(relation, graph) {
88430       var groups, item, i3, j3, k3;
88431       var PTv2members = [];
88432       var members = [];
88433       for (i3 = 0; i3 < relation.members.length; i3++) {
88434         var m3 = relation.members[i3];
88435         if (/stop|platform/.test(m3.role)) {
88436           PTv2members.push(m3);
88437         } else {
88438           members.push(m3);
88439         }
88440       }
88441       relation = relation.update({ members });
88442       groups = utilArrayGroupBy(relation.members, "type");
88443       groups.way = groups.way || [];
88444       groups.way.push(member);
88445       members = withIndex(groups.way);
88446       var joined = osmJoinWays(members, graph);
88447       for (i3 = 0; i3 < joined.length; i3++) {
88448         var segment = joined[i3];
88449         var nodes = segment.nodes.slice();
88450         var startIndex = segment[0].index;
88451         for (j3 = 0; j3 < members.length; j3++) {
88452           if (members[j3].index === startIndex) {
88453             break;
88454           }
88455         }
88456         for (k3 = 0; k3 < segment.length; k3++) {
88457           item = segment[k3];
88458           var way = graph.entity(item.id);
88459           if (k3 > 0) {
88460             if (j3 + k3 >= members.length || item.index !== members[j3 + k3].index) {
88461               moveMember(members, item.index, j3 + k3);
88462             }
88463           }
88464           nodes.splice(0, way.nodes.length - 1);
88465         }
88466       }
88467       var wayMembers = [];
88468       for (i3 = 0; i3 < members.length; i3++) {
88469         item = members[i3];
88470         if (item.index === -1) continue;
88471         wayMembers.push(utilObjectOmit(item, ["index"]));
88472       }
88473       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
88474       return graph.replace(relation.update({ members: newMembers }));
88475       function moveMember(arr, findIndex, toIndex) {
88476         var i4;
88477         for (i4 = 0; i4 < arr.length; i4++) {
88478           if (arr[i4].index === findIndex) {
88479             break;
88480           }
88481         }
88482         var item2 = Object.assign({}, arr[i4]);
88483         arr[i4].index = -1;
88484         delete item2.index;
88485         arr.splice(toIndex, 0, item2);
88486       }
88487       function withIndex(arr) {
88488         var result = new Array(arr.length);
88489         for (var i4 = 0; i4 < arr.length; i4++) {
88490           result[i4] = Object.assign({}, arr[i4]);
88491           result[i4].index = i4;
88492         }
88493         return result;
88494       }
88495     }
88496   }
88497   var init_add_member = __esm({
88498     "modules/actions/add_member.js"() {
88499       "use strict";
88500       init_multipolygon();
88501       init_util();
88502     }
88503   });
88504
88505   // modules/actions/index.js
88506   var actions_exports = {};
88507   __export(actions_exports, {
88508     actionAddEntity: () => actionAddEntity,
88509     actionAddMember: () => actionAddMember,
88510     actionAddMidpoint: () => actionAddMidpoint,
88511     actionAddVertex: () => actionAddVertex,
88512     actionChangeMember: () => actionChangeMember,
88513     actionChangePreset: () => actionChangePreset,
88514     actionChangeTags: () => actionChangeTags,
88515     actionCircularize: () => actionCircularize,
88516     actionConnect: () => actionConnect,
88517     actionCopyEntities: () => actionCopyEntities,
88518     actionDeleteMember: () => actionDeleteMember,
88519     actionDeleteMultiple: () => actionDeleteMultiple,
88520     actionDeleteNode: () => actionDeleteNode,
88521     actionDeleteRelation: () => actionDeleteRelation,
88522     actionDeleteWay: () => actionDeleteWay,
88523     actionDiscardTags: () => actionDiscardTags,
88524     actionDisconnect: () => actionDisconnect,
88525     actionExtract: () => actionExtract,
88526     actionJoin: () => actionJoin,
88527     actionMerge: () => actionMerge,
88528     actionMergeNodes: () => actionMergeNodes,
88529     actionMergePolygon: () => actionMergePolygon,
88530     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88531     actionMove: () => actionMove,
88532     actionMoveMember: () => actionMoveMember,
88533     actionMoveNode: () => actionMoveNode,
88534     actionNoop: () => actionNoop,
88535     actionOrthogonalize: () => actionOrthogonalize,
88536     actionReflect: () => actionReflect,
88537     actionRestrictTurn: () => actionRestrictTurn,
88538     actionReverse: () => actionReverse,
88539     actionRevert: () => actionRevert,
88540     actionRotate: () => actionRotate,
88541     actionScale: () => actionScale,
88542     actionSplit: () => actionSplit,
88543     actionStraightenNodes: () => actionStraightenNodes,
88544     actionStraightenWay: () => actionStraightenWay,
88545     actionUnrestrictTurn: () => actionUnrestrictTurn,
88546     actionUpgradeTags: () => actionUpgradeTags
88547   });
88548   var init_actions = __esm({
88549     "modules/actions/index.js"() {
88550       "use strict";
88551       init_add_entity();
88552       init_add_member();
88553       init_add_midpoint();
88554       init_add_vertex();
88555       init_change_member();
88556       init_change_preset();
88557       init_change_tags();
88558       init_circularize();
88559       init_connect();
88560       init_copy_entities();
88561       init_delete_member();
88562       init_delete_multiple();
88563       init_delete_node();
88564       init_delete_relation();
88565       init_delete_way();
88566       init_discard_tags();
88567       init_disconnect();
88568       init_extract();
88569       init_join2();
88570       init_merge5();
88571       init_merge_nodes();
88572       init_merge_polygon();
88573       init_merge_remote_changes();
88574       init_move();
88575       init_move_member();
88576       init_move_node();
88577       init_noop2();
88578       init_orthogonalize();
88579       init_restrict_turn();
88580       init_reverse();
88581       init_revert();
88582       init_rotate();
88583       init_scale();
88584       init_split();
88585       init_straighten_nodes();
88586       init_straighten_way();
88587       init_unrestrict_turn();
88588       init_reflect();
88589       init_upgrade_tags();
88590     }
88591   });
88592
88593   // modules/index.js
88594   var index_exports = {};
88595   __export(index_exports, {
88596     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
88597     LocationManager: () => LocationManager,
88598     QAItem: () => QAItem,
88599     actionAddEntity: () => actionAddEntity,
88600     actionAddMember: () => actionAddMember,
88601     actionAddMidpoint: () => actionAddMidpoint,
88602     actionAddVertex: () => actionAddVertex,
88603     actionChangeMember: () => actionChangeMember,
88604     actionChangePreset: () => actionChangePreset,
88605     actionChangeTags: () => actionChangeTags,
88606     actionCircularize: () => actionCircularize,
88607     actionConnect: () => actionConnect,
88608     actionCopyEntities: () => actionCopyEntities,
88609     actionDeleteMember: () => actionDeleteMember,
88610     actionDeleteMultiple: () => actionDeleteMultiple,
88611     actionDeleteNode: () => actionDeleteNode,
88612     actionDeleteRelation: () => actionDeleteRelation,
88613     actionDeleteWay: () => actionDeleteWay,
88614     actionDiscardTags: () => actionDiscardTags,
88615     actionDisconnect: () => actionDisconnect,
88616     actionExtract: () => actionExtract,
88617     actionJoin: () => actionJoin,
88618     actionMerge: () => actionMerge,
88619     actionMergeNodes: () => actionMergeNodes,
88620     actionMergePolygon: () => actionMergePolygon,
88621     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
88622     actionMove: () => actionMove,
88623     actionMoveMember: () => actionMoveMember,
88624     actionMoveNode: () => actionMoveNode,
88625     actionNoop: () => actionNoop,
88626     actionOrthogonalize: () => actionOrthogonalize,
88627     actionReflect: () => actionReflect,
88628     actionRestrictTurn: () => actionRestrictTurn,
88629     actionReverse: () => actionReverse,
88630     actionRevert: () => actionRevert,
88631     actionRotate: () => actionRotate,
88632     actionScale: () => actionScale,
88633     actionSplit: () => actionSplit,
88634     actionStraightenNodes: () => actionStraightenNodes,
88635     actionStraightenWay: () => actionStraightenWay,
88636     actionUnrestrictTurn: () => actionUnrestrictTurn,
88637     actionUpgradeTags: () => actionUpgradeTags,
88638     behaviorAddWay: () => behaviorAddWay,
88639     behaviorBreathe: () => behaviorBreathe,
88640     behaviorDrag: () => behaviorDrag,
88641     behaviorDraw: () => behaviorDraw,
88642     behaviorDrawWay: () => behaviorDrawWay,
88643     behaviorEdit: () => behaviorEdit,
88644     behaviorHash: () => behaviorHash,
88645     behaviorHover: () => behaviorHover,
88646     behaviorLasso: () => behaviorLasso,
88647     behaviorOperation: () => behaviorOperation,
88648     behaviorPaste: () => behaviorPaste,
88649     behaviorSelect: () => behaviorSelect,
88650     coreContext: () => coreContext,
88651     coreDifference: () => coreDifference,
88652     coreFileFetcher: () => coreFileFetcher,
88653     coreGraph: () => coreGraph,
88654     coreHistory: () => coreHistory,
88655     coreLocalizer: () => coreLocalizer,
88656     coreTree: () => coreTree,
88657     coreUploader: () => coreUploader,
88658     coreValidator: () => coreValidator,
88659     d3: () => d3,
88660     debug: () => debug,
88661     dmsCoordinatePair: () => dmsCoordinatePair,
88662     dmsMatcher: () => dmsMatcher,
88663     fileFetcher: () => _mainFileFetcher,
88664     geoAngle: () => geoAngle,
88665     geoChooseEdge: () => geoChooseEdge,
88666     geoEdgeEqual: () => geoEdgeEqual,
88667     geoExtent: () => geoExtent,
88668     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
88669     geoHasLineIntersections: () => geoHasLineIntersections,
88670     geoHasSelfIntersections: () => geoHasSelfIntersections,
88671     geoLatToMeters: () => geoLatToMeters,
88672     geoLineIntersection: () => geoLineIntersection,
88673     geoLonToMeters: () => geoLonToMeters,
88674     geoMetersToLat: () => geoMetersToLat,
88675     geoMetersToLon: () => geoMetersToLon,
88676     geoMetersToOffset: () => geoMetersToOffset,
88677     geoOffsetToMeters: () => geoOffsetToMeters,
88678     geoOrthoCalcScore: () => geoOrthoCalcScore,
88679     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
88680     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
88681     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
88682     geoPathHasIntersections: () => geoPathHasIntersections,
88683     geoPathIntersections: () => geoPathIntersections,
88684     geoPathLength: () => geoPathLength,
88685     geoPointInPolygon: () => geoPointInPolygon,
88686     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
88687     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
88688     geoRawMercator: () => geoRawMercator,
88689     geoRotate: () => geoRotate,
88690     geoScaleToZoom: () => geoScaleToZoom,
88691     geoSphericalClosestNode: () => geoSphericalClosestNode,
88692     geoSphericalDistance: () => geoSphericalDistance,
88693     geoVecAdd: () => geoVecAdd,
88694     geoVecAngle: () => geoVecAngle,
88695     geoVecCross: () => geoVecCross,
88696     geoVecDot: () => geoVecDot,
88697     geoVecEqual: () => geoVecEqual,
88698     geoVecFloor: () => geoVecFloor,
88699     geoVecInterp: () => geoVecInterp,
88700     geoVecLength: () => geoVecLength,
88701     geoVecLengthSquare: () => geoVecLengthSquare,
88702     geoVecNormalize: () => geoVecNormalize,
88703     geoVecNormalizedDot: () => geoVecNormalizedDot,
88704     geoVecProject: () => geoVecProject,
88705     geoVecScale: () => geoVecScale,
88706     geoVecSubtract: () => geoVecSubtract,
88707     geoViewportEdge: () => geoViewportEdge,
88708     geoZoomToScale: () => geoZoomToScale,
88709     likelyRawNumberFormat: () => likelyRawNumberFormat,
88710     localizer: () => _mainLocalizer,
88711     locationManager: () => _sharedLocationManager,
88712     modeAddArea: () => modeAddArea,
88713     modeAddLine: () => modeAddLine,
88714     modeAddNote: () => modeAddNote,
88715     modeAddPoint: () => modeAddPoint,
88716     modeBrowse: () => modeBrowse,
88717     modeDragNode: () => modeDragNode,
88718     modeDragNote: () => modeDragNote,
88719     modeDrawArea: () => modeDrawArea,
88720     modeDrawLine: () => modeDrawLine,
88721     modeMove: () => modeMove,
88722     modeRotate: () => modeRotate,
88723     modeSave: () => modeSave,
88724     modeSelect: () => modeSelect,
88725     modeSelectData: () => modeSelectData,
88726     modeSelectError: () => modeSelectError,
88727     modeSelectNote: () => modeSelectNote,
88728     operationCircularize: () => operationCircularize,
88729     operationContinue: () => operationContinue,
88730     operationCopy: () => operationCopy,
88731     operationDelete: () => operationDelete,
88732     operationDisconnect: () => operationDisconnect,
88733     operationDowngrade: () => operationDowngrade,
88734     operationExtract: () => operationExtract,
88735     operationMerge: () => operationMerge,
88736     operationMove: () => operationMove,
88737     operationOrthogonalize: () => operationOrthogonalize,
88738     operationPaste: () => operationPaste,
88739     operationReflectLong: () => operationReflectLong,
88740     operationReflectShort: () => operationReflectShort,
88741     operationReverse: () => operationReverse,
88742     operationRotate: () => operationRotate,
88743     operationSplit: () => operationSplit,
88744     operationStraighten: () => operationStraighten,
88745     osmAreaKeys: () => osmAreaKeys,
88746     osmChangeset: () => osmChangeset,
88747     osmEntity: () => osmEntity,
88748     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
88749     osmInferRestriction: () => osmInferRestriction,
88750     osmIntersection: () => osmIntersection,
88751     osmIsInterestingTag: () => osmIsInterestingTag,
88752     osmJoinWays: () => osmJoinWays,
88753     osmLanes: () => osmLanes,
88754     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
88755     osmNode: () => osmNode,
88756     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
88757     osmNote: () => osmNote,
88758     osmPavedTags: () => osmPavedTags,
88759     osmPointTags: () => osmPointTags,
88760     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
88761     osmRelation: () => osmRelation,
88762     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
88763     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
88764     osmSetAreaKeys: () => osmSetAreaKeys,
88765     osmSetPointTags: () => osmSetPointTags,
88766     osmSetVertexTags: () => osmSetVertexTags,
88767     osmTagSuggestingArea: () => osmTagSuggestingArea,
88768     osmTurn: () => osmTurn,
88769     osmVertexTags: () => osmVertexTags,
88770     osmWay: () => osmWay,
88771     prefs: () => corePreferences,
88772     presetCategory: () => presetCategory,
88773     presetCollection: () => presetCollection,
88774     presetField: () => presetField,
88775     presetIndex: () => presetIndex,
88776     presetManager: () => _mainPresetIndex,
88777     presetPreset: () => presetPreset,
88778     rendererBackground: () => rendererBackground,
88779     rendererBackgroundSource: () => rendererBackgroundSource,
88780     rendererFeatures: () => rendererFeatures,
88781     rendererMap: () => rendererMap,
88782     rendererPhotos: () => rendererPhotos,
88783     rendererTileLayer: () => rendererTileLayer,
88784     serviceKartaview: () => kartaview_default,
88785     serviceKeepRight: () => keepRight_default,
88786     serviceMapRules: () => maprules_default,
88787     serviceMapilio: () => mapilio_default,
88788     serviceMapillary: () => mapillary_default,
88789     serviceNominatim: () => nominatim_default,
88790     serviceNsi: () => nsi_default,
88791     serviceOsm: () => osm_default,
88792     serviceOsmWikibase: () => osm_wikibase_default,
88793     serviceOsmose: () => osmose_default,
88794     servicePanoramax: () => panoramax_default,
88795     serviceStreetside: () => streetside_default,
88796     serviceTaginfo: () => taginfo_default,
88797     serviceVectorTile: () => vector_tile_default,
88798     serviceVegbilder: () => vegbilder_default,
88799     serviceWikidata: () => wikidata_default,
88800     serviceWikipedia: () => wikipedia_default,
88801     services: () => services,
88802     setDebug: () => setDebug,
88803     svgAreas: () => svgAreas,
88804     svgData: () => svgData,
88805     svgDebug: () => svgDebug,
88806     svgDefs: () => svgDefs,
88807     svgGeolocate: () => svgGeolocate,
88808     svgIcon: () => svgIcon,
88809     svgKartaviewImages: () => svgKartaviewImages,
88810     svgKeepRight: () => svgKeepRight,
88811     svgLabels: () => svgLabels,
88812     svgLayers: () => svgLayers,
88813     svgLines: () => svgLines,
88814     svgMapilioImages: () => svgMapilioImages,
88815     svgMapillaryImages: () => svgMapillaryImages,
88816     svgMapillarySigns: () => svgMapillarySigns,
88817     svgMarkerSegments: () => svgMarkerSegments,
88818     svgMidpoints: () => svgMidpoints,
88819     svgNotes: () => svgNotes,
88820     svgOsm: () => svgOsm,
88821     svgPanoramaxImages: () => svgPanoramaxImages,
88822     svgPassiveVertex: () => svgPassiveVertex,
88823     svgPath: () => svgPath,
88824     svgPointTransform: () => svgPointTransform,
88825     svgPoints: () => svgPoints,
88826     svgRelationMemberTags: () => svgRelationMemberTags,
88827     svgSegmentWay: () => svgSegmentWay,
88828     svgStreetside: () => svgStreetside,
88829     svgTagClasses: () => svgTagClasses,
88830     svgTagPattern: () => svgTagPattern,
88831     svgTouch: () => svgTouch,
88832     svgTurns: () => svgTurns,
88833     svgVegbilder: () => svgVegbilder,
88834     svgVertices: () => svgVertices,
88835     t: () => _t,
88836     uiAccount: () => uiAccount,
88837     uiAttribution: () => uiAttribution,
88838     uiChangesetEditor: () => uiChangesetEditor,
88839     uiCmd: () => uiCmd,
88840     uiCombobox: () => uiCombobox,
88841     uiCommit: () => uiCommit,
88842     uiCommitWarnings: () => uiCommitWarnings,
88843     uiConfirm: () => uiConfirm,
88844     uiConflicts: () => uiConflicts,
88845     uiContributors: () => uiContributors,
88846     uiCurtain: () => uiCurtain,
88847     uiDataEditor: () => uiDataEditor,
88848     uiDataHeader: () => uiDataHeader,
88849     uiDisclosure: () => uiDisclosure,
88850     uiEditMenu: () => uiEditMenu,
88851     uiEntityEditor: () => uiEntityEditor,
88852     uiFeatureInfo: () => uiFeatureInfo,
88853     uiFeatureList: () => uiFeatureList,
88854     uiField: () => uiField,
88855     uiFieldAccess: () => uiFieldAccess,
88856     uiFieldAddress: () => uiFieldAddress,
88857     uiFieldCheck: () => uiFieldCheck,
88858     uiFieldColour: () => uiFieldText,
88859     uiFieldCombo: () => uiFieldCombo,
88860     uiFieldDefaultCheck: () => uiFieldCheck,
88861     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
88862     uiFieldEmail: () => uiFieldText,
88863     uiFieldHelp: () => uiFieldHelp,
88864     uiFieldIdentifier: () => uiFieldText,
88865     uiFieldLanes: () => uiFieldLanes,
88866     uiFieldLocalized: () => uiFieldLocalized,
88867     uiFieldManyCombo: () => uiFieldCombo,
88868     uiFieldMultiCombo: () => uiFieldCombo,
88869     uiFieldNetworkCombo: () => uiFieldCombo,
88870     uiFieldNumber: () => uiFieldText,
88871     uiFieldOnewayCheck: () => uiFieldCheck,
88872     uiFieldRadio: () => uiFieldRadio,
88873     uiFieldRestrictions: () => uiFieldRestrictions,
88874     uiFieldRoadheight: () => uiFieldRoadheight,
88875     uiFieldRoadspeed: () => uiFieldRoadspeed,
88876     uiFieldSemiCombo: () => uiFieldCombo,
88877     uiFieldStructureRadio: () => uiFieldRadio,
88878     uiFieldTel: () => uiFieldText,
88879     uiFieldText: () => uiFieldText,
88880     uiFieldTextarea: () => uiFieldTextarea,
88881     uiFieldTypeCombo: () => uiFieldCombo,
88882     uiFieldUrl: () => uiFieldText,
88883     uiFieldWikidata: () => uiFieldWikidata,
88884     uiFieldWikipedia: () => uiFieldWikipedia,
88885     uiFields: () => uiFields,
88886     uiFlash: () => uiFlash,
88887     uiFormFields: () => uiFormFields,
88888     uiFullScreen: () => uiFullScreen,
88889     uiGeolocate: () => uiGeolocate,
88890     uiInfo: () => uiInfo,
88891     uiInfoPanels: () => uiInfoPanels,
88892     uiInit: () => uiInit,
88893     uiInspector: () => uiInspector,
88894     uiIntro: () => uiIntro,
88895     uiIssuesInfo: () => uiIssuesInfo,
88896     uiKeepRightDetails: () => uiKeepRightDetails,
88897     uiKeepRightEditor: () => uiKeepRightEditor,
88898     uiKeepRightHeader: () => uiKeepRightHeader,
88899     uiLasso: () => uiLasso,
88900     uiLengthIndicator: () => uiLengthIndicator,
88901     uiLoading: () => uiLoading,
88902     uiMapInMap: () => uiMapInMap,
88903     uiModal: () => uiModal,
88904     uiNoteComments: () => uiNoteComments,
88905     uiNoteEditor: () => uiNoteEditor,
88906     uiNoteHeader: () => uiNoteHeader,
88907     uiNoteReport: () => uiNoteReport,
88908     uiNotice: () => uiNotice,
88909     uiPaneBackground: () => uiPaneBackground,
88910     uiPaneHelp: () => uiPaneHelp,
88911     uiPaneIssues: () => uiPaneIssues,
88912     uiPaneMapData: () => uiPaneMapData,
88913     uiPanePreferences: () => uiPanePreferences,
88914     uiPanelBackground: () => uiPanelBackground,
88915     uiPanelHistory: () => uiPanelHistory,
88916     uiPanelLocation: () => uiPanelLocation,
88917     uiPanelMeasurement: () => uiPanelMeasurement,
88918     uiPopover: () => uiPopover,
88919     uiPresetIcon: () => uiPresetIcon,
88920     uiPresetList: () => uiPresetList,
88921     uiRestore: () => uiRestore,
88922     uiScale: () => uiScale,
88923     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
88924     uiSectionBackgroundList: () => uiSectionBackgroundList,
88925     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
88926     uiSectionChanges: () => uiSectionChanges,
88927     uiSectionDataLayers: () => uiSectionDataLayers,
88928     uiSectionEntityIssues: () => uiSectionEntityIssues,
88929     uiSectionFeatureType: () => uiSectionFeatureType,
88930     uiSectionMapFeatures: () => uiSectionMapFeatures,
88931     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
88932     uiSectionOverlayList: () => uiSectionOverlayList,
88933     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
88934     uiSectionPresetFields: () => uiSectionPresetFields,
88935     uiSectionPrivacy: () => uiSectionPrivacy,
88936     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
88937     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
88938     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
88939     uiSectionSelectionList: () => uiSectionSelectionList,
88940     uiSectionValidationIssues: () => uiSectionValidationIssues,
88941     uiSectionValidationOptions: () => uiSectionValidationOptions,
88942     uiSectionValidationRules: () => uiSectionValidationRules,
88943     uiSectionValidationStatus: () => uiSectionValidationStatus,
88944     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
88945     uiSettingsCustomData: () => uiSettingsCustomData,
88946     uiSidebar: () => uiSidebar,
88947     uiSourceSwitch: () => uiSourceSwitch,
88948     uiSpinner: () => uiSpinner,
88949     uiSplash: () => uiSplash,
88950     uiStatus: () => uiStatus,
88951     uiSuccess: () => uiSuccess,
88952     uiTagReference: () => uiTagReference,
88953     uiToggle: () => uiToggle,
88954     uiTooltip: () => uiTooltip,
88955     uiVersion: () => uiVersion,
88956     uiViewOnKeepRight: () => uiViewOnKeepRight,
88957     uiViewOnOSM: () => uiViewOnOSM,
88958     uiZoom: () => uiZoom,
88959     utilAesDecrypt: () => utilAesDecrypt,
88960     utilAesEncrypt: () => utilAesEncrypt,
88961     utilArrayChunk: () => utilArrayChunk,
88962     utilArrayDifference: () => utilArrayDifference,
88963     utilArrayFlatten: () => utilArrayFlatten,
88964     utilArrayGroupBy: () => utilArrayGroupBy,
88965     utilArrayIdentical: () => utilArrayIdentical,
88966     utilArrayIntersection: () => utilArrayIntersection,
88967     utilArrayUnion: () => utilArrayUnion,
88968     utilArrayUniq: () => utilArrayUniq,
88969     utilArrayUniqBy: () => utilArrayUniqBy,
88970     utilAsyncMap: () => utilAsyncMap,
88971     utilCheckTagDictionary: () => utilCheckTagDictionary,
88972     utilCleanOsmString: () => utilCleanOsmString,
88973     utilCleanTags: () => utilCleanTags,
88974     utilCombinedTags: () => utilCombinedTags,
88975     utilCompareIDs: () => utilCompareIDs,
88976     utilDeepMemberSelector: () => utilDeepMemberSelector,
88977     utilDetect: () => utilDetect,
88978     utilDisplayName: () => utilDisplayName,
88979     utilDisplayNameForPath: () => utilDisplayNameForPath,
88980     utilDisplayType: () => utilDisplayType,
88981     utilEditDistance: () => utilEditDistance,
88982     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
88983     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
88984     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
88985     utilEntityRoot: () => utilEntityRoot,
88986     utilEntitySelector: () => utilEntitySelector,
88987     utilFastMouse: () => utilFastMouse,
88988     utilFunctor: () => utilFunctor,
88989     utilGetAllNodes: () => utilGetAllNodes,
88990     utilGetSetValue: () => utilGetSetValue,
88991     utilHashcode: () => utilHashcode,
88992     utilHighlightEntities: () => utilHighlightEntities,
88993     utilKeybinding: () => utilKeybinding,
88994     utilNoAuto: () => utilNoAuto,
88995     utilObjectOmit: () => utilObjectOmit,
88996     utilOldestID: () => utilOldestID,
88997     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
88998     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
88999     utilQsString: () => utilQsString,
89000     utilRebind: () => utilRebind,
89001     utilSafeClassName: () => utilSafeClassName,
89002     utilSessionMutex: () => utilSessionMutex,
89003     utilSetTransform: () => utilSetTransform,
89004     utilStringQs: () => utilStringQs,
89005     utilTagDiff: () => utilTagDiff,
89006     utilTagText: () => utilTagText,
89007     utilTiler: () => utilTiler,
89008     utilTotalExtent: () => utilTotalExtent,
89009     utilTriggerEvent: () => utilTriggerEvent,
89010     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
89011     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
89012     utilUniqueDomId: () => utilUniqueDomId,
89013     utilWrap: () => utilWrap,
89014     validationAlmostJunction: () => validationAlmostJunction,
89015     validationCloseNodes: () => validationCloseNodes,
89016     validationCrossingWays: () => validationCrossingWays,
89017     validationDisconnectedWay: () => validationDisconnectedWay,
89018     validationFormatting: () => validationFormatting,
89019     validationHelpRequest: () => validationHelpRequest,
89020     validationImpossibleOneway: () => validationImpossibleOneway,
89021     validationIncompatibleSource: () => validationIncompatibleSource,
89022     validationMaprules: () => validationMaprules,
89023     validationMismatchedGeometry: () => validationMismatchedGeometry,
89024     validationMissingRole: () => validationMissingRole,
89025     validationMissingTag: () => validationMissingTag,
89026     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
89027     validationOsmApiLimits: () => validationOsmApiLimits,
89028     validationOutdatedTags: () => validationOutdatedTags,
89029     validationPrivateData: () => validationPrivateData,
89030     validationSuspiciousName: () => validationSuspiciousName,
89031     validationUnsquareWay: () => validationUnsquareWay
89032   });
89033   var debug, setDebug, d3;
89034   var init_index = __esm({
89035     "modules/index.js"() {
89036       "use strict";
89037       init_actions();
89038       init_behavior();
89039       init_core();
89040       init_geo2();
89041       init_modes2();
89042       init_operations();
89043       init_osm();
89044       init_presets();
89045       init_renderer();
89046       init_services();
89047       init_svg();
89048       init_fields();
89049       init_intro2();
89050       init_panels();
89051       init_panes();
89052       init_sections();
89053       init_settings();
89054       init_ui();
89055       init_util();
89056       init_validations();
89057       init_src31();
89058       debug = false;
89059       setDebug = (newValue) => {
89060         debug = newValue;
89061       };
89062       d3 = {
89063         dispatch: dispatch_default,
89064         geoMercator: mercator_default,
89065         geoProjection: projection,
89066         polygonArea: area_default3,
89067         polygonCentroid: centroid_default2,
89068         select: select_default2,
89069         selectAll: selectAll_default2,
89070         timerFlush
89071       };
89072     }
89073   });
89074
89075   // modules/id.js
89076   var id_exports = {};
89077   var init_id2 = __esm({
89078     "modules/id.js"() {
89079       init_fetch();
89080       init_polyfill_patch_fetch();
89081       init_index();
89082       window.requestIdleCallback = window.requestIdleCallback || function(cb) {
89083         var start2 = Date.now();
89084         return window.requestAnimationFrame(function() {
89085           cb({
89086             didTimeout: false,
89087             timeRemaining: function() {
89088               return Math.max(0, 50 - (Date.now() - start2));
89089             }
89090           });
89091         });
89092       };
89093       window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
89094         window.cancelAnimationFrame(id2);
89095       };
89096       window.iD = index_exports;
89097     }
89098   });
89099   init_id2();
89100 })();
89101 //# sourceMappingURL=iD.js.map